class GPSPositioning(UIATestBase): def setUp(self): super(GPSPositioning, self).setUp() self._test_name = __name__ self.d = g_common_obj.get_device() print "[Setup]: %s" % self._test_name self.gc = GPS_Common() self.gc.check_if_wifi_connected() self.gc.init_apk() self.gc.init_location() def test_GPSPositioningWhenWifiIsConnectedAndStayIndoors(self): self.gc.check_if_wifi_connected() self.gc.kill_uiautomator() test_cmd = "shell am instrument \ -e class com.intel.uitests.tests.comms.location.WithInternet#testGpsPositioningWifiConnectedIndoor \ -w com.intel.uitests.test/com.intel.uitests.runner.UiTestRunner" test_result = g_common_obj.adb_cmd_common(test_cmd, 600) assert "OK" in test_result, "%s failed" % self.__str__() def test_GPSPositioningWhenWifiIsDisconnectedAndStayIndoors(self): self.gc.kill_uiautomator() test_cmd = "shell am instrument \ -e class com.intel.uitests.tests.comms.location.NoInternet#testNetworksPositioningWifiDisconnectedIndoor \ -w com.intel.uitests.test/com.intel.uitests.runner.UiTestRunner" test_result = g_common_obj.adb_cmd_common(test_cmd, 600) assert "OK" in test_result, "%s failed" % self.__str__()
class NetworkPositioning(UIATestBase): def setUp(self): super(NetworkPositioning, self).setUp() self._test_name = __name__ self.d = g_common_obj.get_device() print "[Setup]: %s" % self._test_name self.func = Function() self.gc = GPS_Common() self.gc.check_if_wifi_connected() self.gc.init_apk() self.gc.init_location() (self._lattd, self._longtd) = self.gc.fetch_latitude_longitude() def test_networkPositioningWhenWifiIsConnectedAndStayIndoors(self): self.gc.kill_uiautomator() _cmd = "shell am instrument \ -e class com.intel.uitests.tests.comms.location.Coordinates#testNetworkingPositioningWifiConnectedIndoor \ -e latitude %s -e longitude %s \ -w com.intel.uitests.test/com.intel.uitests.runner.UiTestRunner " % ( self._lattd, self._longtd) _test_result = g_common_obj.adb_cmd_common(_cmd, 600) assert "OK" in _test_result, "%s failed" % self.__str__() def test_networkPositioningWhenWifiIsDisconnectedAndStayIndoors(self): self.gc.kill_uiautomator() _cmd = "shell am instrument \ -e class com.intel.uitests.tests.comms.location.NoInternet#testNetworksPositioningWifiDisconnectedIndoor \ -w com.intel.uitests.test/com.intel.uitests.runner.UiTestRunner " _test_result = g_common_obj.adb_cmd_common(_cmd, 600) assert "OK" in _test_result, "%s failed" % self.__str__()
class Location_OnOff(UIATestBase): def setUp(self): super(Location_OnOff, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self.d = g_common_obj.get_device() self.l = Logger.getlogger(__name__) self.gc = GPS_Common() self.gc.check_if_wifi_connected() self.gc.init_apk() self.gc.Turn_On_Location() self.gc.init_location() (self._lattd, self._longtd) = self.gc.fetch_latitude_longitude() def test_turnOnOffLocation10Times(self): # self.gc.kill_uiautomator() # _cmd = "shell am instrument \ # -e class com.intel.uitests.tests.comms.location.CoordinatesIterative#testTurnOnOffLocationIterative \ # -e latitude %s -e longitude %s -e iterations 10 \ # -w com.intel.uitests.test/com.intel.uitests.runner.UiTestRunner " % (self._lattd, self._longtd) # _test_result = g_common_obj.adb_cmd_common(_cmd, 600) # assert "OK" in _test_result, "%s failed" % self.__str__() for i in range(10): self.gc.Turn_Off_Location() self.gc.location_not_get() self.gc.Turn_On_Location() self.gc.get_location_and_check_accuracy(self._lattd, self._longtd) self.l.info("GPS On/Off cycle %s Pass." % (i + 1))
class Detect_Satellites(UIATestBase): def setUp(self): super(Detect_Satellites, self).setUp() self._test_name = __name__ self.device = g_common_obj.get_device() print "[Setup]: %s" % self._test_name self.gc = GPS_Common() self.gc.check_if_wifi_connected() self.gc.init_apk() self.gc.init_location() def test_receiverSensitivityAndNumberOfVisibleSatellitesIndoor(self): self.gc.check_if_wifi_connected() self.gc.kill_uiautomator() _cmd = "shell am instrument \ -e class com.intel.uitests.tests.comms.location.WithInternet#testNumberOfSatellitesIndoor \ -w com.intel.uitests.test/com.intel.uitests.runner.UiTestRunner " _test_result = g_common_obj.adb_cmd_common(_cmd, 600) assert "OK" in _test_result, "%s failed" % self.__str__()
class Location_OnOff_Effect(UIATestBase): def setUp(self): super(Location_OnOff_Effect, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self.gc = GPS_Common() self.gc.check_if_wifi_connected() self.gc.init_apk() self.gc.init_location() (self._lattd, self._longtd) = self.gc.fetch_latitude_longitude() def test_turnOnOffLocationServiceAndCheckIfSettingIsObeyed(self): self.gc.kill_uiautomator() _cmd = "shell am instrument \ -e class com.intel.uitests.tests.comms.location.Coordinates#testTurnOnOffLocationSettingIsObeyed \ -e latitude %s -e longitude %s \ -w com.intel.uitests.test/com.intel.uitests.runner.UiTestRunner " % ( self._lattd, self._longtd) _test_result = g_common_obj.adb_cmd_common(_cmd, 600) assert "OK" in _test_result, "%s failed" % self.__str__()
class LocationStatus(UIATestBase): def setUp(self): super(LocationStatus, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self.gc = GPS_Common() self.gc.check_if_wifi_connected() self.gc.init_apk() self.gc.init_location() (self._lattd, self._longtd) = self.gc.fetch_latitude_longitude() def test_locationStatusInQuickSettingsVsMainSettings(self): self.gc.kill_uiautomator() _cmd = "shell am instrument \ -e class com.intel.uitests.tests.comms.location.Coordinates#testLocationStatusQuickMenuVsSettings \ -e latitude %s -e longitude %s \ -w com.intel.uitests.test/com.intel.uitests.runner.UiTestRunner " % ( self._lattd, self._longtd) _test_result = g_common_obj.adb_cmd_common(_cmd, 600) assert "OK" in _test_result, "%s failed" % self.__str__()
class NoPrevention(UIATestBase): def setUp(self): super(NoPrevention, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self.gc = GPS_Common() self.gc.check_if_wifi_connected() self.gc.init_apk() self.gc.init_location() (self._lattd, self._longtd) = self.gc.fetch_latitude_longitude() def test_theDownloadingFileWouldNotPreventShowingYourLocationBatterySavingAndWifiConnected(self): self.gc.check_if_wifi_connected() self.gc.kill_uiautomator() _cmd = "shell am instrument \ -e class com.intel.uitests.tests.comms.location.DownloadsNeeded#testDownloadFileBatterySaving \ -e latitude %s -e longitude %s \ -w com.intel.uitests.test/com.intel.uitests.runner.UiTestRunner " % (self._lattd, self._longtd) _test_result = g_common_obj.adb_cmd_common(_cmd, 600) assert "OK" in _test_result, "%s failed" % self.__str__()
class AGPS(UIATestBase): def setUp(self): super(AGPS, self).setUp() self._test_name = __name__ self.d = g_common_obj.get_device() print "[Setup]: %s" % self._test_name self.gc = GPS_Common() self.gc.Turn_On_Location() self.gc.check_if_wifi_connected() def test_files_downloaded(self): assert g_common_obj.adb_cmd_capture_msg( "getprop | grep BRCM" ), "DUT doesn't seem to have a broadcom gps chip, quit test" assert g_common_obj.adb_cmd_capture_msg('[ -e "/data/gps/lto2.dat" ] && echo "Pass" || echo "Fail"') == "Pass", \ "The file lto2.dat not found!" assert g_common_obj.adb_cmd_capture_msg('[ -e "/data/gps/ltoStatus.txt" ] && echo "Pass" || echo "Fail"') == "Pass", \ "The file ltoStatus.txt not found!" def tearDown(self): print "[Teardown]: %s" % self._test_name super(AGPS, self).tearDown() g_common_obj.stop_app_am("com.android.settings")