def imageViewWithReboot(self, case_name, flag=1): print "run case is " + str(case_name) self.appPrepare(case_name) path = self.video.cfg.get("push_picture").split(" ")[-1].strip("\"") logger.debug(self.tag + "path:" + path) if flag != 1: self.multimedia_setting.push_file( self.video.cfg.get("push_picture_2"), self.video.cfg.get("datapath")) self.launchPhotoAPP() self.enterPhotoPath(path) self.checkPictureExist(os.path.split(path)[1]) adb.reboot_device() self.wait_boot_completed() time.sleep(20) if self.d(textContains="Drive safely").exists: logger.debug(self.tag + "Drive saftely exist , click owner") self.d(text="Owner").click() time.sleep(3) self.lock = SystemUI() self.lock.unlock_screen() self.launchPhotoAPP() self.enterPhotoPath(path) self.checkPictureExist(os.path.split(path)[1]) if flag != 1: self.d(className="android.widget.ImageView").swipe.left() path_2 = self.video.cfg.get("push_picture_2").split(" ")[-1].strip( "\"") self.checkPictureExist(os.path.split(path_2)[1]) print "case " + str(case_name) + " is pass"
def interuptionStreamingVideoPlayBack(self, case_name): print "run case is " + str(case_name) self.appPrepare(case_name, 2) self.multimedia_handle.launchVideoApp() time.sleep(2) self.streamingVideoPlayBack() self.checkVideoPlayBack() time.sleep(1) hardware = self.multimedia_setting.get_paltform_hardware() if 'bxtp_abl' or 'gordon_peak' in hardware: # For BXT use relay card press power to sleep self.multimedia_setting.pressPowerKey() time.sleep(10) self.multimedia_setting.pressPowerKey() # elif 'gordon_peak' in hardware: # self.logger.error("Case failed due OAM-48191: adb lost in host when resume from S3") # assert False, "case " + str(case_name) + " is Fail" else: self.d.press.power() time.sleep(2) self.d.press.power() self.lock = SystemUI() self.lock.unlock_screen() time.sleep(1) self.checkVideoPlayBack() print "case " + str(case_name) + " is pass"
def switch_back_home_serveraltimes(self, switch_times=20): SystemUI().unlock_screen() for x in range(switch_times): self.launch_app_am() self._device.screen.on() self._device.press("menu") self._device.press.home() self._device.wait.idle()
def launchRecordAPP(self): SystemUI().unlock_screen() for _ in range(3): g_common_obj.launch_app_am("com.intel.vpg.tool", \ "com.intel.vpg.tool.ConfActivity") time.sleep(3) if self.d(textContains="Vpg Media Tool").exists: return assert self.d(textContains="Vpg Media Tool").exists, "launch record app failed!"
def test_video_playback_with_sleep_mode(self, mode=""): self.exoplayerPlayBack(mode) time.sleep(20) self.checkVideoPlayback(10) self.d.press.power() time.sleep(5) self.d.press.power() SystemUI().unlock_screen() self.checkVideoPlayback(20)
def launchPhotoAPP(self): SystemUI().unlock_screen() for _ in range(3): g_common_obj.launch_app_am("com.intel.otc.instrument.otcphotos", \ "com.intel.otc.instrument.otcphotos.MainActivity") time.sleep(3) if self.d(textContains="/").exists: return assert self.d(textContains="/").exists, "launch photo app failed!"
def launchFFmpeg(self): SystemUI().unlock_screen() for _ in range(3): g_common_obj.launch_app_am("com.silentlexx.ffmpeggui", ".Gui") time.sleep(2) if self.d(textContains="Allow FFmpeg Media Encoder to access photo").exists: self.d(resourceId="com.android.packageinstaller:id/permission_allow_button").click() if self.d(text="FFmpeg Media Encoder").exists: return assert self.d(text="FFmpeg Media Encoder").exists, "launch FFmpeg app failed!"
def launchFFmpegCLI(self): SystemUI().unlock_screen() for _ in range(3): g_common_obj.launch_app_am("org.magiclen.ffmpeg.cli", ".activities.CommandActivity") time.sleep(2) if self.d(textContains="Allow FFmpeg CLI to access").exists: self.d(resourceId="com.android.packageinstaller:id/permission_allow_button").click() if self.d(text="FFmpeg CLI").exists: logger.debug(self.tag + "launch FFmpeg CLI app success!") return assert self.d(text="FFmpeg CLI").exists, "launch FFmpeg CLI app failed!"
def launchWidevineApp(self): SystemUI().unlock_screen() # g_common_obj.stop_app_am(self.widevine_package_name) g_common_obj.launch_app_am(self.widevine_package_name, self.widevine_activity_name) time.sleep(5) for _ in range(5): if self.d(textContains="Downloads").exists: return time.sleep(5) assert self.d( textContains="Downloads").exists, "launch Winevine App failed!"
def launchEXOPlayerApp(self): SystemUI().unlock_screen() # g_common_obj.stop_app_am(self.widevine_package_name) g_common_obj.launch_app_am(self.exoplayer_package_name, self.exoplayer_activity_name) time.sleep(5) for _ in range(5): if self.d(textContains="ExoPlayer Demo").exists: return time.sleep(5) assert self.d(textContains="ExoPlayer Demo" ).exists, "launch Exoplayer App failed!"
def testStreamingVideoPlayBackWithPowerOff(self, case_name): print "run case is " + str(case_name) self.appPrepare(case_name, 2) self.multimedia_handle.launchVideoApp() time.sleep(2) self.streamingVideoPlayBack() self.checkVideoPlayBack() adb.reboot_device() self.wait_boot_completed() time.sleep(20) self.lock = SystemUI() self.lock.unlock_screen() print "case " + str(case_name) + " is pass"
def launch4KEncode(self): """ A method to launch testEncodeAndMux_4K_Encode.apk :return: True, launch success. """ SystemUI().unlock_screen() for _ in range(3): g_common_obj.launch_app_am("com.intel.mchen33.testencodeandmux", ".MainActivity") time.sleep(1) if self.d(text="testEncodeAndMux").exists: logger.debug(self.tag + "launch testEncodeAndMux_4K_Encode app success!") return True assert self.d(text="testEncodeAndMux").exists, "launch testEncodeAndMux_4K_Encode app failed!"
def run_benchmark(self): ''' run_benchmark ''' SystemUI().unlock_screen() g_common_obj.launch_app_am(self.pkg_name, self.activity_name) self._device().scroll.vert.to(text="Benchmark All") if self._device(resourceId="com.android.rs.image:id/benchmarkText" ).text.endswith("not run"): self._device(textContains="Benchmark", className="android.widget.Button").click() self._device.wait.update() print "[Info:] benchmark has a " + self._device( resourceId="com.android.rs.image:id/benchmarkText").text
def appPrepare(self, model=1): self.cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \ 'tests.tablet.mum_auto_drm.conf') self.cfg = self.config.read(self.cfg_file, self.case_name) self.multimedia_setting = MultiMediaSetting(self.cfg_file) self.multimedia_drm_helper = MultiMediaDRMHelper() self.multimedia_video_quality_helper = MultiMediaVideoQualityHelper() self.multimedia_setting.install_apk("netflix_apk") self.netflix_package_name, self.netflix_activity_name = self.multimedia_setting.get_package_and_activity_name("netflix_apk") # g_common_obj.set_vertical_screen() g_common_obj.stop_app_am(self.netflix_package_name) SystemUI().unlock_screen()
def test_video_playback_with_sleep_mode(self): self.clickNetflixMenu() self.netflixPlayBack() self.checkVideoPlayback(40, 1) ct, tt = self.get_play_time() if tt - ct <= 300: self.set_play_time(0.01) self.checkVideoPlayback(30, 1) self.click_button("pause") self.d.press.power() time.sleep(10) self.d.press.power() SystemUI().unlock_screen() time.sleep(5) self.click_button("play") self.checkVideoPlayback(20)
def hw_accelerated(self, message): """ @summary: search the message from log @parameter: message : the message searched @return: True or False """ SystemUI().unlock_screen() g_common_obj.launch_app_am(self.pkg_name, self.activity_name) cmd = "adb logcat -d|grep \"%s\"" % message pipe = os.popen(cmd).read().strip() if len(pipe) == 0: print("Search %s is None" % message) return False print("INFO:%s" + pipe) return True
def launchNetflixApp(self): SystemUI().unlock_screen() for _ in range(2): g_common_obj.launch_app_am(self.netflix_package_name, self.netflix_activity_name) time.sleep(5) for _ in range(6): if self.d(description="Search").exists: return if self.d(textContains="New version of application").exists: time.sleep(2) self.d(textContains="Cancel").click(2) if self.d(textContains="Sign In").exists or self.d(description="Choose a Credential").exists: self.registerNetflix() time.sleep(5) if self.d(description="test").exists: self.d(description="test").click(3) if self.d(textContains="Notifications may include newly-added movi").exists: self.d(textContains="No Thanks").click(2) assert self.d(description="Search").exists, "launch Netflix App failed!"
def test_video_playback_with_check_S0I3(self): self.case_name = sys._getframe().f_back.f_code.co_name self.appPrepare() after_S0I3_str = self.multimedia_setting.getS0I3() self.launchEXOPlayerApp() self.exoplayerPlayBack() time.sleep(20) self.checkVideoPlayback(10) self.d.press.power() logger.debug("Step: sleep 800s, please wait...") time.sleep(800) logger.debug("Step: sleep 800s, complete!") self.d.press.power() SystemUI().unlock_screen() self.d.press.back() self.d.press.home() before_S0I3_str = self.multimedia_setting.getS0I3() assert after_S0I3_str != before_S0I3_str, "after_S0I3_str=%s, before_S0I3_str=%s" % ( after_S0I3_str, before_S0I3_str)
def test_video_playback_with_reboot(self, t_time): self.case_name = sys._getframe().f_back.f_code.co_name self.appPrepare() self.launchEXOPlayerApp() self.exoplayerPlayBack() time.sleep(20) self.checkVideoPlayback(10) for _ in range(t_time): adb.reboot_device() self.wait_boot_completed() time.sleep(20) self.lock = SystemUI() self.lock.unlock_screen() self.launchEXOPlayerApp() self.exoplayerPlayBack() time.sleep(20) self.checkVideoPlayback(10) self.d.press.back() self.d.press.home()
def test_video_playback_with_check_S0I3(self): self.case_name = sys._getframe().f_back.f_code.co_name self.appPrepare() after_S0I3_str = self.multimedia_setting.getS0I3() self.launchWidevineApp() self.widevineVideoPlayBack() time.sleep(10) assert not self.d( textContains="can't").exists, "video playback failed!" self.d.press.power() logger.debug("Step: sleep 800s, please wait...") time.sleep(800) logger.debug("Step: sleep 800s, complete!") self.d.press.power() SystemUI().unlock_screen() self.d.press.back() self.d.press.home() before_S0I3_str = self.multimedia_setting.getS0I3() assert after_S0I3_str != before_S0I3_str, "after_S0I3_str=%s, before_S0I3_str=%s" % ( after_S0I3_str, before_S0I3_str)
def imageViewCheckWithUnlock(self, case_name): print "run case is " + str(case_name) self.appPrepare(case_name) path = self.video.cfg.get("push_picture").split(" ")[-1].strip("\"") print path self.launchPhotoAPP() self.enterPhotoPath(path) self.checkPictureExist(os.path.split(path)[1]) if 'bxtp_abl' in self.multimedia_setting.get_paltform_hardware(): # For BXT use relay card press power to sleep self.multimedia_setting.pressPowerKey() time.sleep(10) self.multimedia_setting.pressPowerKey() else: self.d.press.power() time.sleep(2) self.d.press.power() self.lock = SystemUI() self.lock.unlock_screen() time.sleep(1) self.checkPictureExist(os.path.split(path)[1]) print "case " + str(case_name) + " is pass"
def setUp(self): super(TestBackLight, self).setUp() self.systemui = SystemUI()
def test_Switch_Camera(self): SystemUI().unlock_screen() self._demoInstance.switch_camera_preview()
def setUp(self): super(Volume, self).setUp() self._test_name = __name__ print print "[Setup]: %s" % self._test_name self.systemui = SystemUI()