@@ -246,15 +246,13 @@ void setUp(void)
246246 RESET_FAKE (nrf_cloud_coap_disconnect );
247247 RESET_FAKE (nrf_cloud_coap_json_message_send );
248248 RESET_FAKE (nrf_cloud_coap_location_send );
249- RESET_FAKE (nrf_cloud_coap_location_get );
250249 RESET_FAKE (nrf_cloud_coap_shadow_get );
251250 RESET_FAKE (nrf_cloud_coap_patch );
252251 RESET_FAKE (date_time_now );
253252 RESET_FAKE (nrf_provisioning_init );
254253 RESET_FAKE (nrf_provisioning_trigger_manually );
255254 RESET_FAKE (storage_batch_read );
256255 RESET_FAKE (nrf_cloud_coap_sensor_send );
257- RESET_FAKE (location_cloud_location_ext_result_set );
258256
259257 nrf_cloud_client_id_get_fake .custom_fake = nrf_cloud_client_id_get_custom_fake ;
260258 nrf_provisioning_init_fake .custom_fake = nrf_provisioning_init_custom_fake ;
@@ -265,7 +263,6 @@ void setUp(void)
265263
266264 /* Set default return values */
267265 nrf_cloud_coap_location_send_fake .return_val = 0 ;
268- nrf_cloud_coap_location_get_fake .return_val = 0 ;
269266 storage_batch_read_fake .return_val = - EAGAIN ;
270267
271268 /* Clear all channels */
@@ -611,161 +608,6 @@ void test_gnss_location_data_handling(void)
611608 }
612609}
613610
614- /* Test cloud location request with valid Wi-Fi data */
615- void test_cloud_location_request_with_valid_wifi (void )
616- {
617- int err ;
618- struct wifi_scan_result mock_aps [2 ] = {
619- {.ssid = {0 }, .ssid_length = 0 , .rssi = -50 , .channel = 1 },
620- {.ssid = {0 }, .ssid_length = 0 , .rssi = -60 , .channel = 6 }
621- };
622- struct wifi_scan_info mock_wifi_info = {
623- .ap_info = mock_aps ,
624- .cnt = 2
625- };
626- struct location_data_cloud mock_cloud_request = {
627- .cell_data = NULL ,
628- .wifi_data = & mock_wifi_info
629- };
630- struct location_msg location_msg = {
631- .type = LOCATION_CLOUD_REQUEST ,
632- .cloud_request = mock_cloud_request
633- };
634- struct storage_msg passthrough_msg = {
635- .type = STORAGE_MODE_PASSTHROUGH
636- };
637- struct storage_msg storage_data_msg = {
638- .type = STORAGE_DATA ,
639- .data_type = STORAGE_TYPE_LOCATION ,
640- .data_len = sizeof (struct location_msg )
641- };
642-
643- memcpy (storage_data_msg .buffer , & location_msg , sizeof (location_msg ));
644-
645- connect_cloud ();
646-
647- err = zbus_chan_pub (& STORAGE_CHAN , & passthrough_msg , K_NO_WAIT );
648- TEST_ASSERT_EQUAL (0 , err );
649- k_sleep (K_MSEC (10 ));
650-
651- /* Send cloud location request with valid Wi-Fi data */
652- err = zbus_chan_pub (& STORAGE_DATA_CHAN , & storage_data_msg , K_NO_WAIT );
653- TEST_ASSERT_EQUAL (0 , err );
654- k_sleep (K_MSEC (PROCESSING_DELAY_MS ));
655-
656- /* Verify that location request was sent to nRF Cloud */
657- TEST_ASSERT_EQUAL (1 , nrf_cloud_coap_location_get_fake .call_count );
658-
659- /* Verify request was not NULL */
660- if (nrf_cloud_coap_location_get_fake .call_count > 0 ) {
661- TEST_ASSERT_NOT_NULL (nrf_cloud_coap_location_get_fake .arg0_val );
662- }
663- }
664-
665- /* Test cloud location request with 0 Wi-Fi APs still sends request */
666- void test_cloud_location_request_with_zero_wifi_aps (void )
667- {
668- int err ;
669- struct wifi_scan_info mock_wifi_info = {
670- .ap_info = NULL ,
671- .cnt = 0
672- };
673- struct location_data_cloud mock_cloud_request = {
674- .cell_data = NULL ,
675- .wifi_data = & mock_wifi_info
676- };
677- struct location_msg location_msg = {
678- .type = LOCATION_CLOUD_REQUEST ,
679- .cloud_request = mock_cloud_request
680- };
681- struct storage_msg passthrough_msg = {
682- .type = STORAGE_MODE_PASSTHROUGH
683- };
684- struct storage_msg storage_data_msg = {
685- .type = STORAGE_DATA ,
686- .data_type = STORAGE_TYPE_LOCATION ,
687- .data_len = sizeof (struct location_msg )
688- };
689-
690- memcpy (storage_data_msg .buffer , & location_msg , sizeof (location_msg ));
691-
692- connect_cloud ();
693-
694- err = zbus_chan_pub (& STORAGE_CHAN , & passthrough_msg , K_NO_WAIT );
695- TEST_ASSERT_EQUAL (0 , err );
696- k_sleep (K_MSEC (10 ));
697-
698- /* Send cloud location request with 0 Wi-Fi APs */
699- err = zbus_chan_pub (& STORAGE_DATA_CHAN , & storage_data_msg , K_NO_WAIT );
700- TEST_ASSERT_EQUAL (0 , err );
701- k_sleep (K_MSEC (PROCESSING_DELAY_MS ));
702-
703- /* Verify that location request was still sent (Wi-Fi omitted internally) */
704- TEST_ASSERT_EQUAL (1 , nrf_cloud_coap_location_get_fake .call_count );
705-
706- /* Verify request was not NULL */
707- if (nrf_cloud_coap_location_get_fake .call_count > 0 ) {
708- TEST_ASSERT_NOT_NULL (nrf_cloud_coap_location_get_fake .arg0_val );
709- }
710- }
711-
712- /* Test cloud location request with cellular data and 0 Wi-Fi APs */
713- void test_cloud_location_request_cellular_with_zero_wifi_aps (void )
714- {
715- int err ;
716- struct lte_lc_cell mock_cell = {
717- .mcc = 242 ,
718- .mnc = 1 ,
719- .id = 12345 ,
720- .tac = 678
721- };
722- struct lte_lc_cells_info mock_cells_info = {
723- .current_cell = mock_cell ,
724- .ncells_count = 0
725- };
726- struct wifi_scan_info mock_wifi_info = {
727- .ap_info = NULL ,
728- .cnt = 0
729- };
730- struct location_data_cloud mock_cloud_request = {
731- .cell_data = & mock_cells_info ,
732- .wifi_data = & mock_wifi_info
733- };
734- struct location_msg location_msg = {
735- .type = LOCATION_CLOUD_REQUEST ,
736- .cloud_request = mock_cloud_request
737- };
738- struct storage_msg passthrough_msg = {
739- .type = STORAGE_MODE_PASSTHROUGH
740- };
741- struct storage_msg storage_data_msg = {
742- .type = STORAGE_DATA ,
743- .data_type = STORAGE_TYPE_LOCATION ,
744- .data_len = sizeof (struct location_msg )
745- };
746-
747- memcpy (storage_data_msg .buffer , & location_msg , sizeof (location_msg ));
748-
749- connect_cloud ();
750-
751- err = zbus_chan_pub (& STORAGE_CHAN , & passthrough_msg , K_NO_WAIT );
752- TEST_ASSERT_EQUAL (0 , err );
753- k_sleep (K_MSEC (10 ));
754-
755- /* Send cloud location request with cellular data and 0 Wi-Fi APs */
756- err = zbus_chan_pub (& STORAGE_DATA_CHAN , & storage_data_msg , K_NO_WAIT );
757- TEST_ASSERT_EQUAL (0 , err );
758- k_sleep (K_MSEC (PROCESSING_DELAY_MS ));
759-
760- /* Verify that location request was sent (cellular used, Wi-Fi omitted) */
761- TEST_ASSERT_EQUAL (1 , nrf_cloud_coap_location_get_fake .call_count );
762-
763- /* Verify request was not NULL */
764- if (nrf_cloud_coap_location_get_fake .call_count > 0 ) {
765- TEST_ASSERT_NOT_NULL (nrf_cloud_coap_location_get_fake .arg0_val );
766- }
767- }
768-
769611void test_storage_data_battery_sent_to_cloud (void )
770612{
771613 int err ;
0 commit comments