def play_video(self, secs=None, timeout=None):
        """click play video"""

        print "[Debug] play_video"
        mark_time = logcat.get_device_time_mark()
        pre_dump = self.d.dump()
        pre_focus = SystemUi.get_current_focus()
        print pre_focus

        self._view.play.click.wait()
        if secs:
            time.sleep(secs)
        end_dump = self.d.dump()
        end_focus = SystemUi.get_current_focus()
        print end_focus

        seq_match = difflib.SequenceMatcher(None, pre_dump, end_dump)
        ratio = round(seq_match.ratio(), 2) * 100
        print "ratio:%s" % ratio

        if ratio == 100 and pre_focus == end_focus:
            assert False, "[FAILURE] Play video No any reply"
        if not secs:
            start_time = time.time()
            play_done = False
            while time.time() - start_time < timeout:
                time.sleep(10)
                if self._view.play.exists:
                    play_done = True
                    break
            assert play_done, "[FAILURE] Play video time out"

        errmsg = logcat.get_device_log(mark_time, filters='MediaPlayer:E *:S')
        assert not errmsg, "[FAILURE] Found Errors in Logcat during Play Video\n%s" % (
            errmsg)
Exemple #2
0
 def launch_app_am(self):
     """ Launch grafika-debug via adb am command
     """
     print "Launch grafika-debug by adb am"
     g_common_obj.launch_app_am(\
         grafika.pkg_name, grafika.activity_name)
     self.time_mark = logcat.get_device_time_mark()
     time.sleep(10)
     if self._device(text="Unable to generate content").exists:
         self._device(text="OK").click.wait()
Exemple #3
0
 def run_DisplayMetricsTest(self):
     time_mark = logcat.get_device_time_mark()
     cmd = "am instrument -e class %s -w %s"\
         % (self.DisplayMetricsTestDriver_test, self.DisplayMetricsTestDriver_runner)
     msg = g_common_obj.adb_cmd_capture_msg(repr(cmd))
     assert 'OK ' in msg,\
         "[FAILURE] Failed am instrument\n%s\n%s" % (cmd, msg)
     logs = logcat.get_device_log(time_mark, "*:D|grep API")
     assert len(logs) > 0,\
         "[FAILURE] Failed Catch logs"
     return logs
Exemple #4
0
    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(DisplayAllAppsOnHomeScreen, self).setUp()

        self.systemui = SystemUiExtendImpl()
        # self.meitu_impl = MeituPicEdit()
        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.press.menu()

        self.mark_time = logcat.get_device_time_mark()
    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(ImageProcessingCoreCPUTest, self).setUp()
        self.mark_time = logcat.get_device_time_mark()

        self.sys_setting = SystemSettingsImpl()
        self.systemui = SystemUiExtendImpl()
        self.imageprocessing = ImageProcessingImpl()

        self.imageprocessing.setup()

        self.systemui.unlock_screen()
        self.d.screen.on()
Exemple #6
0
 def _set_option(self, name, value):
     time_mark = logcat.get_device_time_mark()
     cmd = "service call hwc.info 3 s16 '%s' s16 '%s'" % (name, value)
     g_common_obj.adb_cmd_capture_msg(repr(cmd))
     e_msg = logcat.get_device_log(time_mark, 'Parcel:F hwc:W *:S')
     assert len(e_msg) == 0,\
         "[FAILURE] %s \n%s" % (cmd, e_msg)
     i_msg = logcat.get_device_log(time_mark, 'hwc:I *:S')
     catch_log = re.findall('.+Changed option %s.+' % (name), i_msg)
     print '-' * 60 + '\n'
     print catch_log
     print '-' * 60 + '\n'
     assert catch_log,\
         "[FAILURE] verify option failed"
Exemple #7
0
 def _run_test(self, activity='', count=1, step_time=60):
     for i in range(1, count + 1):
         print "[Debug] run_compressed_texture count:%s" % (i)
         mark_time = logcat.get_device_time_mark()
         self.launch_sub_activity(activity)
         #pid = self.get_pid()
         start_time = time.time()
         while time.time() - start_time <= step_time:
             time.sleep(1)
             _, current_activity = common.get_current_focus_window()
             assert current_activity == activity,\
                 "[FAILURE] unexpected activity %s" % (current_activity)
             self.device().click()
         g_common_obj.assert_exp_happens()
Exemple #8
0
    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(APIDemosGraphicsOpenGLESTest, self).setUp()

        self.systemui = SystemUiExtendImpl()
        self.apidemo = APIDemoImpl()

        self.apidemo.clean()
        self.apidemo.setup()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.press.menu()

        self.mark_time = logcat.get_device_time_mark()
Exemple #9
0
    def test_HDMI_Connect_Disconnect_20times(self):
        """
        test_HDMI_Connect_Disconnect_20times

        Steps:
        1. hdmi cable connected and disconnected check hdmi display and hdmi status
            Display is OK,no error and crash.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. hdmi cable connected and disconnected check hdmi display and hdmi status
                            Display is OK,no error and crash."""
        for count in range(1, 21):
            print "count %s" % count
            self.d.screen.on()
            mark_time = logcat.get_device_time_mark()
            self.display_cable_switch.switch_on()
            dut_log = logcat.get_device_log(mark_time)
            catch_log = re.findall(
                '.+WiredAccessoryManager.+device hdmi connected.+', dut_log)
            print '-' * 60 + '\n'
            print catch_log
            print '-' * 60 + '\n'
            assert catch_log,\
                "[FAILURE] Connect failed"

            mark_time = logcat.get_device_time_mark()
            self.display_cable_switch.switch_off()
            dut_log = logcat.get_device_log(mark_time)
            catch_log = re.findall(
                '.+WiredAccessoryManager.+device hdmi disconnected.+', dut_log)
            print '-' * 60 + '\n'
            print catch_log
            print '-' * 60 + '\n'
            assert catch_log,\
                "[FAILURE] Disconnect failed"
Exemple #10
0
 def setUp(self):
     print "[Setup]:%s" % self.__class__.__name__
     super(CardviewRecentsTest, self).setUp()
     self.actor_apps = self.test_conf.get('actor_apps')
     self.calendar_path = get_resource_from_atifactory(
         self.config_file, "apps", "calendar")
     self.clock_path = get_resource_from_atifactory(self.config_file,
                                                    "apps", "clock")
     pkgmgr.apk_install(self.calendar_path)
     pkgmgr.apk_install(self.clock_path)
     self.systemui = SystemUiExtendImpl()
     self.photos = get_photo_implement()
     self.photos.rm_delete_photos()
     self.systemui.unlock_screen()
     self.d.screen.on()
     self.d.press.menu()
     self.mark_time = logcat.get_device_time_mark()
    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(TouchScreenDuringDUTDimTest, self).setUp()
        self.mark_time = logcat.get_device_time_mark()

        self.sys_setting = SystemSettingsImpl()
        self.systemui = SystemUiExtendImpl()
        self.dumpsys = DumpSysImpl()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.sleep_time = 15

        self.org_screen_brightness =\
            self.sys_setting.get_system_setting('screen_brightness')
        self.org_screen_off_timeout = \
            self.sys_setting.get_system_setting('screen_off_timeout')
    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(WallpaperSetGIFImageTest, self).setUp()

        self.photos = PhotosExtendImpl()
        self.camera = CameraExtendImpl()
        self.systemui = SystemUiExtendImpl()
        self.photosImpl = get_photo_implement()
        self.qrcodeImpl = QRcode()
        self.wallpaper = WallpaperImpl()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.press.menu()

        self.photos.clean()
        self.camera.clean()
        self.photosImpl.rm_delete_photos()
        self.photosImpl.refresh_sdcard()
        self.wallpaper.reset_wallpaper()

        self.qrcode = "GIFPICTURE"
        config = TestConfig()
        cfg_file = 'tests.tablet.artifactory.conf'
        cfg_arti = config.read(cfg_file, 'artifactory')
        config_handle = ConfigHandle()
        cfg_arti["location"] = config_handle.read_configuration(
            'artifactory', 'location', '/etc/oat/', 'sys.conf')

        cfg = config.read(cfg_file, 'qrcode_marked_image')
        arti = Artifactory(cfg_arti.get('location'))
        self.qrcode = cfg.get("imageviewing_qrcode")
        print "[Debug] qrcode:%s" % (self.qrcode)
        pic_name = cfg.get("imageviewing_image")
        file_path = arti.get(pic_name)
        g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures')
        ImageDetails.set_workaround()

        self.photos.setup()

        self.mark_time = logcat.get_device_time_mark()
    def test_ImageProcessing_CoreCPU(self):
        """
        test_ImageProcessing_CoreCPU

        Steps:
        1. Launch ImageProcessing.
            The application starts and run without issues. Check message like “Computer Device: CPU” in logcat
        2. change some settings.
            Applying settings to the image successfully
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch ImageProcessing.
            The application starts and run without issues. Check message like “Computer Device: CPU” in logcat"""
        time_mark = logcat.get_device_time_mark()
        self.imageprocessing.launch()
        self.imageprocessing.verify_log_core_cpu(time_mark)

        print """[Step] 2. change some settings.
            Applying settings to the image successfully
            """
        self.imageprocessing.change_levels_vec4_relaxed_settings()
        self.imageprocessing.change_levels_vec3_relaxed_settings()
    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(ImageViewingSuspendResumeByCommandTest, self).setUp()
        self.photos = PhotosExtendImpl()
        #         self.camera = CameraExtendImpl()
        self.systemui = SystemUiExtendImpl()
        self.photosImpl = get_photo_implement()
        self.qrcodeImpl = QRcode()
        self.device = g_common_obj.get_device()
        self.systemui.unlock_screen()
        self.device.screen.on()
        #         self.device.press.menu()
        self.photosImpl.rm_delete_photos()
        self.photosImpl.refresh_sdcard()
        self.photos.clean()
        #         self.camera.clean()

        self.qrcode = "QRCODE_TEST_STRING"
        config = TestConfig()
        cfg_file = 'tests.tablet.artifactory.conf'
        cfg_arti = config.read(cfg_file, 'artifactory')
        config_handle = ConfigHandle()
        cfg_arti["location"] = config_handle.read_configuration(
            'artifactory', 'location', '/etc/oat/', 'sys.conf')

        cfg = config.read(cfg_file, 'content_picture')
        self.qrcode = cfg.get("imageviewing_qrcode")
        print "[Debug] qrcode:%s" % (self.qrcode)
        arti = Artifactory(cfg_arti.get('location'))
        pic_name = cfg.get("qr_image")
        file_path = arti.get(pic_name)
        g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures')
        self.photosImpl.refresh_sdcard()
        special_actions.setup()
        self.photosImpl.launch_photos_am()
        self.mark_time = logcat.get_device_time_mark()
Exemple #15
0
 def run_skia_bench(self):
     time_mark = logcat.get_device_time_mark()
     cmd = "%s" % (self.dut_skia_bench)
     g_common_obj.adb_cmd_capture_msg(repr(cmd), time_out=60 * 60)
     self.parse_skia_bench_log(time_mark)
Exemple #16
0
 def run_skia_test(self):
     time_mark = logcat.get_device_time_mark()
     cmd = "%s -v" % (self.dut_skia_test)
     g_common_obj.adb_cmd_capture_msg(repr(cmd), time_out=60 * 5)
     self.parse_skia_test_log(time_mark)