예제 #1
0
 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()
예제 #2
0
 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 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()
예제 #4
0
 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()
예제 #5
0
 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()
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__()
예제 #7
0
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")
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__()
예제 #10
0
    def test_ScreenOff_TimeOut(self):
        """
        test_ScreenOff_TimeOut

        Steps:
        1. set brightness to maximum.
            DUT brightness is changed to brightest.
        2. set Sleep time to 30 seconds.
            DUT sleep time is set to 5 minutes successfully.
        3. Idle the DUT.
            DUT screen turned Off automatically after 5 minutes.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. set brightness to maximum.
            DUT brightness is changed to brightest."""
        self.sys_setting.put_system_setting('screen_brightness', '255')

        print """[Step] 2. set Sleep time to 30 seconds.
            DUT sleep time is set to 30 seconds successfully."""
        self.dbsettings.set_status_stay_awake(False)
        self.sys_setting.put_system_setting('screen_off_timeout',
                                            str(self.sleep_time * 1000))
        self.d.screen.off()
        self.systemui.unlock_screen()
        self.d.screen.on()

        print """[Step] 3. Idle the DUT.
            DUT screen turned Off automatically after 30 seconds."""
        from testlib.gps.common import GPS_Common
        GPS_Common().kill_uiautomator()
        # start_time = time.time()
        # steep_time = 0.5
        # while time.time() - start_time <= self.sleep_time - steep_time:
        #     current_time = time.time()
        #     print "[Debug] second %.3f" % (current_time - start_time)
        #     assert is_device_screen_on(),\
        #         "[FAILURE] go to screen off early! start_time:%s current_time:%s"\
        #         % (start_time, current_time)
        #     time.sleep(steep_time)
        time.sleep(self.sleep_time + 5)
        print "-----------GFX_test_ScreenOff_TimeOut------------------"
        # from testlib.graphics.screenshot_for_liverpt import take_screenshot_for_liverpt
        # take_screenshot_for_liverpt()
        assert not is_device_screen_on(),\
            "[FAILURE] Failed automatically turned off"
예제 #11
0
    def test_google_cloud_messaging_disable_wifi(self):
        try:
#             Settings.disable_wifi()
#             time.sleep(4)  # wait for wifi to be switched off
            message_text = self.gen_unique_google_cloud_message()
#             AdbUtils.start_activity_with_package_name(Messaging.gcm_receiver_package, "--pct-syskeys 0 -v 500")
            g_common_obj.launch_app_am('gcm.play.android.samples.com.gcmquickstart', 'gcm.play.android.samples.com.gcmquickstart.MainActivity')
            time.sleep(5)
            self.assertTrue(self.d(packageName=Messaging.gcm_receiver_package).wait.exists(timeout=20000),
                            "google cloud messaging receiver app failed to start on DUT")
            Settings.disable_wifi()
            time.sleep(5)
            self.send_google_cloud_message_from_host(message_text)
            time.sleep(5)  # wait a little before turning on wifi
            Settings.enable_wifi()
            time.sleep(30)  # wait more time for WiFi reconnection in a congested wireless environment
            GPS_Common().check_if_wifi_connected()
            self.wait_for_gcm_message(message_text)
        finally:
            Settings.enable_wifi()
            ShellUtils.clean_local_dir(Environment.tmp_dir_path)
예제 #12
0
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__()
예제 #13
0
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__()
예제 #14
0
    def test_take_bug_report(self):
        GPS_Common().check_if_wifi_connected()
        ga_st = EnvironmentUtils.check_if_google_account_added()
        if not ga_st:
            self.func.add_google_account_mr1(self.username, self.passwd)
        Settings.turn_on_account_auto_sync()
        Settings.take_bug_report()
        # a popup for taking a bug report should appear
        if EnvironmentUtils.get_android_version() == "N":
            self.assertTrue(
                self.d(text=SETTINGS_TAKE_BUG_REPORT_POPUP_REPORT_BUTTON_TXT_N
                       ).wait.exists(timeout=3000))
            self.d(text=SETTINGS_TAKE_BUG_REPORT_POPUP_REPORT_BUTTON_TXT_N
                   ).click()
        else:
            self.assertTrue(
                self.d(text=SETTINGS_TAKE_BUG_REPORT_POPUP_REPORT_BUTTON_TXT).
                wait.exists(timeout=3000))
            self.d(
                text=SETTINGS_TAKE_BUG_REPORT_POPUP_REPORT_BUTTON_TXT).click()
        poll_waiting_tries_for_notification = 30
        found_bug_report_notification = False
        while poll_waiting_tries_for_notification > 0:
            self.d.open.notification()
            time.sleep(10)
            while self.d(textContains="is being generated").exists:
                LOG.info("Waiting for bug report to be generated.")
                time.sleep(10)
#             if self.d(text=SETTINGS_TAKE_BUG_REPORT_NOTIFICATION_TXT).wait.exists(timeout=3000):
            if self.d(textStartsWith="Bug report").wait.exists(timeout=3000):
                # bug report was completed
                found_bug_report_notification = True
                break
            self.d.press.home()  # close notifications
            poll_waiting_tries_for_notification -= 1
        self.assertTrue(
            found_bug_report_notification,
            "a notification for the bugreport should have appeared")
        # StatusBar.open_notifications()  # notifications already opened after break in for
        #         self.assertTrue(self.d(text=SETTINGS_TAKE_BUG_REPORT_NOTIFICATION_TXT).wait.exists(timeout=3000),
        self.assertTrue(
            self.d(textStartsWith="Bug report").wait.exists(timeout=3000),
            "a bug report notification should exist in the notifications bar")
        #         self.d(text=SETTINGS_TAKE_BUG_REPORT_NOTIFICATION_TXT).click()
        self.d(textStartsWith="Bug report").click()
        # popup to warn not to share sensitive data with untrusted parties
        SystemPopupsAndDialogs.popup_ok()
        # popup for choosing wich app will handle the bugreport
        # there are different types of popup for different Android versions and devices
        SystemPopupsAndDialogs.open_resource_with(GMAIL_APP_NAME)
        time.sleep(15)
        # gmail application must open with attached bug report information
        self.assertTrue(
            self.d(packageName=GMAIL_PACKAGE_NAME).wait.exists(timeout=5000),
            "gmail should have opened displaying the send bug report mail")
        time.sleep(5)
        SystemPopupsAndDialogs.popup_skip()
        # Gmail app setup
        time.sleep(5)
        if self.d(resourceId="com.google.android.gm:id/welcome_tour_skip"
                  ).exists:
            self.d(resourceId="com.google.android.gm:id/welcome_tour_skip"
                   ).click.wait()
        if self.d(resourceId="com.google.android.gm:id/action_done").exists:
            self.d(resourceId="com.google.android.gm:id/action_done"
                   ).click.wait()
            self.d.press.back()

        Gmail.select_sync_account_now()
        time.sleep(20)
        self.assertTrue(
            self.d(textStartsWith=GMAIL_TAKE_BUG_REPORT_ATTACHEMENT_PREFIX_TXT
                   ).wait.exists(timeout=50000),
            "mail should have an attachement containing bugreport details")
예제 #15
0
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__()
예제 #16
0
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))