Ejemplo n.º 1
0
class NotificationAndQuickSettings(UIATestBase):
    def setUp(self):
        super(NotificationAndQuickSettings, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.systemui = SystemUiExtendImpl()
        self.notifi_quick_settings = NotificationAndQuickSettingsImpl()
        self.systemui.unlock_screen()
        self._log = Logcat()

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

    def test_HW_Composition_2PlanesPerOutput(self):
        """
        1.Enter into Home screen.
        2. Drag the areas corresponding to the Notification Panel.
        3. Drag the areas corresponding to the  Quick Settings Panel.
        4. Each Panel, Notification and Quick Settings, is properly displayed on top of the Home Screen.
        """
        try:
            self.notifi_quick_settings.drag_notification_panel()
            self.notifi_quick_settings.drag_quick_settings_panel()
        except:
            pass
        layer_num = self._log.get_layer_number()
        assert any(i in layer_num
                   for i in [0, 1]) is False, "Layer number is less than 2"
Ejemplo n.º 2
0
class GPUCompositionTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(GPUCompositionTest, 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(GPUCompositionTest, self).setUp()

        self.benchmark = GLBenchmarkExtendImpl()
        self.systemui = SystemUiExtendImpl()
        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.press.menu()
        self.benchmark.clean()
        self.benchmark.setup()
        self.develop_settings = DevelopmentSettingsImpl()
        self.develop_settings.set_disable_hw_overlays('ON')

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        super(GPUCompositionTest, self).tearDown()
        self.benchmark.clean()
        self.develop_settings.set_disable_hw_overlays('OFF')

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

    def test_GPU_Composition(self):
        """
        test_GPU_Composition

        Steps:
        1. Start GLBenchmark 2.7.0 and run the Egypt HD ETC1 Onscreen test.
            The test runs without any errors and the workload images are properly displayed on the screen and we don't have artifacts.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Start GLBenchmark 2.7 and run the Egypt HD ETC1 Onscreen test.
            The test runs without any errors and the workload images are properly displayed on the screen and we don't have artifacts."""
        self.benchmark.launch()
        self.benchmark.run_performance_test("test25")
        self.benchmark.check_all_results()
        g_common_obj.assert_exp_happens()

    def test_GPU_Composition_Mesa(self):
        assert logcat.check_dumpsys_SurfaceFlinger_info(
            True, 'GLES.*Mesa', 'Mesa'), "It's not mesa."
        self.benchmark.launch()
        self.benchmark.run_performance_test("test25")
        self.benchmark.check_all_results()
        g_common_obj.assert_exp_happens()
class GFXBenchGLLowLevelTestAlphaBlendingOffscreenTest(RenderAppTestBase):

    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(GFXBenchGLLowLevelTestAlphaBlendingOffscreenTest, 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(GFXBenchGLLowLevelTestAlphaBlendingOffscreenTest, self).setUp()

        self.gfxbench = Gfxbench30Impl()
        self.systemui = SystemUiExtendImpl()

        self.gfxbench.clean()
        self.gfxbench.setup()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.press.menu()
        self.natural_orientation = self.d.info['naturalOrientation']
        self.orientation = self.d.orientation
        rotate_screen(mode='wide')
        wifi_ctrl.turn_on()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        self.gfxbench.clean()
        self.d.orientation = self.orientation
        self.d.freeze_rotation(self.natural_orientation)
        super(GFXBenchGLLowLevelTestAlphaBlendingOffscreenTest, self).tearDown()

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

    def test_GFXBenchGL_LowLevelTest_AlphaBlending_Offscreen(self):
        """
        test_GFXBenchGL_LowLevelTest_AlphaBlending_Offscreen

        Steps:
        1. Launch GFXBench and select "Alpha Blending Offscreen", then touch "Start" to run.
            The application starts and run without any issue. Check test result, it should be reported, not N/A.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch GFXBench and select "Alpha Blending Offscreen", then touch "Start" to run.
            The application starts and run without any issue. Check test result, it should be reported, not N/A."""
        self.gfxbench.launch()

        self.gfxbench.run_test_alpha_blending_offscreen()
Ejemplo n.º 4
0
class GPUCompositionFallbackMoreLayers(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(GPUCompositionFallbackMoreLayers, 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(GPUCompositionFallbackMoreLayers, self).setUp()
        self.compositionImpl = CompositionFallbackImpl()
        self.systemui = SystemUiExtendImpl()
        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.press.menu()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        self.d.press.home()
        common.launch_settings_am()
        #         self.compositionImpl.enable_disable_other_input_methods("off")
        super(GPUCompositionFallbackMoreLayers, self).tearDown()

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

    def test_GPU_CompositionFallback_MoreLayers(self):
        """
        test_GPU_CompositionFallback_MoreLayers

        """
        print "[RunTest]: %s" % self.__str__()
        common.launch_settings_am()
        output = self.compositionImpl.dumpsys_surface_flinger()
        assert output == '', "dumpsys_surface failed"
        time.sleep(1)
        #         self.compositionImpl.enable_disable_other_input_methods("on")
        #         time.sleep(1)
        #         self.d.press.home()
        #         time.sleep(1)
        #         self.compositionImpl.touch_goolge_search_bar()
        self.compositionImpl.open_reset_window()
        output = self.compositionImpl.dumpsys_surface_flinger()
        assert output.find(
            "DimLayer"), "dumpsys SurfaceFlinger | grep 'GLES |'  failed"
Ejemplo n.º 5
0
class HDMITest(UIATestBase):
    @classmethod
    def setUpClass(self):
        print "[setUpClass]: %s" % self.__name__
        super(HDMITest, self).setUpClass()
        self.photosImpl = get_photo_implement()

        self.photosImpl.rm_delete_photos()
        self.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(HDMITest, self).setUp()

        self.systemui = SystemUiExtendImpl()
        self.camera = CameraImpl()
        self.HDMI_switch_card = HDMISwitchCardImpl()
        self.HDMI_switch_card.setup()
        self.HDMI_switch_card.switch_off()

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

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

    def test_HDMI_TakePicture(self):
        """
        test_HDMI_TakePicture
        """
        print "[RunTest]: %s" % self.__str__()
        self.HDMI_switch_card.switch_on()
        self.camera.startApp()
        self.camera.picTake()
        self.photosImpl.launch_photos_am()
        self.photosImpl.delete_photos_in_a_folder("Camera", 1)
        self.camera.videoRecord()
        g_common_obj.assert_exp_happens()
        self.HDMI_switch_card.switch_off()
Ejemplo n.º 6
0
class ScreenSizeReportingTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(ScreenSizeReportingTest, 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(ScreenSizeReportingTest, self).setUp()
        AdbExtension().screen_rotation(0)
        self.apitest = APITestImpl()
        self.systemui = SystemUiExtendImpl()
        self.apitest.setup()
        self.systemui.unlock_screen()
        self.d.screen.on()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        self.apitest.clean()
        super(ScreenSizeReportingTest, self).tearDown()

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

    def test_Screen_Size_Reporting(self):
        """
        test_Screen_Size_Reporting

        Steps:
        1. Execute DisplayMetricsTestDriver InstrumentationTestRunner
            adb shell am instrument
                -e class com.intel.test.apitests.tests.DisplayMetricsTestDriver#testDisplayAllFields
                -w com.intel.test.apitests/com.intel.test.apitests.runners.DisplayMetricsTestRunner
        2. adb logcat -d | grep -Ei "widthPixels | heightPixels"
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Execute DisplayMetricsTestDriver InstrumentationTestRunner."""
        report_logs = self.apitest.run_DisplayMetricsTest()
        self.apitest.verify_screen_size(report_logs)
class ScreenOffPowerButtonTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(ScreenOffPowerButtonTest, 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(ScreenOffPowerButtonTest, self).setUp()

        self.systemui = SystemUiExtendImpl()
        self.systemui.unlock_screen()
        self.d.screen.on()
        assert is_device_screen_on(),\
            "[FAILURE] Failed DUT screen turned On."

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

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

    def test_ScreenOff_PowerButton(self):
        """
        test_ScreenOff_PowerButton

        Steps:
        1. Press Power button.
            DUT screen turned Off.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Press Power button.
            DUT screen turned Off."""
        g_common_obj.adb_cmd("input keyevent 26")
        assert not is_device_screen_on(),\
            "[FAILURE] Failed DUT screen turned Off."
Ejemplo n.º 8
0
class GLBenchmarkEgyptHD(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(GLBenchmarkEgyptHD, 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(GLBenchmarkEgyptHD, self).setUp()

        self.benchmark = GLBenchmarkExtendImpl()
        self.systemui = SystemUiExtendImpl()
        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.press.menu()
        self.benchmark.clean()
        self.benchmark.setup()
        close_all_tasks()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        self.benchmark.clean()

        g_common_obj.set_vertical_screen()
        super(GLBenchmarkEgyptHD, self).tearDown()

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

    def test_GLBenchmarkEgyptHD_MSAA(self):
        print "[RunTest]: %s" % self.__str__()
        self.benchmark.launch()
        self.benchmark.run_performance_test("test25")
        self.benchmark.check_all_results()
        g_common_obj.assert_exp_happens()
Ejemplo n.º 9
0
class GPUCompositionFallbackTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(GPUCompositionFallbackTest, 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(GPUCompositionFallbackTest, self).setUp()

        self.benchmark = GLBenchmarkExtendImpl()
        self.systemui = SystemUiExtendImpl()
        self.develop_settings = DevelopmentSettingsImpl()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.press.menu()
        self.benchmark.clean()
        self.benchmark.setup()
        self.develop_settings.set_disable_hw_overlays(switch='ON')

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        super(GPUCompositionFallbackTest, self).tearDown()
        self.benchmark.clean()
        self.develop_settings.set_disable_hw_overlays('OFF')
        g_common_obj.set_vertical_screen()

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

    def test_GPU_CompositionFallback(self):
        """
        test_GPU_CompositionFallback

        Steps:
        1. Enable "Disable HW overlays" in developer options
        2. adb shell dumpsys SurfaceFlinger | grep -wi "GLES "
            GLES | xxxx | xxxx | xxxx | xx | xxxx |
        3. Start GLBenchmark 2.7 and run the Egypt HD ETC1 Onscreen test.
            The test runs without any errors and the workload images are properly displayed on the screen and we don't have artifacts.
        """
        assert logcat.check_dumpsys_SurfaceFlinger_info(
            True, 'GLES.*', 'GLES'), "Not found GLES info"

        print """[Step] 3. Start GLBenchmark 2.7 and run the Egypt HD ETC1 Onscreen test.
            The test runs without any errors and the workload images are properly displayed on the screen and we don't have artifacts."""
        self.benchmark.launch()
        self.benchmark.run_performance_test("test25")
        self.benchmark.check_all_results()
        g_common_obj.assert_exp_happens()

    def test_GPU_CompositionFallback_Mesa(self):
        assert logcat.check_dumpsys_SurfaceFlinger_info(
            True, 'GLES.*Mesa', 'Mesa'), "Not found GLES info"
        self.benchmark.launch()
        self.benchmark.run_performance_test("test25")
        self.benchmark.check_all_results()
        g_common_obj.assert_exp_happens()
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()
Ejemplo n.º 11
0
class ChromeCastImpl(object):
    """ChromeCast uiautomator """

    config_file = 'tests.common.chromecast.conf'

    class MenuUI(object):
        """Main frame UI"""
        def __init__(self, device):
            self.device = device

        @property
        def left_drawer(self):
            return self.device(
                resourceId=
                "com.google.android.apps.chromecast.app:id/left_drawer")

        def show_menu(self):
            y = self.device.info["displayHeight"]
            x = self.device.info["displayWidth"]
            self.device.swipe(x / 2, y - 20, 0, y - 20, steps=5)
            if not self.left_drawer.exists:
                self.device.swipe(0, y / 2, x / 2, y / 2, steps=5)
                time.sleep(1)

        @property
        def cast_screen(self):
            self.show_menu()
            return self.device(text="Cast screen / audio")

        @property
        def devices(self):
            self.show_menu()
            return self.device(text="Devices")

    class CastScreen(object):
        """Page Cast Screen"""
        def __init__(self, device):
            self.device = device

        @property
        def scan_castscreen(self):
            return self.device(
                resourceId=
                "com.google.android.apps.chromecast.app:id/mirror_button")

        @property
        def list(self):
            return self.device(
                resourceId=
                "com.google.android.apps.chromecast.app:id/mr_chooser_route_name"
            )

        @property
        def disconnect(self):
            return self.device(
                resourceId=
                "com.google.android.apps.chromecast.app:id/disconnect_button")

    def __init__(self):
        self.device = g_common_obj.get_device()
        self.menu = ChromeCastImpl.MenuUI(self.device)
        self.castscreen = ChromeCastImpl.CastScreen(self.device)
        self.systemui = SystemUiExtendImpl()
        self.config = TestConfig()

    def skip_welcome(self):
        self.device.watcher("AUTO_FC_WHEN_ANR")\
            .when(text='Accept').click(text='Accept')
        if self.device(text="OK, got it").exists:
            self.device(text="OK, got it").click()
        if self.device(textContains='No Thanks').exists:
            self.device(textContains='No Thanks').click()
        if self.device.watcher("AUTO_FC_WHEN_ANR").triggered:
            print "[Debug] Skip Welcome"

    def setup(self):
        cfg = self.config.read(self.config_file, "ChromeCast")
        arti = Artifactory(cfg.get('artifactory_location'))
        apk_path = arti.get(cfg.get("chromecast_apk"))

        cmd = "install -r %s" % (apk_path)
        print g_common_obj.adb_cmd_common(cmd)

    def launch(self):
        """Launch app"""
        g_common_obj.launch_app_am(
            'com.google.android.apps.chromecast.app',
            'com.google.android.apps.chromecast.app.DiscoveryActivity')
        self.skip_welcome()

    def resume(self):
        """Resume app"""
        cmdstr = "am start %s/%s" % (
            'com.google.android.apps.chromecast.app',
            'com.google.android.apps.chromecast.app.DiscoveryActivity')
        g_common_obj.adb_cmd(cmdstr)
        self.skip_welcome()

    def scan_cast_screen(self):
        devices = []
        self.menu.cast_screen.click()
        if self.device(text="OK").exists:
            self.device(text="OK").click.wait()
        time.sleep(2)
        if self.castscreen.scan_castscreen.exists:
            self.castscreen.scan_castscreen.click()
        time.sleep(10)

        for idx in range(len(self.castscreen.list)):
            title = self.castscreen.list[idx].text
            devices.append({
                'title': title,
            })
        print "[Debug] cast_screen  %s" % (devices)

        return devices

    def choose_castscreen(self, model):
        devices = self.scan_cast_screen()
        assert len(devices), \
            "[FAILURE] There is no any cast device"

        return devices[0]['title']

    def _connect_cast_screen(self, name):
        if self.device(text=name).exists:
            self.device(text=name).click()

        for _ in range(1, 21):
            time.sleep(1)
            if self.castscreen.disconnect.exists:
                return
        assert False, \
            "[FAILURE] Wait cast connection time over"

    def disconnect_cast_screen(self):
        self.menu.cast_screen.click()
        if self.castscreen.disconnect.exists:
            self.castscreen.disconnect.click()

    def verify_connection_from_quick_settings(self, name):
        self.systemui.unlock_screen()
        self.device.screen.on()
        self.device.press.home()
        self.device.open.quick_settings()
        self.device.wait.update()
        status = self.device(textContains="Connected to %s" % (name)).exists
        assert status, \
            "[FAILURE] Not found Connected inf in Quick Settings"
        self.device.press.back()
        self.device.press.back()
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)
Ejemplo n.º 13
0
class CardviewRecentsTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(CardviewRecentsTest, cls).setUpClass()
        cls.d = g_common_obj.get_device()
        cls.config_file = 'tests.ComposeUI.CardviewRecentsTest.conf'
        cls.test_conf = cls.config.read(cls.config_file, "CardviewRecentsTest")

    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 tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        #         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(CardviewRecentsTest, self).tearDown()
        self.photos.rm_delete_photos()
        remove_aosp_launcher()

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

    def test_Cardview_Recents(self):
        """
        test_Cardview_Recents

        Steps:
        1. launch 5 apps 
        # change to 5 apps due to some of apps in step are not preinstalled.
            all launch successfully
        2. launch Recents to swtich between different app
            Check CardView in Recents are working correctly
        """
        print "[RunTest]: %s" % self.__str__()

        print "[Init APP]"
        print "Init Photos"
        g_common_obj.launch_app_am(
            " com.google.android.apps.photos",
            "com.google.android.apps.photos.home.HomeActivity")
        time.sleep(2)
        self.photos.stop_photos_am()
        time.sleep(1)
        print "Init Calendar"
        g_common_obj.launch_app_am("com.google.android.calendar",
                                   "com.android.calendar.AllInOneActivity")
        if not self.d(description="Create new event and more").exists:
            for _ in range(0, 3):
                if self.d(description="next page").exists:
                    self.d(description="next page").click.wait()
            if self.d(text="Got it").exists:
                self.d(text="Got it").click.wait()
        g_common_obj.stop_app_am("com.google.android.calendar")
        time.sleep(2)
        print """[Step] 1. launch 5 apps
            all launch successfully"""
        for each in self.actor_apps.split(','):
            if "com.android.launcher3" not in pkgmgr.get_packages():
                launch_aosp_home()
            self.systemui.launch_desk_app(each)
            time.sleep(2)

        print """[Step] 2. launch Recents to swtich between different app
            Check CardView in Recents are working correctly"""
        for each in self.actor_apps.split(','):
            self.systemui.switch_recent_app(each)
            time.sleep(2)
Ejemplo n.º 14
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()
Ejemplo n.º 15
0
class HDMIConnectDisconnectTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(HDMIConnectDisconnectTest, 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(HDMIConnectDisconnectTest, self).setUp()

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

        self.systemui = SystemUiExtendImpl()
        self.display_cable_switch = DisplayCableSwitchImpl()
        self.display_cable_switch.setup()
        self.display_cable_switch.switch_off()

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

    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)
        super(HDMIConnectDisconnectTest, self).tearDown()

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

    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"
class ImageProcessingCoreCPUTest(RenderAppTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(ImageProcessingCoreCPUTest, 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(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()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__

        app_pid = g_common_obj.adb_cmd_capture_msg(
            "ps | grep '%s' |awk '{print $2}'" %
            (ImageProcessingImpl.PKG_NAME))
        fatal_msg = logcat.get_device_log(self.mark_time,
                                          filters='*:F',
                                          pid=app_pid)
        assert len(
            fatal_msg) == 0, "occurred Fatal error during testing:\n%s" % (
                fatal_msg)

        self.imageprocessing.clean()

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

    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()
class WallpaperSetGIFImageTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(WallpaperSetGIFImageTest, 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(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 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(WallpaperSetGIFImageTest, self).tearDown()

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

    def test_WallpaperSet_GIFImage(self):
        """
        test_WallpaperSet_GIFImage

        Steps:
        1. Open a GIF picture by Gallery app
        GIF 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 GIF picture can set as wallpaper successfully. DUT has no crash or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Open a GIF picture by Gallery app
            GIF 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 GIF picture can set as wallpaper successfully. DUT has no crash or freeze."""
        self.qrcodeImpl.verify_qrcode_marked_image(self.qrcode)
Ejemplo n.º 18
0
class RotationCameraPerviewTest(ChromeCastTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(RotationCameraPerviewTest, cls).setUpClass()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(RotationCameraPerviewTest, 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 = CameraImpl()
        self.systemui = SystemUiExtendImpl()

        self.chrome_cast.setup()

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

        self.d.freeze_rotation()
        self.d.orientation = 'natural'

    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)
        super(RotationCameraPerviewTest, self).tearDown()

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

    def test_Rotation_CameraPerview(self):
        """
        test_ScreenCasting_Idle20minutes

        Steps:
        1. Turn on Wireless Display on DUT.
            The Chromecast is shown on the scan list.
        2. Cast screen to Chromecast
            Screen is cast to Chromecast .
        3. Launch Camera app.
            Camera preview displayed in both DUT and remote monitor.
        4. Rotate DUT in clockwise and then rotate it back.
            Both DUT and remote monitor display normally.
        5. Rotate DUT in anticlockwise and then rotate it back.
            Both DUT and remote monitor display normally.
        """
        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. Cast screen to Chromecast
                    Screen is cast to Chromecast."""
        self.chrome_cast.connect_cast_screen(cast_real_name)

        print """[Step] 3. Launch Camera app.
                    Camera preview displayed in both DUT and remote monitor."""
        self.d.press.home()
        self.camera.launchCamera()

        print """[Step] 4. Rotate DUT in clockwise and then rotate it back.
                    Both DUT and remote monitor display normally."""
        self.d.orientation = "right"
        print self.d.info
        time.sleep(5)
        self.d.orientation = 'natural'
        print self.d.info
        time.sleep(5)

        print """[Step] 5. Rotate DUT in anticlockwise and then rotate it back.
                    Both DUT and remote monitor display normally."""
        self.d.orientation = "left"
        print self.d.info
        time.sleep(5)
        self.d.orientation = 'natural'
        print self.d.info
        time.sleep(5)

        self.chrome_cast.resume()
        self.chrome_cast.disconnect_cast_screen()
class ImageProcessingAnyValuesTest(RenderAppTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(ImageProcessingAnyValuesTest, 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(ImageProcessingAnyValuesTest, 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()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__

        app_pid = g_common_obj.adb_cmd_capture_msg(
            "ps | grep '%s' |awk '{print $2}'" %
            (ImageProcessingImpl.PKG_NAME))
        fatal_msg = logcat.get_device_log(self.mark_time,
                                          filters='*:F',
                                          pid=app_pid)
        assert len(
            fatal_msg) == 0, "occurred Fatal error during testing:\n%s" % (
                fatal_msg)

        self.imageprocessing.clean()

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

    def test_ImageProcessing_AnyValues(self):
        """
        test_ImageProcessing_AnyValues

        Steps:
        1. Launch ImageProcessing.
            The application starts and run without issues.
        2.  Drag value of each item and check the image display is changed according to your setting.
            Color changed and no any display issue.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch ImageProcessing.
            The application starts and run without issues"""
        self.d.orientation = 'n'
        self.imageprocessing.launch()

        print """[Step] 2.  Drag value of each item and check the image display is changed according to your setting.
            Color changed and no any display issue."""
        options = []
        for field in ['Saturation', 'In Black', 'Out Black', 'Out White']:
            rand = random.sample(range(1, 99), 1)
            for percent in rand:
                options.append((field, percent))
        self.imageprocessing.change_levels_vec4_relaxed_settings(options)
        self.imageprocessing.change_levels_vec3_relaxed_settings(options)
class HDMITest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(HDMITest, 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(HDMITest, self).setUp()
        self.photosImpl = get_photo_implement()
        self.qrcode = "bmppicture"
        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')

        self.retry_num = self.config.read(
            cfg_file, 'rerun_times').get("hdmi_imagedisplay_bmp")
        self.retry_num = int(self.retry_num)
        cfg = config.read(cfg_file, 'qrcode_marked_image')
        print self.qrcode
        self.qrcode = cfg.get("hdmi_bmp_qrcode")
        print "[Debug] qrcode:%s" % (self.qrcode)
        arti = Artifactory(cfg_arti.get('location'))
        pic_name = cfg.get("hdmi_bmp_image")
        file_path = arti.get(pic_name)
        g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures')
        self.photosImpl.refresh_sdcard()

        self.systemui = SystemUiExtendImpl()
        self.HDMI_switch_card = HDMISwitchCardImpl()
        self.HDMI_capture_decode = HDMICaptureDecodeImpl()
        self.HDMI_switch_card.setup()
        self.HDMI_switch_card.switch_off()
        self.HDMI_capture_decode.setup()

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

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

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

    def test_HDMI_ImageDisplay_BMP(self):
        """
        test_HDMI_ImageDisplay_BMP
        """
        self.HDMI_switch_card.switch_on()
        self.photosImpl.launch_photos_am()
        self.photosImpl.open_a_picture()
        self.photosImpl.view_a_picture_fullscreen()
        success = False
        self.error_string = ""
        for i in range(self.retry_num):
            print "[capture_decode]:%s times" % (i + 1)
            success, self.error_string = self.HDMI_capture_decode.capture_decode(
                self.qrcode)
            print success, self.error_string
            if success == True:
                break
            else:
                try:
                    picname = g_common_obj.globalcontext.user_log_dir + "/hdmipicture.png"
                    cmd = "mv " + self.HDMI_capture_decode.get_path(
                    ) + "saveimages/fail_0_0.png %s" % (picname)
                    print os.system(cmd)
                except Exception as e:
                    print e.message, e.args
        assert success, self.error_string
        self.photosImpl.stop_photos_am()
        self.HDMI_switch_card.switch_off()
class HDMITest(UIATestBase):
    @classmethod
    def setUpClass(self):
        print "[setUpClass]: %s" % self.__name__
        super(HDMITest, self).setUpClass()
        self.photosImpl = get_photo_implement()
        self.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(HDMITest, self).setUp()
        self.photosImpl.rm_delete_photos()
        self.qrcode = "bmppicture"
        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')

        self.retry_num = self.config.read(
            cfg_file, 'rerun_times').get("hdmi_imagedisplay_png")
        self.retry_num = int(self.retry_num)
        cfg = config.read(cfg_file, 'qrcode_marked_image')
        print self.qrcode
        self.qrcode = cfg.get("hdmi_png_qrcode")
        print "[Debug] qrcode:%s" % (self.qrcode)
        arti = Artifactory(cfg_arti.get('location'))
        pic_name = cfg.get("hdmi_png_image")
        file_path = arti.get(pic_name)
        g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures')
        self.photosImpl.refresh_sdcard()

        self.systemui = SystemUiExtendImpl()
        self.HDMI_switch_card = HDMISwitchCardImpl()
        self.HDMI_capture_decode = HDMICaptureDecodeImpl()
        self.HDMI_switch_card.setup()
        self.HDMI_switch_card.switch_off()
        self.HDMI_capture_decode.setup()

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

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

    def test_HDMI_Sleep_UnplugCable(self):
        """
        test_HDMI_Sleep_UnplugCable
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Connect HDMI and Launch photos and check HDMI by capture decode QRcodepicture."""
        self.HDMI_switch_card.switch_on()
        self.photosImpl.launch_photos_am()
        self.photosImpl.open_a_picture()
        self.photosImpl.view_a_picture_fullscreen()

        print """[Step] 2. Press PWR key to Suspend DUT."""
        print "press power key to Suspend DUT."
        g_common_obj.adb_cmd("input keyevent 26")
        time.sleep(2)
        assert not is_device_screen_on(), \
            "[FAILURE] Failed DUT screen turned Off."
        print "press power key to Resume DUT."
        g_common_obj.adb_cmd("input keyevent 26")
        time.sleep(2)
        success = False
        self.error_string = ""
        for i in range(self.retry_num):
            print "[capture_decode]:%s times" % (i + 1)
            success, self.error_string = self.HDMI_capture_decode.capture_decode(
                self.qrcode)
            print success, self.error_string
            if success == True:
                break
            else:
                try:
                    picname = g_common_obj.globalcontext.user_log_dir + "/hdmipicture.png"
                    cmd = "mv " + self.HDMI_capture_decode.get_path(
                    ) + "saveimages/fail_0_0.png %s" % (picname)
                    print os.system(cmd)
                except Exception as e:
                    print e.message, e.args
        assert success, self.error_string

        print """[Step] 3. Unplugin HDMI cable."""
        print "unplug HDMI."
        self.HDMI_switch_card.switch_off()
        time.sleep(2)
        print "check DUT QRcode picture."
        self.photosImpl.stop_photos_am()
        self.photosImpl.launch_photos_am()
        self.photosImpl.open_a_picture()
        self.photosImpl.view_a_picture_fullscreen()
        self.photosImpl.stop_photos_am()
        print "unplug HDMI."
        self.HDMI_switch_card.switch_off()
Ejemplo n.º 22
0
class ScreenOffTimeOutTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(ScreenOffTimeOutTest, 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(ScreenOffTimeOutTest, self).setUp()

        self.sys_setting = SystemSettingsImpl()
        self.systemui = SystemUiExtendImpl()
        self.dbsettings = DBSettingsSetGet()
        self.systemui.unlock_screen()
        self.d.screen.on()
        self.sleep_time = 30

        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 tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        self.dbsettings.set_status_stay_awake(True)
        self.sys_setting.put_system_setting('screen_brightness',
                                            self.org_screen_brightness)
        self.sys_setting.put_system_setting('screen_off_timeout',
                                            self.org_screen_off_timeout)
        super(ScreenOffTimeOutTest, self).tearDown()

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

    def test_ScreenOff_TimeOut(self):
        """
        test_ScreenOff_TimeOut

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

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

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

        print """[Step] 3. Idle the DUT.
            DUT screen turned Off automatically after 30 seconds."""
        from testlib.gps.common import GPS_Common
        GPS_Common().kill_uiautomator()
        # start_time = time.time()
        # steep_time = 0.5
        # while time.time() - start_time <= self.sleep_time - steep_time:
        #     current_time = time.time()
        #     print "[Debug] second %.3f" % (current_time - start_time)
        #     assert is_device_screen_on(),\
        #         "[FAILURE] go to screen off early! start_time:%s current_time:%s"\
        #         % (start_time, current_time)
        #     time.sleep(steep_time)
        time.sleep(self.sleep_time + 5)
        print "-----------GFX_test_ScreenOff_TimeOut------------------"
        # from testlib.graphics.screenshot_for_liverpt import take_screenshot_for_liverpt
        # take_screenshot_for_liverpt()
        assert not is_device_screen_on(),\
            "[FAILURE] Failed automatically turned off"
class TouchScreenDuringDUTDimTest(UIATestBase):

    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(TouchScreenDuringDUTDimTest, 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(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 tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__

        self.sys_setting.put_system_setting('screen_brightness',
                                            self.org_screen_brightness)
        self.sys_setting.put_system_setting('screen_off_timeout',
                                            self.org_screen_off_timeout)
        # Task:Specified watching.
#         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(TouchScreenDuringDUTDimTest, self).tearDown()

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

    def test_Display_TouchScreenDuringDUTDim_10times(self):
        """
        test_Display_TouchScreenDuringDUTDim_10times

        Steps:
        1. Go to Settings > Display > Sleep and set a small timeout for the display
            Display timeout is set.
        2. Wait for the timeout to expires and for the screen to begin to darken.
            Screen begins to darken (brightness is rapidly diminished).
        3. Touch the screen while the display darkens but before it turns off.
            The transition to sleep is interrupted and it will start again after the timeout set in Step 1.
        4. Repeat from Step 2 for 10 times (or more if you have the test automated).
            Each time the transition to sleep is interrupted and at the end of the test DUT continues to work as usual.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Go to Settings > Display > Sleep and set a small timeout for the display
            Display timeout is set."""
        self.sys_setting.put_system_setting('screen_brightness', '255')
        self.sys_setting.put_system_setting('screen_off_timeout',
                                            str(self.sleep_time * 1000))
        self.d.press.home()

        print """[Step] 2. Wait for the timeout to expires and for the screen to begin to darken.
            Screen begins to darken (brightness is rapidly diminished)."""
        print """[Step] 3. Touch the screen while the display darkens but before it turns off.
            The transition to sleep is interrupted and it will start again after the timeout set in Step 1."""
        print """[Step] 4. Repeat from Step 2 for 10 times (or more if you have the test automated).
            Each time the transition to sleep is interrupted and at the end of the test DUT continues to work as usual."""
        for i in range(1, 31):
            print "[Debug] times:%s" % (i)
            start_time = time.time()
            end_time = start_time + self.sleep_time
            screen_dimed = False
            while time.time() < end_time:
                current_time = time.time()
                dump_info = self.dumpsys\
                    .dump_display_power_state()
                policy_state = dump_info['policy']
                assert policy_state != 'OFF',\
                    "[FAILURE] Abnormal state screen off, %s times" % (i)
                screen_dimed = True if policy_state == 'DIM' else False
                if screen_dimed:
                    print "[Debug] DIM at second %.3f" % (current_time - start_time)
                    time.sleep(2)
                    self.d.press.home()
                    break
                time.sleep(0.5)
            assert screen_dimed == True,\
                "[FAILURE] Screen not into DIM mode, %s times" % (i)
Ejemplo n.º 24
0
class TaskManagerTest(ChromeCastTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(TaskManagerTest, cls).setUpClass()

        config_file = 'tests.basicfunction.taskmanager.conf'
        cls.test_conf = cls.config.read(config_file, "close_recent_apps")

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

        self.cast_model = self.test_conf.get('cast_model')
        self.actor_apps = self.test_conf.get('actor_apps')

        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.systemui = SystemUiExtendImpl()
        self.photos = PhotosImpl()

        self.chrome_cast.setup()

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

    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)
        super(TaskManagerTest, self).tearDown()

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

    def test_TaskManager_CloseRecentApps(self):
        """
        test_TaskManager_CloseRecentApps

        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. Open a few applications
                The applications are opened
        4. Push the recent applications button
                The recent application screen is shown
        5. Close all applications
                The applications are closed 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 "[Init APP]"
        print "Init Photos"
        g_common_obj.launch_app_am(
            " com.google.android.apps.photos",
            "com.google.android.apps.photos.home.HomeActivity")
        time.sleep(2)
        self.photos.stop_photos_am()
        time.sleep(1)
        print "Init Calendar"
        g_common_obj.launch_app_am(
            " com.google.android.calendar",
            "com.android.calendar.AllInOneCalendarActivity")
        if not self.d(description="Create new event and more").exists:
            for _ in range(0, 3):
                if self.d(description="next page").exists:
                    self.d(description="next page").click.wait()
            if self.d(text="Got it").exists:
                self.d(text="Got it").click.wait()
        g_common_obj.stop_app_am("com.google.android.calendar")
        time.sleep(2)

        print """[Step] 3. Open a few applications
                    The applications are opened"""
        for each in self.actor_apps.split(','):
            self.d.press.home()
            self.d(description="Apps").click()
            if self.d(scrollable=True).scroll.horiz.to(text=each):
                self.d(text=each).click()
                time.sleep(2)
                print "[Debug] open app %s" % (each)

        print """[Step] 4. Push the recent applications button
                        The recent application screen is shown"""
        for each in self.actor_apps.split(','):
            self.d.press.home()
            self.d.press.recent()
            self.d().scroll.vert.toEnd()
            assert self.d().scroll.vert.to(text=each), \
                "[FAILURE] %s Not appear in recent list" % (each)
            print "[Debug] app %s existed in recent" % (each)
            time.sleep(1)

        print """[Step] 5. Close all applications
                    The applications are closed and screencasting is successful"""
        self.systemui.close_all_recent_apps()
Ejemplo n.º 25
0
class APIDemosGraphicsOpenGLESTest(RenderAppTestBase):

    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(APIDemosGraphicsOpenGLESTest, 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(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()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        app_pid = g_common_obj.adb_cmd_capture_msg("ps | grep 'com.example.android.apis' |awk '{print $2}'")
        fatal_msg = logcat.get_device_log(self.mark_time, filters='*:F', pid=app_pid)
        assert len(fatal_msg) == 0, "occurred Fatal error during testing:\n%s" % (fatal_msg)

        self.apidemo.clean()
        super(APIDemosGraphicsOpenGLESTest, self).tearDown()

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

    def test_APIDemos_CompressedTexture_30minutes(self):
        """
        test_APIDemos_CompressedTexture_30minutes

        Steps:
        1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Compressed Texture" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Compressed Texture" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze."""
        self.apidemo.run_compressed_texture(count=1, step_time=60)

    def test_APIDemos_CubeMap_30minutes(self):
        """
        test_APIDemos_CubeMap_30minutes

        Steps:
        1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Cube Map" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Cube Map" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze."""
        self.apidemo.run_cube_map(count=1, step_time=60)

    def test_APIDemos_FrameBufferObject_30minutes(self):
        """
        test_APIDemos_FrameBufferObject_30minutes

        Steps:
        1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Frame Buffer Object" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Frame Buffer Object" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze."""
        self.apidemo.run_frame_buffer_object(count=1, step_time=60)

    def test_APIDemos_GLSurfaceView_30minutes(self):
        """
        test_APIDemos_FrameBufferObject_30minutes

        Steps:
        1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "GLSurfaceView" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "GLSurfaceView" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze."""
        self.apidemo.run_gl_surface_view(count=1, step_time=60)

    def test_APIDemos_Kube_30minutes(self):
        """
        test_APIDemos_Kube_30minutes

        Steps:
        1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Kube" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Kube" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze."""
        self.apidemo.run_kube(count=1, step_time=60)

    def test_APIDemos_MatrixPaletteSkinning_30minutes(self):
        """
        test_APIDemos_MatrixPaletteSkinning_30minutes

        Steps:
        1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Matrix Palette Skinning" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Matrix Palette Skinning" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze."""
        self.apidemo.run_matrix_palette_skinning(count=1, step_time=60)

    def test_APIDemos_OpenGLES20(self):
        """
        test_APIDemos_OpenGLES20

        Steps:
        1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "OpenGL ES 2.0" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "OpenGL ES 2.0" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze."""
        self.apidemo.run_opengles20(count=1, step_time=60)

    def test_APIDemos_SpriteText_30minutes(self):
        """
        test_APIDemos_SpriteText_30minutes

        Steps:
        1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Sprite Text" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Sprite Text" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze."""
        self.apidemo.run_sprite_text(count=1, step_time=60)

    def test_APIDemos_TexturedTriangle_30minutes(self):
        """
        test_APIDemos_TexturedTriangle_30minutes

        Steps:
        1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Textured Triangle" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Textured Triangle" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze."""
        self.apidemo.run_textured_triangle(count=1, step_time=60)

    def test_APIDemos_TouchRotate_30minutes(self):
        """
        test_APIDemos_TouchRotate_30minutes

        Steps:
        1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Touch Rotate" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Launch API Demo app and enter into "Graphics -> OpenGL ES". Test "Touch Rotate" for 30 minutes
        No error or crash occurs. Display is always correct no artifcat or freeze."""
        self.apidemo.run_touch_rotate(count=1, step_time=60)
class ScreenCastingIdleTest(ChromeCastTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(ScreenCastingIdleTest, cls).setUpClass()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(ScreenCastingIdleTest, 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.systemui = SystemUiExtendImpl()

        self.chrome_cast.setup()

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

    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)
        super(ScreenCastingIdleTest, self).tearDown()

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

    def test_ScreenCasting_Idle20minutes(self):
        """
        test_ScreenCasting_Idle20minutes

        Steps:
        1. Turn on Chromecast on DUT.
                The Chromecast is shown on the scan list.
        2. Connect to the Chromecast.
                The DUT is connected to the Chromecast.
        3. Press Home button.
                The Home screen is shown.
        4. Idle 20 minutes.
                The connection is not lost.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Turn on Chromecast 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. Press Home button.
                    The Home screen is shown."""
        self.d.press.home()
        print self.systemui.get_current_focus()

        print """[Step] 4. Idle 20 minutes.
                    The connection is not lost."""
        self.chrome_cast.watch_connection_status(count=20, step=60)
        self.chrome_cast.verify_connection_from_quick_settings(self.cast_model)

        self.chrome_cast.resume()
        self.chrome_cast.disconnect_cast_screen()
Ejemplo n.º 27
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()
Ejemplo n.º 28
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()
Ejemplo n.º 29
0
class DisplayAllAppsOnHomeScreen(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(DisplayAllAppsOnHomeScreen, cls).setUpClass()
        cls.d = g_common_obj.get_device()
        g_common_obj.root_on_device()
        g_common_obj.remount_device()
        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')
        # Change to photoGrid app since meitupic is not support for x86 cpu
        cfg_picasatool = config.read(cfg_file, 'content_photogrid')
        arti = Artifactory(cfg_arti.get('location'))
        binary_name = cfg_picasatool.get("name")
        file_path = arti.get(binary_name)
        print "[Setup]: install photogrid"
        result = config_handle.check_apps("com.roidapp.photogrid")
        if result == 0:
            g_common_obj.adb_cmd_common('install ' + file_path)

        cfg_picsart = config.read(cfg_file, 'content_picsart')
        arti = Artifactory(cfg_arti.get('location'))
        binary_name = cfg_picsart.get("name")
        file_path = arti.get(binary_name)
        print "[Setup]: install picsart"
        result = config_handle.check_apps("com.picsart.studio")
        if result == 0:
            g_common_obj.adb_cmd_common('install ' + file_path)

        cfg_picsay = config.read(cfg_file, 'content_picsay')
        arti = Artifactory(cfg_arti.get('location'))
        binary_name = cfg_picsay.get("name")
        file_path = arti.get(binary_name)
        print "[Setup]: install picsay"
        result = config_handle.check_apps("com.shinycore.picsayfree")
        if result == 0:
            g_common_obj.adb_cmd_common('install ' + file_path)

        cfg_sketchbook = config.read(cfg_file, 'content_sketchbook')
        arti = Artifactory(cfg_arti.get('location'))
        binary_name = cfg_sketchbook.get("name")
        file_path = arti.get(binary_name)
        print "[Setup]: install sketchbook"
        result = config_handle.check_apps("com.adsk.sketchbookhdexpress")
        if result == 0:
            g_common_obj.adb_cmd_common('install ' + file_path)

        cfg_skitch = config.read(cfg_file, 'content_skitch')
        arti = Artifactory(cfg_arti.get('location'))
        binary_name = cfg_skitch.get("name")
        file_path = arti.get(binary_name)
        print "[Setup]: install skitch"
        result = config_handle.check_apps("com.evernote.skitch")
        if result == 0:
            g_common_obj.adb_cmd_common('install ' + file_path)

    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 tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        super(DisplayAllAppsOnHomeScreen, self).tearDown()
        # self.meitu_impl.uninstall_app()
        PhotoGridEdit().uninstall_app()
        PicsArtStudio().uninstall_app()
        PicSay().uninstall_app()
        SketchBookX().uninstall_app()
        Skitch().uninstall_app()

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

    def test_Display_AllAppsOnHomeScreen(self):
        """
        test_Display_AllAppsOnHomeScreen
        """
        # self.meitu_impl.launch_app_am()
        PhotoGridEdit().launch_app_am()
        app_pid = g_common_obj.adb_cmd_capture_msg(
            "ps | grep '%s' |awk '{print $2}'" % (PhotoGridEdit().pkg_name))

        for i in range(6):
            time.sleep(5)
            _, activity = self.systemui.get_current_focus()
            if not activity == '':
                break
        assert activity == PhotoGridEdit(
        ).activity_name, "Check MeituPicEdit launch fail"

        fatal_msg = logcat.get_device_log(self.mark_time,
                                          filters='*:F',
                                          pid=app_pid)
        assert len(
            fatal_msg) == 0, "occurred Fatal error during testing:\n%s" % (
                fatal_msg)

        PhotoGridEdit().stop_app_am()
        time.sleep(2)

        PicsArtStudio().launch_app_am()
        _, activity = self.systemui.get_current_focus()
        assert activity == PicsArtStudio(
        ).activity_name, "Check PicsArtStudio launch fail"
        #         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)
        PicsArtStudio().stop_app_am()
        time.sleep(2)

        PicSay().launch_app_am()
        _, activity = self.systemui.get_current_focus()
        assert activity == PicSay().activity_name, "Check PicSay launch fail"

        fatal_msg = logcat.get_device_log(self.mark_time,
                                          filters='*:F',
                                          pid=app_pid)
        assert len(
            fatal_msg) == 0, "occurred Fatal error during testing:\n%s" % (
                fatal_msg)

        PicSay().stop_app_am()
        time.sleep(2)

        SketchBookX().launch_app_am()
        _, activity = self.systemui.get_current_focus()
        assert activity == SketchBookX(
        ).activity_name, "Check SketchBookX launch fail"
        #         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)
        SketchBookX().stop_app_am()
        time.sleep(2)

        Skitch().launch_app_am()
        _, activity = self.systemui.get_current_focus()
        assert activity == Skitch().activity_name, "Check Skitch launch fail"
        #         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)
        Skitch().stop_app_am()
        time.sleep(2)