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 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 checkProvision(self): self.case_name = sys._getframe().f_back.f_code.co_name logger.debug("case_name=%s" % self.case_name) self.appPrepare(0) if "false" == self.cfg.get("test"): logger.debug("Case %s is skip auto test!" % self.case_name) return num = self.getDeviceTypeMapNum() if num == 1: g_common_obj.root_on_device() self.disableVerityDUT() adb.reboot_device() self.wait_boot_completed() g_common_obj.root_on_device() self.remountDUT() time.sleep(3) bin_src_path = self.getDeviceTypeMapCfg().get("%s_bin_src_path" % (num)) bin_dst_path = self.getDeviceTypeMapCfg().get("%s_bin_src_path" % (num)) bin_src_path = self.multimedia_setting.download_file_to_host( bin_src_path) bin_src_folder = os.path.split(bin_src_path)[0] bin_dst_filename = os.path.split(bin_dst_path)[1] unzip_cmd = self.getDeviceTypeMapCfg().get("unzip_command") self.executeCommandWithPopen(unzip_cmd % (bin_src_path, bin_src_folder)) bin_src_path = os.path.join(bin_src_folder, bin_dst_filename) bin_dst_path = self.multimedia_setting.push_file_to_dut( bin_src_path, bin_dst_path) tools_src_path = self.getDeviceTypeMapCfg().get("%s_tool_src_path" % (num)) tools_dst_path = self.getDeviceTypeMapCfg().get("%s_tool_dst_path" % (num)) tools_dst_path = self.multimedia_setting.push_file_new( tools_src_path, tools_dst_path) g_common_obj.adb_cmd_capture_msg("chmod 777 %s" % tools_dst_path) time.sleep(5) i = 1 while "%s_execute_command_%s" % (num, i) in self.getDeviceTypeMapCfg(): cmd = self.getDeviceTypeMapCfg().get("%s_execute_command_%s" % (num, i)) fdp = self.executeCommandWithPopen(cmd) time.sleep(3) stdout_log = fdp.stdout.read() assert "cannot" not in stdout_log and "error" not in stdout_log and "fail" not in stdout_log and "not found" not in stdout_log, "(%s) cmd error: %s" % ( cmd, stdout_log) i += 1 logger.debug("Case %s is pass!" % self.case_name)
def checkVideoPlayBackWithWidevineWithReboot(self, t_time): self.case_name = sys._getframe().f_back.f_code.co_name self.appPrepare() self.launchWidevineApp() self.widevineVideoPlayBack() time.sleep(20) assert not self.d( textContains="can't").exists, "video playback failed!" for _ in range(t_time): adb.reboot_device() self.wait_boot_completed() time.sleep(20) self.launchWidevineApp() self.widevineVideoPlayBack() time.sleep(20) assert not self.d( textContains="can't").exists, "video playback failed!"
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 reboot_device(): """ reboot the device """ g_common_obj.reboot_device() time.sleep(40)