def setUp(self):
        super(ComposeUI, self).setUp()
        self._test_name = __name__
        self.device = g_common_obj.get_device()
        print "[Setup]: %s" % self._test_name
        self._composeui = ComposeUiImpl()
        self._imageviewer = ImageDetails()
        self.photos = PhotosExtendImpl()
        self.photosImpl = get_photo_implement()
        self.qrcodeImpl = QRcode()
        g_common_obj.root_on_device()
        g_common_obj.remount_device()
        self.photosImpl.rm_delete_photos()
        self.photosImpl.refresh_sdcard()
        self.photos.clean()

        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')
        self.qrcode = cfg.get("screenshot_edit_qrcode")
        print "[Debug] qrcode:%s" % (self.qrcode)
        arti = Artifactory(cfg_arti.get('location'))
        pic_name = cfg.get("screenshot_edit_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.photos.setup()
 def setUp(self):
     print "[Setup]:%s" % self.__class__.__name__
     super(VideoPlayback, self).setUp()
     self.photos = get_photo_implement()
     self.bench = Gfxbench()
     self._qr = QRcode()
     self.extend_photos = PhotosExtendImpl()
     self.remote_path = self.extend_photos.push_videos(count=1,
                                                       like='test_video_qr',
                                                       exts='.mp4')[0]
class ComposeUI(UIATestBase):

    def setUp(self):
        super(ComposeUI, self).setUp()
        self._test_name = __name__
        self.device = g_common_obj.get_device()
        print "[Setup]: %s" % self._test_name
        self._composeui = ComposeUiImpl()
        self._imageviewer = ImageDetails()
        self.photos = PhotosExtendImpl()
        self.photosImpl = get_photo_implement()
        self.qrcodeImpl = QRcode()
        g_common_obj.root_on_device()
        g_common_obj.remount_device()
        self.photosImpl.rm_delete_photos()
        self.photosImpl.refresh_sdcard()
        self.photos.clean()

        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')
        self.qrcode = cfg.get("screenshot_edit_qrcode")
        print "[Debug] qrcode:%s" % (self.qrcode)
        arti = Artifactory(cfg_arti.get('location'))
        pic_name = cfg.get("screenshot_edit_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.photos.setup()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(ComposeUI, self).tearDown()
        self.photosImpl.rm_delete_photos()
        self.photosImpl.refresh_sdcard()
        clearTmpDir()

    def test_screenshot_imageedit(self):
        ''' refer TC test_screenshot_imageedit
        '''
        print "[RunTest]: %s" % self.__str__()
        self.photosImpl.launch_photos_am()
        self._composeui.addeffects_check_screenshot()
        self.device.press.back()
        time.sleep(2)
        self.photosImpl.open_a_picture()
        self.qrcodeImpl.verify_qrcode_marked_image(self.qrcode, set_wallpaper=False)
        self.photosImpl.stop_photos_am()
 def setUp(self):
     super(Fit, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self.photos = get_photo_implement()
     self.d = g_common_obj.get_device()
     self.d.screen.on()
     self._qr = QRcode()
     self.extend_photos = PhotosExtendImpl()
     self.remote_path = self.extend_photos.push_videos(count=1, like='test_video_qr', exts='.mp4')[0]
     adb32.screen_rotation(0)
 def setUp(self):
     print "[Setup]:%s" % self.__class__.__name__
     super(DPSTFunctionalityTest, self).setUp()
     self.photos = get_photo_implement()
     self.chrome = ChromeExtendImpl()
     self.extend_photos = PhotosExtendImpl()
     self.remote_path = self.extend_photos.push_videos(count=1,
                                                       like='dark',
                                                       exts='.mp4')[0]
     self.chrome.launch()
     self.chrome.chrome_setup()
 def setUp(self):
     super(ComposeUI, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self._composeui = ComposeUiImpl()
     self.photos = get_photo_implement()
     self.photos.rm_delete_photos()
     self.photos.refresh_sdcard()
     self._composeui.init_local_video()
     self.extend_photos = PhotosExtendImpl()
     self.remote_path = self.extend_photos.push_videos(like='test_video_qr',
                                                       exts='.mp4')[0]
 def setUp(self):
     print "[Setup]:%s" % self.__class__.__name__
     super(RefreshRate, self).setUp()
     self.displaymetrics = DisplayMetricsReportImpl()
     self.photosImpl = PhotosExtendImpl()
     self.photos = get_photo_implement()
     self.photos.rm_delete_photos()
     self.photos.refresh_sdcard()
     self.remote_path = self.photosImpl.push_videos(
         count=1,
         like='H264_L3.2_HP_720p_60fps_AAC_192kb_44KHz',
         exts='.mp4')[0]
 def setUp(self):
     super(VideoPlayback, self).setUp()
     self._test_name = __name__
     self.device = g_common_obj.get_device()
     print "[Setup]: %s" % self._test_name
     #         g_common_obj.root_on_device()
     #         g_common_obj.remount_device()
     self.photos = get_photo_implement()
     self.photosImpl = PhotosExtendImpl()
     self._qr = QRcode()
     self.photos.rm_delete_photos()
     self.photos.refresh_sdcard()
     self.remote_path = self.photosImpl.push_videos(
         count=1, like='test_video_qr_bottom', exts='.mp4')[0]
     special_actions.setup()
class ComposeUI(UIATestBase):
    def setUp(self):
        super(ComposeUI, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self._composeui = ComposeUiImpl()
        self.photos = get_photo_implement()
        self.photos.rm_delete_photos()
        self.photos.refresh_sdcard()
        self._composeui.init_local_video()
        self.extend_photos = PhotosExtendImpl()
        self.remote_path = self.extend_photos.push_videos(like='test_video_qr',
                                                          exts='.mp4')[0]

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(ComposeUI, self).tearDown()
        self._composeui.delete_local_video()
        self.photos.rm_delete_photos()
        self.photos.refresh_sdcard()
        ImageDetails.delete_picture()
        ImageDetails.set_workaround()

    def test_screenshot_videoplayback(self):
        ''' refer TC test_Screenshot_VideoPlayback
        '''
        print "[RunTest]: %s" % self.__str__()
        #         self.photos.launch_photos_am()
        self.photos.play_video_command(self.remote_path)
        time.sleep(5)
        self._composeui.capture_screen_shot_during_video_playback()
        self.photos.stop_photos_am()
Esempio n. 10
0
 def setUp(self):
     super(ComposeUI, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self.d = g_common_obj.get_device()
     #         self.photos = get_photo_implement()
     self._composeui = ComposeUiImpl()
     config_handle = ConfigHandle()
     result = config_handle.check_apps("com.mxtech.videoplayer.ad")
     if result == 0:
         self._composeui.install_apk('Mxplayer')
     self.d.screen.on()
     self._qr = QRcode()
     self.extend_photos = PhotosExtendImpl()
     self.remote_path = self.extend_photos.push_videos(
         count=1, like='test_video_qr_middle', exts='.mp4')[0]
     adb32.screen_rotation(0)
    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()
Esempio n. 12
0
    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(Camera720pHDVideoRecordingTest, self).setUp()

        cmd = 'date +"%m-%d %H:%M:%S"'
        self.test_time_mark = g_common_obj.adb_cmd_capture_msg(repr(cmd))

        self.chrome_cast = self.IChromeCastImpl(self.cast_model)
        self.camera = CameraExtendImpl()
        self.photos = PhotosExtendImpl()
        self.systemui = SystemUiExtendImpl()

        self.camera.clean()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.orientation = 'natural'

        self.chrome_cast.setup()
        self.photos.setup()
        self.camera.startApp()
    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(ScreenCastingImagesSlideshowTest, self).setUp()

        cmd = 'date +"%m-%d %H:%M:%S"'
        self.test_time_mark = g_common_obj.adb_cmd_capture_msg(repr(cmd))

        self.chrome_cast = self.IChromeCastImpl(self.cast_model)
        self.camera = CameraExtendImpl()
        self.photos = PhotosExtendImpl()
        self.systemui = SystemUiExtendImpl()

        self.camera.clean()
        self.photos.clean()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.orientation = 'natural'

        self.chrome_cast.setup()
        self.photos.setup()
        self.photos.push_pictures(count=5)
Esempio n. 14
0
class ComposeUI(UIATestBase):
    def setUp(self):
        super(ComposeUI, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.d = g_common_obj.get_device()
        #         self.photos = get_photo_implement()
        self._composeui = ComposeUiImpl()
        config_handle = ConfigHandle()
        result = config_handle.check_apps("com.mxtech.videoplayer.ad")
        if result == 0:
            self._composeui.install_apk('Mxplayer')
        self.d.screen.on()
        self._qr = QRcode()
        self.extend_photos = PhotosExtendImpl()
        self.remote_path = self.extend_photos.push_videos(
            count=1, like='test_video_qr_middle', exts='.mp4')[0]
        adb32.screen_rotation(0)

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(ComposeUI, self).tearDown()
        os.remove("tmp.png")
        adb32.screen_rotation(0)

    def test_scaling_rotation_Video(self):
        ''' refer TC test_Scaling_Rotation_Video
        '''
        print "[RunTest]: %s" % self.__str__()
        self._composeui.play_video_command_mx(self.remote_path)
        time.sleep(2)
        if self.d(textContains="START OVER").exists:
            self.d(textContains="START OVER").click.wait()
        for i in [2, 1, 3, 0]:
            adb32.screen_rotation(i)
            time.sleep(1)
            if self.d(resourceId="com.mxtech.videoplayer.ad:id/ui_layout"
                      ).exists:
                self.d(resourceId="com.mxtech.videoplayer.ad:id/ui_layout"
                       ).pinch.Out(percent=120)
                time.sleep(2)
                assert self._qr.decode_image_qrcode(
                    self.d.screenshot("tmp.png")
                )[1] == "QRCODE_TEST_STRING", "The scaling of video playback failed!"
                self.d(resourceId="com.mxtech.videoplayer.ad:id/ui_layout"
                       ).pinch.In(percent=70, steps=5)
                time.sleep(2)
                assert self._qr.decode_image_qrcode(
                    self.d.screenshot("tmp.png")
                )[1] == "QRCODE_TEST_STRING", "The scaling of video playback failed!"
    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()
Esempio n. 16
0
class ComposeUI(UIATestBase):
    def setUp(self):
        super(ComposeUI, self).setUp()
        self._test_name = __name__
        self.d = g_common_obj.get_device()
        print "[Setup]: %s" % self._test_name
        self.photos = get_photo_implement()
        self._qr = QRcode()
        #         self.photos.rm_delete_photos()
        #         self.photos.refresh_sdcard()
        #         self._composeui = ComposeUiImpl()
        #         self._composeui.init_local_video()
        self.extend_photos = PhotosExtendImpl()
        self.remote_path = self.extend_photos.push_videos(like='test_video_qr',
                                                          exts='.mp4')[0]

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        #         super(ComposeUI, self).tearDown()
        #         self._composeui.delete_local_video()
        self.photos.rm_delete_photos()
        self.photos.refresh_sdcard()
        g_common_obj.stop_app_am("com.google.android.apps.photos")
        try:
            os.remove(".tmp.png")
        except OSError:
            pass

    def test_videoplayback_forwardrewind(self):
        ''' refer TC test_VideoPlayback_ForwardRewind
        '''
        print "[RunTest]: %s" % self.__str__()
        #         self.photos.launch_photos_am()
        print "---------------GFX_forwardrewind--------------"
        #         from testlib.graphics.screenshot_for_liverpt import take_screenshot_for_liverpt
        #         take_screenshot_for_liverpt()
        self.photos.play_video_command(self.remote_path)
        #         take_screenshot_for_liverpt()
        self.photos.slide_video_processbar_forward()
        #         take_screenshot_for_liverpt()
        assert self._qr.decode_image_qrcode(self.d.screenshot(
            ".tmp.png"))[1] == "QRCODE_TEST_STRING", "Video playback failed!"
        self.photos.slide_video_processbar_backward()
        assert self._qr.decode_image_qrcode(self.d.screenshot(
            ".tmp.png"))[1] == "QRCODE_TEST_STRING", "Video playback failed!"
class VideoPlayback(UIATestBase):
    def setUp(self):
        super(VideoPlayback, self).setUp()
        self._test_name = __name__
        self.device = g_common_obj.get_device()
        print "[Setup]: %s" % self._test_name
        #         g_common_obj.root_on_device()
        #         g_common_obj.remount_device()
        self.photos = get_photo_implement()
        self.photosImpl = PhotosExtendImpl()
        self._qr = QRcode()
        self.photos.rm_delete_photos()
        self.photos.refresh_sdcard()
        self.remote_path = self.photosImpl.push_videos(
            count=1, like='test_video_qr_bottom', exts='.mp4')[0]
        special_actions.setup()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(VideoPlayback, self).tearDown()
        self.photos.rm_delete_photos()
        self.photos.refresh_sdcard()
        try:
            os.remove(".tmp.png")
        except OSError:
            pass

    def test_AppTransparency_VideoPlayback(self):
        ''' refer TC test_AppTransparency_VideoPlayback
        '''
        print "[RunTest]: %s" % self.__str__()
        x, y = 0, self.device.info[
            'displayHeight'] / 2  # touch point for full screen playback.
        self.photos.play_video_command(self.remote_path)
        #         self.photos.launch_photos_am()
        #         self.photos.play_video()
        time.sleep(5)
        self.photos.pause_play_video()
        g_common_obj.adb_cmd_capture_msg("input touchscreen tap %s %s" %
                                         (x, y))
        time.sleep(5)
        assert self._qr.decode_image_qrcode(self.device.screenshot(".tmp.png"))[1] == "QRCODE_TEST_STRING",\
            "Video playback transparency test failed!"
class VideoPlayback(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(VideoPlayback, cls).setUpClass()
        cls.d = g_common_obj.get_device()
        g_common_obj.root_on_device()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(VideoPlayback, self).setUp()
        self.photos = get_photo_implement()
        self.bench = Gfxbench()
        self._qr = QRcode()
        self.extend_photos = PhotosExtendImpl()
        self.remote_path = self.extend_photos.push_videos(count=1,
                                                          like='test_video_qr',
                                                          exts='.mp4')[0]

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        self.photos.rm_delete_photos()
        self.photos.refresh_sdcard()
        self.photos.stop_photos_am()
        try:
            os.remove(".tmp.png")
        except OSError:
            pass

    def test_AppSwitching(self):
        print "[RunTest]: %s" % self.__str__()
        self.photos.play_video_command(self.remote_path, 5)
        self.bench.setup()
        self.bench.run_test("ALU 2", 50000)
        time.sleep(10)
        self.photos.play_video_command(self.remote_path, 5)
        screen_temp = tempfile.mktemp(suffix='.png',
                                      prefix='screenshot_',
                                      dir='/tmp')
        g_common_obj.take_screenshot(screen_temp)
        ret, qrcode = self._qr.decode_image_qrcode(screen_temp)
        assert ret and qrcode == "QRCODE_TEST_STRING", "Video playback failed!"
class RefreshRate(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(RefreshRate, cls).setUpClass()
        cls.d = g_common_obj.get_device()
        g_common_obj.root_on_device()
        g_common_obj.remount_device()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(RefreshRate, self).setUp()
        self.displaymetrics = DisplayMetricsReportImpl()
        self.photosImpl = PhotosExtendImpl()
        self.photos = get_photo_implement()
        self.photos.rm_delete_photos()
        self.photos.refresh_sdcard()
        self.remote_path = self.photosImpl.push_videos(
            count=1,
            like='H264_L3.2_HP_720p_60fps_AAC_192kb_44KHz',
            exts='.mp4')[0]

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        self.photos.rm_delete_photos()
        self.photos.refresh_sdcard()
        super(RefreshRate, self).tearDown()

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(RefreshRate, cls).tearDownClass()

    def test_Display_RefreshRate(self):
        print "[RunTest]: %s" % self.__str__()
        self.displaymetrics.compare_refresh_rate()
        self.photos.play_video_command(self.remote_path)
        #         self.photos.launch_photos_am()
        #         self.photos.play_video()
        time.sleep(10)
        self.photos.stop_photos_am()
        g_common_obj.assert_exp_happens()
    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(DisplayDynamicRefreshRate, self).setUp()
        self.d = g_common_obj.get_device()
        self.videoImpl = VideoExtendImpl()
        self.photosImpl = PhotosExtendImpl()
        self.photos = get_photo_implement()
        self.photos.rm_delete_photos()
        self.photos.refresh_sdcard()

        test_config = TestConfig()
        conf_file = 'tests.tablet.artifactory.conf'
        self.config = test_config.read(conf_file, "content_video_apk")

        video_path = self.config.get('video_path1')
        push_file_path = artifactory.get(video_path)
        g_common_obj.adb_cmd_common('push ' + push_file_path +
                                    ' /sdcard/Movies')
        self.push_path = '/sdcard/Movies/' + self.config.get("video_file1")

        self.videoImpl.appPrepare()
class Fit(RenderAppTestBase):

    def setUp(self):
        super(Fit, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.photos = get_photo_implement()
        self.d = g_common_obj.get_device()
        self.d.screen.on()
        self._qr = QRcode()
        self.extend_photos = PhotosExtendImpl()
        self.remote_path = self.extend_photos.push_videos(count=1, like='test_video_qr', exts='.mp4')[0]
        adb32.screen_rotation(0)

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Fit, self).tearDown()
        self.photos.rm_delete_photos()
        self.photos.refresh_sdcard()
        g_common_obj.stop_app_am("com.google.android.apps.photos")
        try:
            os.remove(".tmp.png")
        except OSError:
            pass
        adb32.screen_rotation(0)

    def test_switch_portrait_landscape_apps_serval_times(self):
        ''' refer TC test_switch_portrait_landscape_apps_serval_times
        '''
        print "[RunTest]: %s" % self.__str__()
        n = 5
        self.photos.play_video_command(self.remote_path)
        while n > 0:
            for i in [2, 1, 3, 0]:
                adb32.screen_rotation(i)
                time.sleep(10)
                assert self._qr.decode_image_qrcode(self.d.screenshot(".tmp.png"))[1] == "QRCODE_TEST_STRING", "Video playback failed!"
            n = n - 1
class WallpaperSetBMPImageTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(WallpaperSetBMPImageTest, cls).setUpClass()
        cls.d = g_common_obj.get_device()
        g_common_obj.root_on_device()
#         g_common_obj.remount_device()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(WallpaperSetBMPImageTest, 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')
        self.qrcode = cfg.get("wallpaperset_bmp_qrcode")
        print "[Debug] qrcode:%s" % (self.qrcode)
        arti = Artifactory(cfg_arti.get('location'))
        pic_name = cfg.get("wallpaperset_bmp_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.mark_time = logcat.get_device_time_mark()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        self.photosImpl.rm_delete_photos()
        self.photosImpl.refresh_sdcard()
        #         fatal_msg = logcat.get_device_log(self.mark_time, filters='*:F')
        #         assert len(fatal_msg) == 0,\
        #             "occurred Fatal error during testing:\n%s" % (fatal_msg)
        super(WallpaperSetBMPImageTest, self).tearDown()

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(WallpaperSetBMPImageTest, cls).tearDownClass()

    def test_WallpaperSet_BMPImage(self):
        """
        test_WallpaperSet_BMPImage

        Steps:
        1. Open a BMP picture by Gallery app
        BMP image display is OK.
        2. Select "Set as..." Wallpaper option and crop the picture
        Select wallpaper option and crop the picture are OK.
        3. Back the home UI to check the wallpaer after setting
        The BMP picture can set as wallpaper successfully. DUT has no crash or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Open a BMP picture by Gallery app
            BMP image display is OK."""
        self.photosImpl.launch_photos_am()
        self.photosImpl.open_a_picture()
        print """[Step] 2. Select "Set as..." Wallpaper option and crop the picture
            Select wallpaper option and crop the picture are OK."""
        self.photosImpl.set_picture_as_wallpaper()
        print """[Step] 3. Back the home UI to check the wallpaer after setting
            The BMP picture can set as wallpaper successfully. DUT has no crash or freeze."""
        self.qrcodeImpl.verify_qrcode_marked_image(self.qrcode)
Esempio n. 23
0
class ScreenCastingOpenTakenPictureTest(ChromeCastTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(ScreenCastingOpenTakenPictureTest, cls).setUpClass()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(ScreenCastingOpenTakenPictureTest, self).setUp()

        cmd = 'date +"%m-%d %H:%M:%S"'
        self.test_time_mark = g_common_obj.adb_cmd_capture_msg(repr(cmd))

        self.chrome_cast = self.IChromeCastImpl(self.cast_model)
        self.camera = CameraExtendImpl()
        self.photos = PhotosExtendImpl()
        self.systemui = SystemUiExtendImpl()

        self.camera.clean()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.orientation = 'natural'

        self.chrome_cast.setup()
        self.photos.setup()
        self.camera.startApp()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        cmd = 'logcat -d -v time -t "%s.000" *:F|grep -i Fatal' % (
            self.test_time_mark)
        fatal_msg = g_common_obj.adb_cmd_common(cmd)
        assert not fatal_msg,\
                "occurred Fatal error during testing:%s" % (fatal_msg)
        self.camera.clean()
        super(ScreenCastingOpenTakenPictureTest, self).tearDown()

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(ScreenCastingOpenTakenPictureTest, cls).tearDownClass()

    def test_ScreenCasting_OpenTakenPicture(self):
        """
        test_ScreenCasting_OpenTakenPicture

        Steps:
        1. Turn on Wireless Display on DUT.
            The Chromecast adapter is shown on the scan list.
        2. Connect to the Chromecast adapter
            The DUT is connected to the Chromecast adapter.
        3. Take a picture using the Camera application
            The picture is taken
        4. Open the Photos application and view the picture
            The picture is opened with Gallery app and screencasting is successful.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Turn on Wireless Display on DUT.
                    The Chromecast adapter is shown on the scan list."""
        self.turn_on_wireless()

        self.chrome_cast.launch()
        cast_real_name = self.chrome_cast.choose_castscreen(self.cast_model)

        print """[Step] 2. Connect to the Chromecast adapter
                    The DUT is connected to the Chromecast adapter."""
        self.chrome_cast.connect_cast_screen(cast_real_name)

        print """[Step] 3. Take a picture using the Camera application
                    The picture is taken"""
        self.d.press.home()
        self.camera.launchCamera()
        self.camera.picTake()

        print """[Step] 4. Open the Photos application and view the picture
                    The picture is opened with Gallery app and screencasting is successful."""
        self.photos.launch()
        index = self.photos.find_photo()
        self.photos.click_list_item(index)
        time.sleep(5)

        print """[Step] 5. Verify connection.
                    The connection is not lost."""
        self.chrome_cast.watch_connection_status(count=1, step=1)
        self.chrome_cast.verify_connection_from_quick_settings(self.cast_model)

        self.chrome_cast.resume()
        self.chrome_cast.disconnect_cast_screen()
class ScreenCastingImagesSlideshowTest(ChromeCastTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(ScreenCastingImagesSlideshowTest, cls).setUpClass()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(ScreenCastingImagesSlideshowTest, self).setUp()

        cmd = 'date +"%m-%d %H:%M:%S"'
        self.test_time_mark = g_common_obj.adb_cmd_capture_msg(repr(cmd))

        self.chrome_cast = self.IChromeCastImpl(self.cast_model)
        self.camera = CameraExtendImpl()
        self.photos = PhotosExtendImpl()
        self.systemui = SystemUiExtendImpl()

        self.camera.clean()
        self.photos.clean()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.orientation = 'natural'

        self.chrome_cast.setup()
        self.photos.setup()
        self.photos.push_pictures(count=5)

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        cmd = 'logcat -d -v time -t "%s.000" *:F|grep -i Fatal' % (
            self.test_time_mark)
        fatal_msg = g_common_obj.adb_cmd_common(cmd)
        assert not fatal_msg,\
            "occurred Fatal error during testing:%s" % (fatal_msg)
        self.camera.clean()
        self.photos.clean()
        super(ScreenCastingImagesSlideshowTest, self).tearDown()

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(ScreenCastingImagesSlideshowTest, cls).tearDownClass()

    def test_ScreenCasting_ImagesSlideshow(self):
        """
        test_ScreenCasting_ImagesSlideshow

        Steps:
        1. Turn on Wireless Display on DUT.
            The Chromecast is shown on the scan list.
        2. Connect to the Chromecast.
            The DUT is connected to the Chromecast.
        3. Open the Photos appliaction.
            The Gallery application is opened.
        4. Use Photos application slideshow for 5 minutes to view some pictures.
            The pictures are shown and screencasting has no degradation.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Turn on Wireless Display on DUT.
                    The Chromecast is shown on the scan list."""
        self.turn_on_wireless()

        self.chrome_cast.launch()
        cast_real_name = self.chrome_cast.choose_castscreen(self.cast_model)

        print """[Step] 2. Connect to the Chromecast.
                    The DUT is connected to the Chromecast."""
        self.chrome_cast.connect_cast_screen(cast_real_name)

        print """[Step] 3. Open the Photos appliaction.
                    The Gallery application is opened."""
        self.photos.launch()

        print """[Step] 4. Use Photos application slideshow for 5 minutes to view some pictures.
                    The pictures are shown and screencasting has no degradation."""
        self.photos.slideshow(5 * 60)

        print """[Step] 5. Verify connection.
                    The connection is not lost."""
        self.chrome_cast.watch_connection_status(count=1, step=1)
        self.chrome_cast.verify_connection_from_quick_settings(cast_real_name)

        self.chrome_cast.resume()
        self.chrome_cast.disconnect_cast_screen()
class DPSTFunctionalityTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(DPSTFunctionalityTest, cls).setUpClass()
        cls.d = g_common_obj.get_device()
        g_common_obj.root_on_device()
        g_common_obj.remount_device()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(DPSTFunctionalityTest, self).setUp()
        self.photos = get_photo_implement()
        self.chrome = ChromeExtendImpl()
        self.extend_photos = PhotosExtendImpl()
        self.remote_path = self.extend_photos.push_videos(count=1,
                                                          like='dark',
                                                          exts='.mp4')[0]
        self.chrome.launch()
        self.chrome.chrome_setup()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        super(DPSTFunctionalityTest, self).tearDown()
        self.photos.rm_delete_photos()

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(DPSTFunctionalityTest, cls).tearDownClass()

    def test_DPST_Functionality(self):
        """
        test_DPST_Functionality

        Steps:
        1. Connect DUT to linux host, execute commands: 
        adb root
        adb shell cat /sys/kernel/debug/dri/0/i915_dpst_status
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. adb shell cat /sys/kernel/debug/dri/0/i915_dpst_status.
            return backlight adjustment value."""
        flag = "backlight adjustment:"
        cmd = 'cat /sys/kernel/debug/dri/0/i915_dpst_status'
        msg = g_common_obj.adb_cmd_capture_msg(repr(cmd))
        info = msg.split('\n')
        for line in info:
            if not line.find(flag) == -1:
                print line
                light1 = re.sub(r'\D', "", line)

        print """[Step] 2. Launch Chrome and play the video.
            Video played successfully. No artifacts or flickers."""
        self.chrome.launch()
        time.sleep(3)
        self.chrome.open_website('file://%s' % (self.remote_path))
        self.chrome.play_video(secs=5)

        print """[Step] 3. adb shell cat /sys/kernel/debug/dri/0/i915_dpst_status.
            return backlight adjustment value and check it less."""
        msg = g_common_obj.adb_cmd_capture_msg(repr(cmd))
        info = msg.split('\n')
        for line in info:
            if not line.find(flag) == -1:
                print line
                light2 = re.sub(r'\D', "", line)
        assert light2 < light1, \
            "[FAILURE] The backlight adjustment did not less than before after play vedio.now is from %s to %s\n" % (light1, light2)
Esempio n. 26
0
class Camera720pHDVideoRecordingTest(ChromeCastTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(Camera720pHDVideoRecordingTest, cls).setUpClass()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(Camera720pHDVideoRecordingTest, self).setUp()

        cmd = 'date +"%m-%d %H:%M:%S"'
        self.test_time_mark = g_common_obj.adb_cmd_capture_msg(repr(cmd))

        self.chrome_cast = self.IChromeCastImpl(self.cast_model)
        self.camera = CameraExtendImpl()
        self.photos = PhotosExtendImpl()
        self.systemui = SystemUiExtendImpl()

        self.camera.clean()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.orientation = 'natural'

        self.chrome_cast.setup()
        self.photos.setup()
        self.camera.startApp()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        cmd = 'logcat -d -v time -t "%s.000" *:F|grep -i Fatal' % (
            self.test_time_mark)
        fatal_msg = g_common_obj.adb_cmd_common(cmd)
        assert not fatal_msg,\
            "occurred Fatal error during testing:%s" % (fatal_msg)
        self.camera.clean()
        super(Camera720pHDVideoRecordingTest, self).tearDown()

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(Camera720pHDVideoRecordingTest, cls).tearDownClass()

    def test_Camera_720pHDVideoRecording(self):
        """
        test_Camera_720pHDVideoRecording

        Steps:
        1. Turn on Wireless Display on DUT.
            The Chromecast is shown on the scan list.
        2. Connect to the Chromecast
            The DUT is connected to the Chromecast .
        3. Start the Camera application.
            The Camera application is opened.
        4. Take some HD 720p video files using Camera app.
            The HD 720p video files are taken and screencasting has no degradation.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Turn on Wireless Display on DUT.
            The Chromecast is shown on the scan list."""
        self.turn_on_wireless()

        self.chrome_cast.launch()
        cast_real_name = self.chrome_cast.choose_castscreen(self.cast_model)

        print """[Step] 2. Connect to the Chromecast
            The DUT is connected to the Chromecast."""
        self.chrome_cast.connect_cast_screen(cast_real_name)

        print """[Step] 3. Start the Camera application.
            The Camera application is opened."""
        self.d.press.home()
        self.camera.launchCamera()

        print """[Step] 4. Take some HD 720p video files using Camera app.
            The HD 720p video files are taken and screencasting has no degradation."""
        self.camera.setVideoTo720p()
        self.camera.videoRecord()

        print """[Step] 5. Verify connection.
                    The connection is not lost."""
        self.chrome_cast.watch_connection_status(count=1, step=1)
        self.chrome_cast.verify_connection_from_quick_settings(cast_real_name)

        self.chrome_cast.resume()
        self.chrome_cast.disconnect_cast_screen()
class ImageViewingSuspendResumeByCommandTest(PhotoTestBase):
    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()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        self.photosImpl.rm_delete_photos()
        self.photosImpl.refresh_sdcard()
        #         fatal_msg = logcat.get_device_log(self.mark_time, filters='*:F')
        #         assert len(fatal_msg) == 0,\
        #             "occurred Fatal error during testing:\n%s" % (fatal_msg)
        super(ImageViewingSuspendResumeByCommandTest, self).tearDown()
        try:
            os.remove(".tmp.png")
        except OSError:
            pass

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(ImageViewingSuspendResumeByCommandTest, cls).tearDownClass()

    def test_ImageViewing_SuspendResumeByCommand_20times(self):
        """
        test_ImageViewing_SuspendResumeByCommand_20times

        Steps:
        1. Launch Photos app to view an image.
        Image viewed in Photos app.
        2. Launch a terminal/CMD and input command "adb shell input keyevent KEYCODE_POWER" to suspend/resume the devices for 20 times.
        No error & hung up & panic occur.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch Photos app to view an image.
        Image viewed in Photos app."""
        self.photosImpl.launch_photos_am()
        self.photosImpl.open_a_picture()
        #         self.qrcodeImpl.verify_qrcode_marked_image(self.qrcode,set_wallpaper=False)
        print """[Step] 2. Launch a terminal/CMD and input command "adb shell input keyevent KEYCODE_POWER" to suspend/resume the devices for 20 times.
        No error & hung up & panic occur."""
        #         cmd_power = "input keyevent KEYCODE_POWER"
        #         cmd_menu = "input keyevent KEYCODE_MENU"
        for i in range(1, 21):
            print "[Debug] %s times" % (i)
            #             g_common_obj.adb_cmd(cmd_power)
            #             time.sleep(1)
            #             assert not is_device_screen_on(), "[FAILURE] Failed suspend device"
            self.device.wakeup()
            time.sleep(3)
            #             g_common_obj.adb_cmd(cmd_power)
            #             g_common_obj.adb_cmd(cmd_menu)
            #             time.sleep(1)
            #             assert is_device_screen_on(), "[FAILURE] Failed resume device"
            #             self.qrcodeImpl.verify_qrcode_marked_image(self.qrcode,set_wallpaper=False)
            assert self.qrcodeImpl.decode_image_qrcode(self.device.screenshot(".tmp.png"))[1] == "QRCODE_TEST_STRING",\
                "Imageviewing failed after resuming DUT in test cycle %s" % (i)
            time.sleep(1)
            self.device.sleep()
            time.sleep(3)