示例#1
0
    def setUp(self):
        super(Messaging, self).setUp()
        self.__test_name = __name__
        print "Setup: %s" % self.__test_name
        self.d = g_common_obj.get_device()
        UiAutomatorUtils.unlock_screen()
        resource.disable_app_verification()
        _apk_path = resource.get_resource_from_atifactory\
        ("tests.tablet.artifactory.conf", "GCM", "gcm_listener")
        g_common_obj.adb_cmd_common("install -r %s" % _apk_path)
        self._jar_path = resource.get_resource_from_atifactory\
        ("tests.tablet.artifactory.conf", "GCM", "gcm_sender")
        self._proxy_file = resource.get_resource_from_atifactory\
        ("tests.tablet.artifactory.conf", "Proxy", "http_proxy")
        with open(self._proxy_file) as pf:
            self._proxy = pf.read().strip('\n')

        """
        Get Android version:
        adb shell getprop | grep ro.build.version.sdk
        """
        cmd = 'getprop | grep ro.build.version.sdk'
        sdk_string = g_common_obj.adb_cmd_capture_msg(cmd)
        if '24' in sdk_string:
            self.android_version = "N"
        elif '23' in sdk_string:
            self.android_version = "M"
        elif '22' in sdk_string:
            self.android_version = "L"
 def setUp(self):
     super(Bug_Report, self).setUp()
     self.__test_name = __name__
     print "Setup: %s" % self.__test_name
     self.d = g_common_obj.get_device()
     self.func = Func_New()
     self.conf = TestConfig().read(section='google_account')
     self.username = self.conf.get("user_name")
     self.passwd = self.conf.get("password")
     UiAutomatorUtils.unlock_screen()
示例#3
0
 def setUp(self):
     super(DataUsage, self).setUp()
     self.__test_name = __name__
     print "Setup: %s" % self.__test_name
     self._cts_test = CTS_Impl()
     UiAutomatorUtils.unlock_screen()
     resource.disable_app_verification()
     _apk_path = resource.get_resource_from_atifactory\
     ("tests.tablet.artifactory.conf", "SDK_API", "api_test")
     g_common_obj.adb_cmd_common("install -r %s" % _apk_path)
 def setUp(self):
     super(Calendar_Reminder, self).setUp()
     self.__test_name = __name__
     print "Setup: %s" % self.__test_name
     self.c = Calendar()
     self.d = g_common_obj.get_device()
     UiAutomatorUtils.unlock_screen()
     resource.disable_app_verification()
     _apk_path = resource.get_resource_from_atifactory\
     ("tests.tablet.artifactory.conf", "SDK_API", "api_test")
     g_common_obj.adb_cmd_common("install -r %s" % _apk_path)
 def setUp(self):
     super(Clock_Alarm_Reboot, self).setUp()
     self.__test_name = __name__
     print "Setup: %s" % self.__test_name
     self.d = g_common_obj.get_device()
     UiAutomatorUtils.unlock_screen()
     resource.disable_app_verification()
     for i in ["api_test", "system_api"]:
         _apk_path = resource.get_resource_from_atifactory\
         ("tests.tablet.artifactory.conf", "SDK_API", i)
         g_common_obj.adb_cmd_common("install -r %s" % _apk_path)
示例#6
0
 def setUp(self):
     super(SystemTimeUpdate, self).setUp()
     self.__test_name = __name__
     print "Setup: %s" % self.__test_name
     self.d = g_common_obj.get_device()
     UiAutomatorUtils.unlock_screen()
     resource.disable_app_verification()
     self.screenshooter = ScreenshotUtils()
     _apk_path = resource.get_resource_from_atifactory\
     ("tests.tablet.artifactory.conf", "SDK_API", "system_api")
     g_common_obj.adb_cmd_common("install -r %s" % _apk_path)
 def setUp(self):
     super(Recents_20, self).setUp()
     self.__test_name = __name__
     print "Setup: %s" % self.__test_name
     self.d = g_common_obj.get_device()
     UiAutomatorUtils.unlock_screen()
     resource.disable_app_verification()
     for i in range(1, 21):
         _apk_path = resource.get_resource_from_atifactory\
         ("tests.tablet.artifactory.conf", "20recents", str(i))
         g_common_obj.adb_cmd_common("install -r %s" % _apk_path)
示例#8
0
 def setUp(self):
     super(ImmersiveMode, self).setUp()
     self.__test_name = __name__
     print "Setup: %s" % self.__test_name
     self.d = g_common_obj.get_device()
     UiAutomatorUtils.unlock_screen()
     resource.disable_app_verification()
     self.screenshooter = ScreenshotUtils()
     for i in ["temple_run", "immersive_ui"]:
         _apk_path = resource.get_resource_from_atifactory\
         ("tests.tablet.artifactory.conf", "ImmersiveMode", i)
         g_common_obj.adb_cmd_common("install -r %s" % _apk_path)
示例#9
0
 def setUp(self):
     super(MemTrack, self).setUp()
     self.__test_name = __name__
     print "Setup: %s" % self.__test_name
     self.d = g_common_obj.get_device()
     UiAutomatorUtils.unlock_screen()
     for i in ["device_ui", "jank_test"]:
         _apk_path = resource.get_resource_from_atifactory\
         ("tests.tablet.artifactory.conf", "CTS_APKS", i)
         g_common_obj.adb_cmd_common("install -r %s" % _apk_path)
     _bin_path = resource.get_resource_from_atifactory\
         ("tests.tablet.artifactory.conf", "BIN", "memtrack")
     g_common_obj.adb_cmd_common("push  %s /data/" % _bin_path)
示例#10
0
 def test_alarm_after_reboot(self):
     hh, mm, ss = Calendar.get_current_dut_time()
     result = SystemApiTestsInterface.run_instrumentation(
         class_name="CommonTestsDriver",
         method_name="testDisableAutoTime",
         instrumentation_args=None,
         runner_name="GenericArgumentPassingTestRunner")
     self.assertTrue(
         SystemApiTestsInterface.was_instrumentation_test_successful(
             result), "Could not disable auto time sync")
     try:
         # set an alarm at least 250 seconds into the future
         alarm_time = Clock.set_new_alarm(hh, mm, offset=120)
         hh, mm, ss = Calendar.get_current_dut_time()
         current_time = datetime.datetime(1, 1, 1, int(hh), int(mm),
                                          int(ss))
         time.sleep(5)
         reboot_time = UiAutomatorUtils.reboot_device()
         UiAutomatorUtils.unlock_screen()
         time_delta = alarm_time - current_time
         sleep_time = time_delta.seconds - reboot_time
         if sleep_time > 0:
             LOG.info("sleeping for %s seconds" % time_delta.seconds)
             time.sleep(sleep_time)
         self.d.open.notification()
         self.assertTrue(self.d(text="Alarm").wait.exists(timeout=3000))
         if EnvironmentUtils.get_android_version() == "N":
             self.assertTrue(
                 self.d(text=CLOCK_SNOOZE_ALARM_TXT_N).wait.exists(
                     timeout=3000))
             self.assertTrue(
                 self.d(textContains=CLOCK_DISMISS_ALARM_TXT_N).wait.exists(
                     timeout=3000))
             self.d(text=CLOCK_DISMISS_ALARM_TXT_N).click()
         else:
             self.assertTrue(
                 self.d(text=CLOCK_SNOOZE_ALARM_TXT).wait.exists(
                     timeout=3000))
             self.assertTrue(
                 self.d(textContains=CLOCK_DISMISS_ALARM_TXT).wait.exists(
                     timeout=3000))
             self.d(text=CLOCK_DISMISS_ALARM_TXT).click()
     finally:
         Clock.delete_all_alarms()
示例#11
0
    def test_system_time_update(self):
        result = SystemApiTestsInterface.run_instrumentation(class_name="CommonTestsDriver",
                                                             method_name="testDisableAutoTime",
                                                             instrumentation_args=None,
                                                             runner_name="GenericArgumentPassingTestRunner")
        self.assertTrue(SystemApiTestsInterface.was_instrumentation_test_successful(result),
                        "Could not disable auto time sync")
        initial_system_time = SystemUtils.get_system_time()
        LOG.info("initial time: " + str(initial_system_time))
        initial_hour_format = SystemUtils.get_hour_format()
        LOG.info("initial hour format: " + str(initial_hour_format))
        new_system_time = initial_system_time.copy()
        new_system_time.min = 0
        new_system_time.day = 2
        new_system_time.time_zone = "Cuba"
        hour_format_toggle = {12: 24, 24: 12}
        new_hour_format = hour_format_toggle[initial_hour_format]

        try:
            self.assertTrue(SystemUtils.set_hour_format(new_hour_format), "could not set new hour format")
            self.assertTrue(SystemUtils.set_system_time(new_system_time), "could not set new System time")
            reboot_time = UiAutomatorUtils.reboot_device()
            LOG.info("reboot time was: " + str(reboot_time))
            UiAutomatorUtils.unlock_screen()
            system_time_after_reboot = SystemUtils.get_system_time()
            LOG.info("after reboot time: " + str(system_time_after_reboot))
            hour_format_after_reboot = SystemUtils.get_hour_format()
            LOG.info("after reboot hour format: " + str(hour_format_after_reboot))
            self.assertTrue(system_time_after_reboot.time_zone == new_system_time.time_zone,
                            "timezone did not persist after reboot")
            self.assertTrue(abs(system_time_after_reboot.day - new_system_time.day) < 2,
                            "system day did not persist after reboot")
            self.assertTrue(system_time_after_reboot.min <= new_system_time.min + 2 * reboot_time / 60 + 5,
                            "system minute was affected by the reboot")
            self.assertTrue(hour_format_after_reboot == new_hour_format,
                            "system hour format was affected by the reboot")
        finally:
            SystemUtils.set_hour_format(initial_hour_format)
            SystemUtils.set_system_time(initial_system_time)
示例#12
0
    def test_safe_mode_by_property(self):
        g_common_obj.root_on_device()
        set_safemode_cmd = "setprop persist.sys.safemode 1"
        g_common_obj.adb_cmd(set_safemode_cmd)
        AdbUtils.reboot_device()
        UiAutomatorUtils.unlock_screen()
        g_common_obj.root_on_device()
        try:
            UiAutomatorUtils.launch_app_from_apps_menu("API Demos")
        except:
            print "Pass"
        else:
            assert None, "The 3rd party app is still visible in all apps menu when DUT in safe mode!"

        AdbUtils.reboot_device()
        UiAutomatorUtils.unlock_screen()
        g_common_obj.root_on_device()
        try:
            UiAutomatorUtils.launch_app_from_apps_menu("API Demos")
        except:
            assert None, "The 3rd party app is invisible in all apps menu when DUT is not in safe mode!"
        else:
            print "Pass"
示例#13
0
    def test_SmartLock_TrustedLocation(self):
        trusted_place = "Havana, Cuba"
        try:
            # Enable location
            LOG.info("Enabling location")
            Settings.enable_location()

            # Enable screen lock pin and add a trusted place (current location)
            LOG.info("Enabling PIN screen lock")
            Settings.enable_pin()
            LOG.info("Adding trusted place - current location")
            Settings.add_trusted_place()

            self.d.press.home()
            # Lock the screen
            LOG.info("Locking the screen")
            self.d.press.power()
            time.sleep(5)

            # Unlock the device
            LOG.info("Unlocking the screen")
            UiAutomatorUtils.unlock_screen()

            LOG.info("Checking the PIN keyguard in NOT present")
            assert not self.d(
                resourceId=ANDROID_KEYGUARD_PIN_VIEW_RESID
            ).wait.exists(
                timeout=5000
            ), "The keyguard should not be present in the current trusted place"
            time.sleep(3)

            #Below "if" codes is to handle an info window of trusted unlocking.
            if self.d(resourceId=SETTINGS_TRUSTED_FIRST_TIME_RESID).exists:
                self.d(resourceId=SETTINGS_TRUSTED_FIRST_TIME_RESID).click()

            # Remove the current trusted place
            LOG.info("Removing the current trusted place")
            Settings.remove_trusted_place()

            # Add a trusted place in another location
            LOG.info("Adding trusted place - {0}".format(trusted_place))
            Settings.add_trusted_place(trusted_place)

            self.d.press.home()
            # Lock the screen
            LOG.info("Locking the screen")
            self.d.press.power()
            time.sleep(2)

            # Unlock the device
            LOG.info("unlocking the screen")
            UiAutomatorUtils.unlock_screen()

            LOG.info(
                "Checking the PIN keyguard is present in a non-trusted place")
            assert self.d(
                resourceId=ANDROID_KEYGUARD_PIN_VIEW_RESID).wait.exists(
                    timeout=5000
                ), "The keyguard should appear when not in a trusted location"

            # Input the PIN via shell
            AdbUtils.input_text(TEST_PIN)
            time.sleep(1)
            self.d.press.enter()
            time.sleep(3)

            # Remove the trusted place
            LOG.info("Removing the trusted place - {0}".format(trusted_place))
            Settings.remove_trusted_place(trusted_place)
        except Exception, e:
            AdbUtils.input_text(TEST_PIN)
            time.sleep(3)
            self.d.press.enter()
            time.sleep(5)
            raise e
示例#14
0
 def setUp(self):
     super(SmartLockTrustedLocation, self).setUp()
     self.__test_name = __name__
     print "Setup: %s" % self.__test_name
     self.d = g_common_obj.get_device()
     UiAutomatorUtils.unlock_screen()
示例#15
0
 def setUp(self):
     super(AutomotiveProfile, self).setUp()
     self.__test_name = __name__
     LOG.debug("Setup: %s" % self.__test_name)
     UiAutomatorUtils.unlock_screen()
示例#16
0
 def setUp(self):
     super(ScreenRecording, self).setUp()
     self.__test_name = __name__
     print "Setup: %s" % self.__test_name
     UiAutomatorUtils.unlock_screen()