def play_video(self, secs=None, timeout=None): """click play video""" print "[Debug] play_video" mark_time = logcat.get_device_time_mark() pre_dump = self.d.dump() pre_focus = SystemUi.get_current_focus() print pre_focus self._view.play.click.wait() if secs: time.sleep(secs) end_dump = self.d.dump() end_focus = SystemUi.get_current_focus() print end_focus seq_match = difflib.SequenceMatcher(None, pre_dump, end_dump) ratio = round(seq_match.ratio(), 2) * 100 print "ratio:%s" % ratio if ratio == 100 and pre_focus == end_focus: assert False, "[FAILURE] Play video No any reply" if not secs: start_time = time.time() play_done = False while time.time() - start_time < timeout: time.sleep(10) if self._view.play.exists: play_done = True break assert play_done, "[FAILURE] Play video time out" errmsg = logcat.get_device_log(mark_time, filters='MediaPlayer:E *:S') assert not errmsg, "[FAILURE] Found Errors in Logcat during Play Video\n%s" % ( errmsg)
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'
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"
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 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()
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()
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 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()
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()
def setUp(self): print "[Setup]:%s" % self.__class__.__name__ super(DisplayAllAppsOnHomeScreen, self).setUp() self.systemui = SystemUiExtendImpl() # self.meitu_impl = MeituPicEdit() self.systemui.unlock_screen() self.d.screen.on() self.d.press.menu() self.mark_time = logcat.get_device_time_mark()
def setUp(self): print "[Setup]:%s" % self.__class__.__name__ super(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 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 set_environment(self): """ init the test environment """ self.systemui = SystemUiExtendImpl() self.camera = CameraExtendImpl() config = TestConfig() cfg_file = 'tests.tablet.chromecast.conf' cfg_cast = config.read(cfg_file, 'chromecast_device') self.nexus_device = cfg_cast.get("device") self.nexus_name = cfg_cast.get("name") cmd = "-s %s logcat -d -c" % self.nexus_device g_common_obj.adb_cmd_common(cmd) print "[clear log]"
def 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 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 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()
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"
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 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 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 setUp(self): print "[Setup]:%s" % self.__class__.__name__ super(GFXBenchGLHighLevelTestManhattanES31Test, self).setUp() self.systemui = SystemUiExtendImpl() self.gfxbench = Gfxbench31Impl() 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 setUp(self): print "[Setup]:%s" % self.__class__.__name__ super(VsyncFPSTool, self).setUp() self.tmpdir = getTmpDir() self.systemui = SystemUiExtendImpl() self.benchmark = GLBenchmarkExtendImpl() self._glBenchmark = GLBenchmarkImpl()
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()
def setUp(self): print "[Setup]:%s" % self.__class__.__name__ super(TouchScreenDuringDUTDimTest, self).setUp() self.mark_time = logcat.get_device_time_mark() self.sys_setting = SystemSettingsImpl() self.systemui = SystemUiExtendImpl() self.dumpsys = DumpSysImpl() self.systemui.unlock_screen() self.d.screen.on() self.sleep_time = 15 self.org_screen_brightness =\ self.sys_setting.get_system_setting('screen_brightness') self.org_screen_off_timeout = \ self.sys_setting.get_system_setting('screen_off_timeout')
def setUp(self): print "[Setup]:%s" % self.__class__.__name__ super(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()
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)
def test_ImageEdit_AddVignetteEffect_BlueImageEditingAndSwitching(self): from testlib.graphics.extend_systemui_impl import SystemUiExtendImpl print "[RunTest]: %s" % self.__str__() self.photosImpl.deploy_photo_content("Pictures", "picture_blue", self.PHOTO_PATH) self.photosImpl.refresh_sdcard() settings_pkgName = "com.android.settings" g_common_obj.adb_cmd_capture_msg( "am start %s" % settings_pkgName) # launch settings app previously self.photosImpl.launch_photos_am() self.photosImpl.open_a_picture() self.photosImpl.change_display_effect(effType='Vignette', effVol=100) SystemUiExtendImpl().switch_recent_app(name='Settings') SystemUiExtendImpl().switch_recent_app(name='Photos') time.sleep(2) self.photosImpl.save_changes() assert self.photosImpl.check_saved_pic_result(picPath=self.PHOTO_PATH) >= self.ACCEPTABLE_VALUE, \ "Failed! No effects on the saving pic."
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'
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."
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()