class VideoModeViewFinder(UIATestBase):
    def setUp(self):
        super(VideoModeViewFinder, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.device = g_common_obj.get_device()
        self._extendcamera = CameraExtendImpl()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        self._extendcamera.cameraSwitchTo("Camera")
        self._extendcamera.cameraSwitchBackFront("back")
        self._extendcamera.stop_camera_am()
        super(VideoModeViewFinder, self).tearDown()

    def test_viewfinderdisplays_videomode_primarycamera(self):
        '''
        Run test with uiautomator instead of GITS.
        '''
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.launch_camera_am()
        self._extendcamera.cameraSwitchTo("Video")
        time.sleep(3)
        assert not self.device(
            text="Camera error").exists, "Camera popups 'Camera error'"
        g_common_obj.assert_exp_happens()
class CameraViewFinder(UIATestBase):
    def setUp(self):
        super(CameraViewFinder, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.device = g_common_obj.get_device()
        self._extendcamera = CameraExtendImpl()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(CameraViewFinder, self).tearDown()

    def test_Viewfinder_SecondaryCamera(self):
        ''' refer TC test_AppTransparency_Clock
        '''
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.launch_camera_am()
        self._extendcamera.cameraSwitchTo("Camera")
        self._extendcamera.cameraSwitchBackFront("front")
        time.sleep(3)
        assert not self.device(
            text="Camera error").exists, "Camera popups 'Camera error'"
        g_common_obj.assert_exp_happens()
        self._extendcamera.cameraSwitchBackFront("back")
        self._extendcamera.stop_camera_am()
 def setUp(self):
     super(Render, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self._extendcamera = CameraExtendImpl()
     self._photos = get_photo_implement()
     self._photos.rm_delete_photos()
     self._photos.refresh_sdcard()
Пример #4
0
 def setUp(self):
     super(HWComposer, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     g_common_obj.root_on_device()
     self.d = g_common_obj.get_device()
     self._extendcamera = CameraExtendImpl()
     self.photoImpl = get_photo_implement()
     self.develop_settings = DevelopmentSettingsImpl()
     self.develop_settings.set_disable_hw_overlays(switch='ON')
Пример #5
0
 def setUp(self):
     super(CameraHorizontalMirroring, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self.device = g_common_obj.get_device()
     self._extendcamera = CameraExtendImpl()
     config_handle = ConfigHandle()
     result = config_handle.check_apps("com.android.rs.livepreview")
     if result == 0:
         self._extendcamera.install_apk("PreviewRS")
Пример #6
0
 def set_environment(self):
     """ init the test environment
     """
     self.systemui = SystemUiExtendImpl()
     self.camera = CameraExtendImpl()
     config = TestConfig()
     cfg_file = 'tests.tablet.chromecast.conf'
     cfg_cast = config.read(cfg_file, 'chromecast_device')
     self.nexus_device = cfg_cast.get("device")
     self.nexus_name = cfg_cast.get("name")
     cmd = "-s %s logcat -d -c" % self.nexus_device
     g_common_obj.adb_cmd_common(cmd)
     print "[clear log]"
Пример #7
0
class Render(RenderAppTestBase):
    def setUp(self):
        super(Render, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self._extendcamera = CameraExtendImpl()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Render, self).tearDown()
        self._extendcamera.delete_capture_pictures()

    def test_cameralaunching_100_times(self):
        ''' refer TC test_CameraLaunching_100_times
        '''
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.switch_back_home_serveraltimes()
Пример #8
0
class HWComposer(UIATestBase):

    def setUp(self):
        super(HWComposer, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        g_common_obj.root_on_device()
        self.d = g_common_obj.get_device()
        self._extendcamera = CameraExtendImpl()
        self.photoImpl = get_photo_implement()
        self.develop_settings = DevelopmentSettingsImpl()
        self.develop_settings.set_disable_hw_overlays(switch='ON')

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(HWComposer, self).tearDown()
        self.develop_settings.set_disable_hw_overlays(switch='OFF')

    def test_HWComposer_camera_preview(self):
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.picTake()
        g_common_obj.assert_exp_happens()
        self._extendcamera.delete_capture_pictures()

    def test_HWComposer_suspend_resume(self):
        '''
        Not using power button to suspend DUT since adb will disconnect.
        Replace with shell stop and start command to turn off / on display.
        '''
        adb32.refresh_ui()

    def test_HWComposer_video_playback(self):
        print "[RunTest]: %s" % self.__str__()
        Html5Impl().check_chrome_installed()
        video_path = '/sdcard/video.mp4'
        youtube_video_url, youtube_video_key = chrome_impl.get_youtube_url_key('american_bobtail',
                                                                               'key_american_bobtail')
        self.photoImpl.deploy_photo_content("Videos", "video_006", video_path)
        self.photoImpl.refresh_sdcard()
        self.photoImpl.play_video_command(video_path, 8)
        g_common_obj.assert_exp_happens()
        self.photoImpl.stop_photos_am()
        chrome_impl.launch()
        chrome_impl.chrome_setup()
        chrome_impl.open_website(youtube_video_url)
        chrome_impl.web_check(youtube_video_key, 15)

    def test_HWComposer_video_recording(self):
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.videoRecord()
        g_common_obj.assert_exp_happens()
        self._extendcamera.delete_captured_video()
Пример #9
0
    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(CameraFrontbackCameraPictureCapturingTest, self).setUp()

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

        self.logcat = Logcat(g_common_obj)
        self.chrome_cast = self.IChromeCastImpl(self.cast_model)
        self.camera = CameraExtendImpl()
        self.systemui = SystemUiExtendImpl()

        self.camera.clean()

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

        self.chrome_cast.setup()
        self.camera.startApp()
    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()
class Render(RenderAppTestBase):

    def setUp(self):
        super(Render, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self._extendcamera = CameraExtendImpl()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Render, self).tearDown()
        self._extendcamera.delete_capture_pictures()

    def test_continuouslyimagecapturing_20_times(self):
        ''' refer TC test_ContinuouslyImageCapturing_20 times
        '''
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.launch_camera_am()
        self._extendcamera.cameraSwitchTo("Camera")
        self._extendcamera.capture_20_times()
        self._extendcamera.stop_camera_am()
class Render(RenderAppTestBase):

    def setUp(self):
        super(Render, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self._extendcamera = CameraExtendImpl()
        self._extendcamera.install_apk("PreviewRS")

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Render, self).tearDown()

    def test_previewactivity_frontrearcamera(self):
        ''' refer TC test_PreviewActivity_FrontRearCamera
        '''
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.launch_previewrs_am()
        self._extendcamera.switch_to_front_camera_rs()
        self._extendcamera.switch_to_back_camera_rs()
        self._extendcamera.stop_previewrs_am()
class Render(RenderAppTestBase):
    def setUp(self):
        super(Render, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self._extendcamera = CameraExtendImpl()
        self._photos = get_photo_implement()
        self._photos.rm_delete_photos()
        self._photos.refresh_sdcard()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Render, self).tearDown()
        self._photos.rm_delete_photos()
        self._photos.refresh_sdcard()

    def test_videorecording_severalclips(self):
        ''' refer TC test_VideoRecording_SeveralClips
        '''
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.launch_camera_am()
        self._extendcamera.capture_video("1")
        self._extendcamera.stop_camera_am()
        self._photos.launch_photos_am()
        self._photos.play_video("Camera")
        time.sleep(10)
        g_common_obj.assert_exp_happens()
        self._photos.stop_photos_am()
    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)
Пример #15
0
class CameraHorizontalMirroring(UIATestBase):
    def setUp(self):
        super(CameraHorizontalMirroring, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.device = g_common_obj.get_device()
        self._extendcamera = CameraExtendImpl()
        config_handle = ConfigHandle()
        result = config_handle.check_apps("com.android.rs.livepreview")
        if result == 0:
            self._extendcamera.install_apk("PreviewRS")

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        self._extendcamera.uninstall_apk()
        super(CameraHorizontalMirroring, self).tearDown()

    def test_Viewfinder_HorizontalMirroring_SecondaryCamera(self):
        ''' refer TC test_Viewfinder_HorizontalMirroring_SecondaryCamera
        '''
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.launch_previewrs_am()
        self._extendcamera.switch_to_front_camera_rs()
        self._extendcamera.stop_previewrs_am()
class Render(RenderAppTestBase):
    def setUp(self):
        super(Render, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self._extendcamera = CameraExtendImpl()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Render, self).tearDown()
        self._extendcamera.delete_capture_pictures()

    def test_camerapreview_rotate_capture(self):
        ''' refer TC test_CameraPreview_Rotate_Capture
        '''
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.launch_camera_am()
        self._extendcamera.camera_rotate_capture()
        self._extendcamera.stop_camera_am()
Пример #17
0
class Fit(RenderAppTestBase):
    def setUp(self):
        super(Fit, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self._extendcamera = CameraExtendImpl()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Fit, self).tearDown()
        self._extendcamera.set_camera_as_back_camera()

    def switch_rear_front_camera_100times(self):
        ''' refer TC test_Switch_Camera
        '''
        print "[RunTest]: %s" % self.__str__()
        self._extendcamera.launch_camera_am()
        self._extendcamera.switch_rear_front_camera_100times()
        # self._extendcamera.switch_rear_front_camera()
        self._extendcamera.stop_camera_am()
 def setUp(self):
     super(Render, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self._extendcamera = CameraExtendImpl()
     self._extendcamera.install_apk("PreviewRS")
Пример #19
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()
Пример #20
0
class CameraFrontbackCameraPictureCapturingTest(ChromeCastTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(CameraFrontbackCameraPictureCapturingTest, cls).setUpClass()

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

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

        self.logcat = Logcat(g_common_obj)
        self.chrome_cast = self.IChromeCastImpl(self.cast_model)
        self.camera = CameraExtendImpl()
        self.systemui = SystemUiExtendImpl()

        self.camera.clean()

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

        self.chrome_cast.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(CameraFrontbackCameraPictureCapturingTest, self).tearDown()

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

    def test_Camera_FrontbackCameraPictureCapturing(self):
        """
        test_Camera_720pHDVideoRecording

        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. Start the Camera application.
            The Camera application is opened.
        4. Take some pictures with front/back camera.
            File pictures are taken and screencasting has no degradation.
        """
        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. Start the Camera application.
            The Camera application is opened."""
        self.d.press.home()
        self.camera.launchCamera()

        print """[Step] 4. Take some pictures with front/back camera.
            File pictures are taken and screencasting has no degradation."""
        self.camera.cameraSwitchBackFront(to='front')
        self.camera.picTake()
        pics = self.camera.get_stored_pics()
        assert len(pics) == 1,\
            "[FAILURE] Failed to taken picture"

        self.camera.cameraSwitchBackFront(to='back')
        self.camera.picTake()
        pics = self.camera.get_stored_pics()
        assert len(pics) == 2,\
            "[FAILURE] Failed to taken picture"
        print "[Debug] %s" % (pics)

        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 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)
Пример #22
0
class ChromeCastImpl:
    '''
    classdocs
    '''
    pkg_name = "com.android.settings"
    activity_name = "com.android.settings.Settings"

    def __init__(self):
        self._device = g_common_obj.get_device()
        self._locator = Locator(self._device)

    def set_environment(self):
        """ init the test environment
        """
        self.systemui = SystemUiExtendImpl()
        self.camera = CameraExtendImpl()
        config = TestConfig()
        cfg_file = 'tests.tablet.chromecast.conf'
        cfg_cast = config.read(cfg_file, 'chromecast_device')
        self.nexus_device = cfg_cast.get("device")
        self.nexus_name = cfg_cast.get("name")
        cmd = "-s %s logcat -d -c" % self.nexus_device
        g_common_obj.adb_cmd_common(cmd)
        print "[clear log]"

    def launch_app_am(self):
        """ Launch Settings via adb am command
        """
        print "Launch Settings by adb am"
        g_common_obj.launch_app_am(\
            ChromeCastImpl.pkg_name, ChromeCastImpl.activity_name)
        self._locator.wait_exist(self._locator.performance_tests)
        time.sleep(5)

    @staticmethod
    def stop_app_am():
        """ Stop Settings via adb am command
        """
        print "Stop Settings by adb am"
        g_common_obj.stop_app_am(ChromeCastImpl.pkg_name)

    def goto_castscreen(self):
        """ go to the castscreen interface
        """
        self._device(text="Display").click()
        time.sleep(1)
        self._device(text="Cast").click()
        time.sleep(5)

    def scan_adapter(self):
        """ scan the ChromeCast adapter
        """
        time.sleep(5)
        if self._device(text="No nearby devices were found.").exists:
            time.sleep(30)
        assert self._device(className="android.widget.RelativeLayout"
                            ).exists, "No nearby chromecast adapter"
        assert self._device(
            text=self.nexus_name).exists, "No target chromecaset exists."

    def connect_chromecast(self):
        """ connect to the chromecast
        """
        self._device(text=self.nexus_name).click()
        time.sleep(5)
        cmd = "-s %s logcat -d > /tmp/connect.log" % self.nexus_device
        g_common_obj.adb_cmd_common(cmd)
        assert not os.system(
            "cat /tmp/connect.log|grep 'onCastMirroringConnected'"\
            ), "The chromecast didn't connect "

    def disconnect_chromecast(self):
        """ disconnect the chromecast
        """
        self._device(text=self.nexus_name).click()
        time.sleep(2)
        self._device(text="Disconnect").click()
        time.sleep(2)
        cmd = "-s %s logcat -d > /tmp/disconnect.log" % self.nexus_device
        g_common_obj.adb_cmd_common(cmd)
        assert not os.system(
            "cat /tmp/disconnect.log|grep 'onCastMirroringConnected'"\
            ), "The chromecast didn't disconnect "

    def reconnect_chromecastx10(self):
        """ replay connect to chromecast 10 times
        """
        for i in range(1, 11):
            self.scan_adapter()
            self.connect_chromecast()
            time.sleep(15)
            self.swith_to_camera_and_return()
            self.disconnect_chromecast()
            print "[reconnect to chromecast %s times]" % i
            time.sleep(2)

    @staticmethod
    def reboot_device():
        """ reboot the device
        """
        g_common_obj.reboot_device()
        time.sleep(40)

    def reboot_chromecast_adapter(self):
        """ reboot the chromecast adapter
        """
        cmd = "-s %s reboot" % self.nexus_device
        g_common_obj.adb_cmd_common(cmd)
        print "[Wait adapter reboot]"
        time.sleep(100)

    def swith_to_camera_and_return(self):
        """ Launch camera via adb am command
        """
        print "Launch camera by adb am"
        self.camera.launch_camera_am()
        self._locator.wait_exist(self._locator.performance_tests)
        if self._device(text="NEXT").exists:
            self._device(text="NEXT").click()
        self.systemui.switch_recent_app("Settings")

    def disconnect_cast_if_failed(self):
        """ disconnect chromecast if failed
        """
        self.launch_app_am()
        self.goto_castscreen()
        if self._device(text="Connected").exists:
            self.disconnect_chromecast()
        self.stop_app_am()
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()
 def setUp(self):
     super(VideoModeViewFinder, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self.device = g_common_obj.get_device()
     self._extendcamera = CameraExtendImpl()
 def setUp(self):
     super(Render, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self._extendcamera = CameraExtendImpl()
Пример #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()