Exemple #1
0
class ExoPlayerTest(UIATestBase):
    """
    @summary: Test Widevine
    """

    config = TestConfig()

    def setUp(self):
        """
        @summary: set up
        @return: None
        """
        super(ExoPlayerTest, self).setUp()
        self.d = g_common_obj.get_device()
        self._test_name = __name__
        self.playback_state_str = "playbackState"
        self.video_button_index_dict = {
            "Paused": 1,
            "Play": 1,
            "Forward": 2,
            "Backward": 0
        }

        print "[Setup]: %s" % self._test_name

    def tearDown(self):
        """
        @summary: tear tearDown
        @return: None
        """
        super(ExoPlayerTest, self).tearDown()
        print "[Teardown]: %s" % self._test_name
        g_common_obj.stop_exp_handle()

    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)  # read config file

        self.multimedia_setting = MultiMediaSetting(self.cfg_file)
        self.multimedia_drm_helper = MultiMediaDRMHelper()
        self.multimedia_video_quality_helper = MultiMediaVideoQualityHelper()

        self.multimedia_setting.install_apk(
            "exoplayer_apk")  #install exoplayer apk
        self.exoplayer_package_name, self.exoplayer_activity_name = self.multimedia_setting.get_package_and_activity_name(
            "exoplayer_apk")  #get app info

        #         g_common_obj.set_vertical_screen()
        g_common_obj.stop_app_am(self.exoplayer_package_name)
        g_common_obj.adb_cmd_capture_msg("input keyevent 82")  #Unlock screen

    def clickScreen(self):
        self.multimedia_setting.clickScreen()

    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 get_playback_state_pattern(self):
        if "playback_state_pattern" not in dir(self):
            GET_PLAYBACKSTATE_PATTERN = "playbackState=(.*)"
            self.playback_state_pattern = re.compile(GET_PLAYBACKSTATE_PATTERN)
        return self.playback_state_pattern

    def getPlaybackState(self):
        playback_state_str = self.playback_state_str
        for _ in range(3):
            if not self.d(textContains=playback_state_str).exists:
                self.clickScreen()
            time.sleep(1)
        assert self.d(textContains=playback_state_str
                      ).exists, "playbackState not exist! please check it!"
        status = self.d(textContains=playback_state_str).text
        logger.debug("all_status=%s" % status)
        playback_state_pattern = self.get_playback_state_pattern()
        playback_state = playback_state_pattern.findall(status)
        logger.debug("playback_state=%s" % str(playback_state))
        return playback_state[0]

    def checkPlaybackState(self):
        for _ in range(5):
            playback_state = self.getPlaybackState()
            if playback_state == "ready":
                return 0
            time.sleep(5)
        assert 0, "Error! playback_state=%s" % playback_state

    def clickVideoButton(self, t_str):
        logger.debug("clickVideoButton---t_str=%s" % t_str)
        assert t_str in self.video_button_index_dict, "%s not in video_button_index_dict!" % t_str
        t_index = self.video_button_index_dict[t_str]
        if not self.d(className="android.widget.ImageButton",
                      index=t_index).exists:
            self.clickScreen()
        self.d(className="android.widget.ImageButton", index=t_index).click()

    def wait_boot_completed(self, timeout=1000):
        ''' wait Android boot_completed
    
        args: timeout -- optional timeout in second, default 180s
        '''
        count = 0
        sleep_time = 5
        while count < timeout:
            prop_val = adb.adb_cmd_capture_msg('getprop sys.boot_completed')
            if '1' in prop_val:
                print 'boot_completed'
                return
            count += sleep_time
            time.sleep(sleep_time)
        raise Exception('%ds timeout waiting for boot_completed' % timeout)

    def clickRetryButton(self):
        retry_str = "Retry"
        if not self.d(text=retry_str).exists:
            self.clickScreen()
            time.sleep(3)
            if not self.d(text=retry_str).exists:
                self.clickVideoButton("Paused")
                time.sleep(1)
                self.clickVideoButton("Play")
                time.sleep(5)
        if self.d(text=retry_str).exists:
            logger.debug("Click retry button!")
            self.d(text=retry_str).click()
            time.sleep(1)
        else:
            logger.debug("Can't find retry button!")

    def clickRecentApp(self, app_name):
        self.multimedia_setting.click_recent_app(app_name)

    def checkVideoPlayback(self, t_time, expect_resolution=532):
        timeNow = time.time()
        if t_time >= 20:
            self.multimedia_video_quality_helper.checkSurfaceViewResolutionWithThread_start(
                expect_resolution)
        while time.time() - timeNow < t_time:
            playback_state = self.getPlaybackState()
            if playback_state == "end":
                logger.debug("Video playback finish!")
                break
            elif playback_state != "ready":
                logger.debug("checkVideoPlayback-- playback_state=%s" %
                             playback_state)
                self.clickRetryButton()
            time.sleep(3)
        if t_time >= 20:
            assert self.multimedia_video_quality_helper.checkSurfaceViewResolutionWithThread_stop(
            ) == 1, "Looks like Video didn't reach HD(%d)..." % expect_resolution

    def exoplayerPlayBack(self, mode=""):
        if mode == "":
            mode = "WV: Secure video path required"
        elif mode == "HDCP":
            mode = "WV: HDCP + secure video path required"
        self.d(scrollable=True).scroll.vert.to(text=mode)
        self.d(text=mode).click()
        time.sleep(5)
        self.checkPlaybackState()

    def test_video_playback(self, t_time=60, mode="", expect_resolution=532):
        self.exoplayerPlayBack(mode)  # play video with exoplayer app
        time.sleep(20)
        self.checkVideoPlayback(
            t_time, expect_resolution)  # check play status of video

    def test_video_playback_with_pause(self, t_time=60):
        self.exoplayerPlayBack()  # play video with exoplayer app
        time.sleep(20)
        self.checkVideoPlayback(20)
        self.clickVideoButton("Paused")  #click paused button
        time.sleep(t_time)
        self.clickVideoButton("Play")  #click play button
        self.checkVideoPlayback(20)  # check play status of video

    def test_video_playback_with_control(self):
        self.exoplayerPlayBack()
        time.sleep(20)
        self.checkVideoPlayback(20)
        self.clickVideoButton("Paused")
        time.sleep(5)
        self.clickVideoButton("Play")
        time.sleep(5)
        self.clickVideoButton("Forward")
        time.sleep(5)
        self.clickVideoButton("Backward")
        time.sleep(10)

    def test_video_playback_with_repeatedly(self, click_list, t_time, mode=""):
        self.exoplayerPlayBack(mode)
        time.sleep(10)
        self.checkVideoPlayback(20)
        for i in range(t_time):
            logger.debug("clickVideoButton---%d time" % i)
            for t_str in click_list:
                self.clickVideoButton(t_str)
                time.sleep(2)
        time.sleep(5)

    def test_video_playback_with_background(self):
        self.exoplayerPlayBack()
        time.sleep(20)
        self.checkVideoPlayback(20)
        self.clickVideoButton("Paused")
        time.sleep(5)
        self.clickVideoButton("Play")
        time.sleep(5)
        self.d.press.home()
        time.sleep(3)
        self.clickRecentApp("ExoPlayer Demo")

    def test_video_playback_with_swipe(self, t_time, percent, mode=""):
        self.exoplayerPlayBack(mode)
        time.sleep(20)
        self.checkVideoPlayback(t_time)
        self.multimedia_setting.set_play_time(percent)
        self.checkVideoPlayback(20)

    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 test_video_playback_with_orientation(self,
                                             orientation_list,
                                             t_time,
                                             mode=""):
        self.exoplayerPlayBack(mode)
        time.sleep(10)

        self.checkVideoPlayback(20)
        for i in range(t_time):
            logger.debug("change orientation---%d time" % i)
            for t_str in orientation_list:
                self.d.orientation = t_str
                time.sleep(5)
        self.d.freeze_rotation(False)
        time.sleep(5)

    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.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_check_log(self,
                                           mode="",
                                           check_str="CopyBuffer"):
        self.multimedia_setting.clearLogs()
        self.multimedia_setting.checkLogs_start(check_str)
        self.exoplayerPlayBack(mode)
        time.sleep(20)
        self.checkVideoPlayback(20)
        self.multimedia_setting.checkLogs_end(check_str)

    def test_video_playback_with_pause_1hour(self, delay_time=3600):
        '''

        This test used to pause play 1 hours and resume
        test cases spec is following:
        1.pause palying video
        2.stop record video
        3.resume video
        4.start record the second video

        '''
        self.exoplayerPlayBack()
        time.sleep(20)
        self.clickVideoButton("Paused")
        self.multimedia_drm_helper.stopRecord()
        logger.debug("Step: sleep 1 hours, please wait...")
        time.sleep(delay_time)
        self.multimedia_drm_helper.startRecord(self.case_name + '_2')
        time.sleep(10)
        self.clickVideoButton("Paused")
        time.sleep(5)
        self.checkVideoPlayback(20)

    def exoplayer_main_test(self, sub_func_name="", *arg, **keywords):
        """
        This test used to test Exoplayer App
        The test case spec is following:
        1. Start record video
        2. do sub_func()
        3. Stop record video
        """
        self.case_name = sys._getframe().f_back.f_code.co_name
        if sub_func_name == "":
            sub_func_name = "%s_sub_func" % self.case_name
        logger.debug("case_name=%s" % self.case_name)
        logger.debug("exoplayer_main_test---sub_func_name=%s" % sub_func_name)
        self.appPrepare()
        try:
            self.multimedia_drm_helper.startRecord(
                self.case_name)  #start record
            self.launchEXOPlayerApp()  #launch exoplayer app

            logger.debug("Arbitrary parameter is %s" % str(arg))
            logger.debug("keywords parameter is %s" % str(keywords))
            getattr(self, sub_func_name)(*arg, **keywords)

            time.sleep(10)
            self.d.press.back()
            self.d.press.home()
            time.sleep(1)
            self.multimedia_drm_helper.stopRecord()  #stop record
        except Exception as e:
            self.multimedia_drm_helper.stopRecord()
            assert 0, e

        assert 0, "Playback complete! Please check video!"
        logger.debug("Case %s is pass!" % self.case_name)

    def testWVModular_Exoplayer_Display(self):
        self.exoplayer_main_test("test_video_playback", 20)

    def testWVModular_Exoplayer_Video_Playback(self):
        self.exoplayer_main_test("test_video_playback", 20)

    def testWVModualr_Exoplayer_Audio_Video_Synchronization(self):
        self.exoplayer_main_test("test_video_playback", 20)

    def testWVModular_Exoplayer_Play(self):
        self.exoplayer_main_test("test_video_playback", 20)

    def testWVModular_Exoplayer_End(self):
        self.exoplayer_main_test("test_video_playback", 600)

    def testWVModular_Exoplayer_Secure_HD_MP4_H264(self):
        self.exoplayer_main_test("test_video_playback", 20,
                                 "WV: Secure HD (MP4,H264)", 500)

    def testWVModular_ExoPlayer_Control(self):
        self.exoplayer_main_test("test_video_playback_with_control")

    def testWVModular_Exoplayer_Pause_Play_Repeatedly(self):
        self.exoplayer_main_test("test_video_playback_with_repeatedly",
                                 ["Paused", "Play"], 20)

    def testWVModular_Exoplayer_Forward_Rewind_Repeatedly(self):
        self.exoplayer_main_test("test_video_playback_with_repeatedly",
                                 ["Forward", "Backward"], 20)

    def testWVModular_Exoplayer_Forward_Rewind_Paused(self):
        self.exoplayer_main_test("test_video_playback_with_repeatedly",
                                 ["Paused", "Forward", "Backward", "Play"], 1)

    def testWVModular_Exoplayer_Forward_Rewind(self):
        self.exoplayer_main_test("test_video_playback_with_repeatedly",
                                 ["Forward", "Backward"], 1)

    def testWVModular_Exoplayer_Rewind_Less_10s(self):
        self.exoplayer_main_test("test_video_playback_with_repeatedly",
                                 ["Forward", "Backward"], 1, "HDCP")

    def testWVModular_Exoplayer_Pause_One_Minute(self):
        self.exoplayer_main_test("test_video_playback_with_pause")

    def testWVModular_Exoplayer_Resume_Background(self):
        self.exoplayer_main_test("test_video_playback_with_background")

    def testRewind_WVModular_Exoplayer(self):
        self.exoplayer_main_test("test_video_playback_with_swipe", 10, 0.01)

    def testWVModular_Exoplayer_Forward_Till_End(self):
        self.exoplayer_main_test("test_video_playback_with_swipe", 10, 0.98)

    def testWVModular_Exoplayer_Sleep_Paused(self):
        self.exoplayer_main_test("test_video_playback_with_sleep_mode")

    def testWVModular_Exoplayer_Power_Button(self):
        self.exoplayer_main_test("test_video_playback_with_sleep_mode", "HDCP")

    def testWVModular_Exoplayer_Changeorientation(self):
        self.exoplayer_main_test("test_video_playback_with_orientation",
                                 ["l", "r", "n", "l"], 1, "HDCP")

    def testWVModular_Verify_WV10_Copy_Buffer(self):
        self.exoplayer_main_test("test_video_playback_with_check_log", "HDCP",
                                 "CopyBuffer")

    def testWVModular_HDCP_Capability(self):
        self.exoplayer_main_test("test_video_playback_with_check_log", "HDCP",
                                 "GetHDCPCapability")

    def testWVClassic_Reboot_Multi_Times(self):
        self.test_video_playback_with_reboot(20)

    def testWVModular_Exoplayer_Resume_S0i3(self):
        self.test_video_playback_with_check_S0I3()

    def testWVModular_Resume_1hour_Paused(self):
        self.exoplayer_main_test("test_video_playback_with_pause_1hour",
                                 delay_time=3600)
class VideoPlayBack(TestCaseBase):
    """
    @summary: Test Video PlayBack
    """
    def setUp(self):
        """
        @summary: set up
        @return: None
        """
        super(VideoPlayBack, self).setUp()
        self.d = g_common_obj.get_device()
        self._test_name = __name__
        self.x = self.d.info["displayWidth"]
        self.y = self.d.info["displayHeight"]
        print "[Setup]: %s" % self._test_name
        g_common_obj.stop_app_am(
            "videoplayer.app.instrument.otc.intel.com.otcvideoplayer")
        # Unlock screen
        g_common_obj.adb_cmd_capture_msg("input keyevent 82")

    def tearDown(self):
        """
        @summary: tear tearDown
        @return: None
        """
        super(VideoPlayBack, self).tearDown()
        print "[Teardown]: %s" % self._test_name
        g_common_obj.stop_exp_handle()
        time.sleep(3)
        g_common_obj.stop_app_am(
            "videoplayer.app.instrument.otc.intel.com.otcvideoplayer")
        time.sleep(3)

    def appPrepare(self, case_name, model=1):
        self.cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.mum_auto_video.conf')
        self.video = PhotosImpl(\
            self.config.read(self.cfg_file, case_name))
        g_common_obj.adb_cmd_capture_msg(" rm -rf /sdcard/DCIM/Camera/*")

        self.multimedia_handle = MultiMediaHandle()
        self.multimedia_setting = MultiMediaSetting(self.cfg_file)
        self.multimedia_setting.clearFolder(self.video.cfg.get("remove_video"))
        time.sleep(2)
        if model == 1:
            self.push_path = self.multimedia_setting.push_file(
                self.video.cfg.get("push_video"),
                self.video.cfg.get("datapath"))

        self.multimedia_setting.install_apk("video_apk")
        self.multimedia_setting.install_apk("alarm_apk")

        self.video.set_orientation_n()
        # Unlock screen
        g_common_obj.adb_cmd_capture_msg("input keyevent 82")

    def getNormalWifi(self):
        conf = self.config.read('tests.tablet.dut_init.conf', 'wifisetting')
        ssid = conf.get("ssid")
        passwd = conf.get("passwd")
        security = conf.get("security")
        print ssid, passwd, security
        return ssid, passwd, security

    def getRTPWifi(self):
        rtp_wifisetting = PhotosImpl(
            self.config.read(self.cfg_file, "rtp_wifisetting"))
        ssid = rtp_wifisetting.cfg.get("ssid")
        passwd = rtp_wifisetting.cfg.get("passwd")
        security = rtp_wifisetting.cfg.get("security")
        print ssid, passwd, security
        return ssid, passwd, security

    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 wait_boot_completed(self, timeout=1000):
        ''' wait Android boot_completed
    
        args: timeout -- optional timeout in second, default 180s
        '''
        count = 0
        sleep_time = 5
        while count < timeout:
            prop_val = adb.adb_cmd_capture_msg('getprop sys.boot_completed')
            if '1' in prop_val:
                print 'boot_completed'
                return
            count += sleep_time
            time.sleep(sleep_time)
        raise Exception('%ds timeout waiting for boot_completed' % timeout)

    def clickRecordButton(self):
        self.d(className="android.widget.Button").click()

    def deleteCameraRecordFile(self):
        cmd = "shell rm /storage/emulated/legacy/Android/data/com.example.android.camera2video/files/video.mp4"
        g_common_obj.adb_cmd_common(cmd)

    def checkCameraRecordFile(self, flag=1):
        cmd = "shell ls /storage/emulated/legacy/Android/data/com.example.android.camera2video/files/video.mp4"
        result = g_common_obj.adb_cmd_common(cmd)
        assert ("No such file or directory" not in result.stdout.read()
                ) == flag, "Record file status error! Flag=%s" % (flag)

    def enterBrowseVideo(self, path):
        self.d(className="android.widget.ImageButton").click()
        time.sleep(1)
        self.d(text="Browse Video").click()
        for _ in range(10):
            if self.d(textContains="Open").exists:
                break
            time.sleep(1)
        time.sleep(3)
        self.d.press.back()
        time.sleep(1)
        if self.multimedia_setting.getcheckIputMethod() != '':
            self.d.press.back()
        self.d(className="android.widget.EditText").set_text(path)
        time.sleep(1)
        if self.multimedia_setting.getcheckIputMethod() != '':
            self.d.press.back()
        self.d(text="OK").click()
        for _ in range(5):
            if self.d(text=path).exists:
                break
            time.sleep(5)
        assert self.d(text=path).exists, "can't enter path:%s" % path

    def setTimeToSec(self, time):
        time = time.split(":")
        i = 1
        temp = 0
        for s in time[::-1]:
            temp += int(s) * i
            i *= 60
        return int(temp)

    def setRotation(self, mode):
        self.d(className="android.widget.ImageButton").click()
        time.sleep(1)
        self.d(text=mode).click()
        time.sleep(1)

    def videoPlayBack(self, push_path=""):
        if push_path == "":
            push_path = self.push_path
        return self.multimedia_handle.videoPlayBack(push_path)

    def streamingVideoPlayBack(self, path="", flag=1):
        if path == "":
            path = self.video.cfg.get("video_path")
        return self.multimedia_handle.streamingVideoPlayBack(path, flag)

    def checkVideoPlayBack(self, s=60):
        return self.multimedia_handle.checkVideoPlayBack(s)

    def checkVideoPlayBackWithComparePicture(self,
                                             stoptime,
                                             bigfileskiptime=0):
        return self.multimedia_handle.checkVideoPlayBackWithComparePicture(
            stoptime, bigfileskiptime)

    def checkVideoPlayBackComplete(self, s=900):
        return self.multimedia_handle.checkVideoPlayBackComplete(s)

    def checkVideoFileExist(self, file_name):
        assert self.d(text=file_name).exists, file_name + "file not find!"

    def deleteVideoFile(self, file_name):
        assert self.d(text=file_name).exists, file_name + "file not find!"
        self.d(text=file_name).long_click()
        time.sleep(1)
        self.d(text="Delete").click()
        time.sleep(1)
        self.d(text="Yes").click()
        time.sleep(1)
        assert not self.d(
            text=file_name).exists, file_name + "file delete failed!"

    def checkVideoDetail(self, file_name):
        assert self.d(text=file_name).exists, file_name + "file not find!"
        self.d(text=file_name).long_click()
        time.sleep(1)
        self.d(text="Detail").click()
        time.sleep(1)
        assert self.d(
            textContains=file_name).exists, file_name + "check detail failed!"

    def renameVideoFile(self, file_name, new_name):
        assert self.d(text=file_name).exists, file_name + "file not find!"
        self.d(text=file_name).long_click()
        time.sleep(1)
        self.d(text="Rename").click()
        for _ in range(10):
            if self.d(textContains="Open").exists:
                break
            time.sleep(1)
        time.sleep(3)
        if self.multimedia_setting.getcheckIputMethod() != '':
            self.d.press.back()
        self.d(className="android.widget.EditText").set_text(new_name)
        time.sleep(1)
        if self.multimedia_setting.getcheckIputMethod() != '':
            self.d.press.back()
        self.d(text="OK").click()
        time.sleep(1)
        assert self.d(
            textContains=new_name).exists, file_name + "check detail failed!"

    def interuptionVideoPlayBack(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.videoPlayBack()
        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 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 testVideoPlayBack(self, case_name):
        MultiMediaBasicTestCase().testVideoPlayBack(case_name)

    def testStreamingVideoPlayBack(self, case_name):
        MultiMediaBasicTestCase().testStreamingVideoPlayBack(case_name)

    def testRTPStreamingVideoPlayBack(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()
        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 streamingVideoPlayControlProcess(self, case_name):
        MultiMediaBasicTestCase().streamingVideoPlayControlProcessLong(
            case_name)

    def lowAndHighFramestreamingVideoPlayControlProcess(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name, 2)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.streamingVideoPlayBack()
        time.sleep(10)
        self.checkVideoPlayBack()
        self.d.press.volume_up()
        self.checkVideoPlayBack()
        self.d.press.volume_down()
        self.checkVideoPlayBack()
        self.multimedia_setting.set_play_time(0.5)
        self.checkVideoPlayBack()
        self.d(resourceId="android:id/rew").click()
        self.checkVideoPlayBack()
        #         self.d(resourceId="android:id/ffwd").click()
        #         self.checkVideoPlayBack()
        self.d(resourceId="android:id/pause").click()
        self.checkVideoPlayBack()
        self.d.press.home()
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.streamingVideoPlayBack(self.video.cfg.get("video_path_2"))
        time.sleep(10)
        self.checkVideoPlayBack()
        self.d.press.volume_up()
        self.checkVideoPlayBack()
        self.d.press.volume_down()
        self.checkVideoPlayBack()
        self.multimedia_setting.set_play_time(0.5)
        self.checkVideoPlayBack()
        self.d(resourceId="android:id/rew").click()
        self.checkVideoPlayBack()
        #         self.d(resourceId="android:id/ffwd").click()
        #         self.checkVideoPlayBack()
        self.d(resourceId="android:id/pause").click()
        self.checkVideoPlayBack()
        print "case " + str(case_name) + " is pass"

    def testVideoDurationThumbnail(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.enterBrowseVideo(os.path.split(self.push_path)[0])
        time.sleep(2)
        file_name = os.path.split(
            self.video.cfg.get("push_video"))[1].strip("\"")
        self.checkVideoFileExist(file_name)
        self.d(text=file_name).click()
        time.sleep(1)
        self.checkVideoPlayBack()
        self.d.press.back()
        if not self.d(text=os.path.split(self.push_path)[0]).exists:
            self.d.press.back()
        time.sleep(1)
        self.checkVideoFileExist(file_name)
        print "case " + str(case_name) + " is pass"

    def testStreamingVideoDurationThumbnail(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()
        self.d.press.back()
        assert self.d(text="OtcVideoPlayer").exists, "launch video app failed!"
        print "case " + str(case_name) + " is pass"

    def interuptionVideoPlayBackSwitchHome(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.videoPlayBack()
        self.checkVideoPlayBack()
        time.sleep(1)
        self.d.press.home()
        self.multimedia_setting.click_recent_app("OtcVideoPlayer")
        time.sleep(1)
        self.checkVideoPlayBack()
        print "case " + str(case_name) + " is pass"

    def interuptionStreamingVideoPlayBackSwitchHome(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)
        self.d.press.home()
        self.multimedia_setting.click_recent_app("OtcVideoPlayer")
        time.sleep(1)
        self.checkVideoPlayBack()
        print "case " + str(case_name) + " is pass"

    def deleteVideoFileCase(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_setting.push_file(self.video.cfg.get("push_video_2"),
                                          self.video.cfg.get("datapath_2"))
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.enterBrowseVideo(os.path.split(self.push_path)[0])
        time.sleep(2)
        self.deleteVideoFile(
            os.path.split(self.video.cfg.get("push_video"))[1].strip("\""))
        self.deleteVideoFile(
            os.path.split(self.video.cfg.get("push_video_2"))[1].strip("\""))
        print "case " + str(case_name) + " is pass"

    def CheckVideoFileInThumbnail(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_setting.push_file(self.video.cfg.get("push_video_2"),
                                          self.video.cfg.get("datapath"))
        self.multimedia_setting.push_file(self.video.cfg.get("push_video_3"),
                                          self.video.cfg.get("datapath"))
        self.multimedia_setting.push_file(self.video.cfg.get("push_video_4"),
                                          self.video.cfg.get("datapath"))
        self.multimedia_setting.push_file(self.video.cfg.get("push_video_5"),
                                          self.video.cfg.get("datapath"))
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.enterBrowseVideo(os.path.split(self.push_path)[0])
        time.sleep(2)
        self.checkVideoFileExist(
            os.path.split(self.video.cfg.get("push_video"))[1].strip("\""))
        self.checkVideoFileExist(
            os.path.split(self.video.cfg.get("push_video_2"))[1].strip("\""))
        self.checkVideoFileExist(
            os.path.split(self.video.cfg.get("push_video_3"))[1].strip("\""))
        self.checkVideoFileExist(
            os.path.split(self.video.cfg.get("push_video_4"))[1].strip("\""))
        self.checkVideoFileExist(
            os.path.split(self.video.cfg.get("push_video_5"))[1].strip("\""))
        print "case " + str(case_name) + " is pass"

    def CheckVideoFileInformationInThumbnail(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.enterBrowseVideo(os.path.split(self.push_path)[0])
        time.sleep(2)
        self.checkVideoDetail(
            os.path.split(self.video.cfg.get("push_video"))[1].strip("\""))
        print "case " + str(case_name) + " is pass"

    def RenameVideoFileInThumbnail(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.enterBrowseVideo(os.path.split(self.push_path)[0])
        time.sleep(2)
        self.renameVideoFile(
            os.path.split(self.video.cfg.get("push_video"))[1].strip("\""),
            self.video.cfg.get("new_name"))
        print "case " + str(case_name) + " is pass"

    def videoPlayBackWithAlarm(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_setting.launchAlarmAPP()
        self.multimedia_setting.setAlarmTime(40)
        self.multimedia_handle.launchVideoApp()
        time.sleep(1)
        self.videoPlayBack()
        self.checkVideoPlayBack()
        time.sleep(1)
        self.multimedia_setting.waitAlarmTriiggered(60, "Snooze")
        self.multimedia_setting.setAlarmTime(30)
        self.multimedia_setting.click_recent_app("OtcVideoPlayer")
        self.checkVideoPlayBack()
        self.multimedia_setting.waitAlarmTriiggered(50, "Dismiss")
        self.multimedia_setting.click_recent_app("OtcVideoPlayer")
        self.checkVideoPlayBack()
        print "case " + str(case_name) + " is pass"

    def streamingVideoPlayBackWithAlarm(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name, 2)
        self.multimedia_setting.launchAlarmAPP()
        self.multimedia_setting.setAlarmTime(60)
        self.multimedia_handle.launchVideoApp()
        time.sleep(1)
        self.streamingVideoPlayBack()
        self.checkVideoPlayBack()
        time.sleep(1)
        self.multimedia_setting.waitAlarmTriiggered(80, "Snooze")
        self.multimedia_setting.setAlarmTime(60)
        self.multimedia_setting.click_recent_app("OtcVideoPlayer")
        self.checkVideoPlayBack()
        self.multimedia_setting.waitAlarmTriiggered(80, "Dismiss")
        self.multimedia_setting.click_recent_app("OtcVideoPlayer")
        self.checkVideoPlayBack()
        print "case " + str(case_name) + " is pass"

    def testVideoPlaybackRotation(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.videoPlayBack()
        self.checkVideoPlayBack()
        self.d.click(self.x / 2, self.y / 2)
        self.setRotation("Landscape View")
        self.checkVideoPlayBack()
        self.d.click(self.x / 2, self.y / 2)
        self.setRotation("Portrait View")
        self.checkVideoPlayBack()
        print "case " + str(case_name) + " is pass"

    def testStreamingVideoPlaybackRotation(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()
        self.d.click(self.x / 2, self.y / 2)
        self.setRotation("Landscape View")
        self.checkVideoPlayBack()
        self.d.click(self.x / 2, self.y / 2)
        self.setRotation("Portrait View")
        self.checkVideoPlayBack()
        print "case " + str(case_name) + " is pass"

    def testStreamingVideoPlayBackWithDownloadFile(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()
        self.push_path = self.multimedia_setting.push_file(
            self.video.cfg.get("push_video"), self.video.cfg.get("datapath"))
        time.sleep(3)
        self.checkVideoPlayBack()
        self.d.press.home()
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.videoPlayBack()
        self.checkVideoPlayBack()
        print "case " + str(case_name) + " is pass"

    def cameraRecordWithAlarm(self, case_name):
        print "run case is " + str(case_name)
        self.deleteCameraRecordFile()
        self.checkCameraRecordFile(0)
        self.multimedia_setting.launchAlarmAPP()
        self.multimedia_setting.setAlarmTime(30)
        self.launchRecordAPP()
        time.sleep(1)
        self.clickRecordButton()
        self.multimedia_setting.waitAlarmTriiggered(50, "Dismiss")
        self.multimedia_setting.click_recent_app("Camera2Video")
        time.sleep(1)
        self.clickRecordButton()
        self.checkCameraRecordFile()
        print "case " + str(case_name) + " is pass"

    def videoPlayBackLonglasting(self, case_name, bigfileskiptime=0):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        lasting_time = int(self.video.cfg.get("lasting_time"))
        push_folder = os.path.split(os.path.split(self.push_path)[0])[-1]
        self.video.launchPhotos(push_folder)
        time.sleep(2)
        self.multimedia_handle.checkVideoPlayBackWithPhotoApp(
            lasting_time, bigfileskiptime, 1)
        print "case " + str(case_name) + " is pass"

    def testPlaying_streaming_Music_Back(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        3. Press back
        """
        self.testStreamingVideoDurationThumbnail("test_API_video_playback_012")

    def testSHALL_support_H264_video_stream_no_frame_rate_limitation(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        3. Start/Stop
        """
        self.lowAndHighFramestreamingVideoPlayControlProcess(
            "test_API_video_playback_026")

    def testHTML5_video_playback_MP4_H264_BP(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.streamingVideoPlayControlProcess("test_API_video_playback_028")

    def testPFT_7098_VPG_HW_acceleratiof_HTML5_video_tag_H264(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_029")

    def testHTML5_video_playback_MP4_H264_HP(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.streamingVideoPlayControlProcess("test_API_video_playback_037")

    def testLongTime_HTML5_video_playback_MP4_H264(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.streamingVideoPlayControlProcess("test_API_video_playback_042")

    def testPseudo_streaming_clock_alarm(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        3. Alarm expired
        4. Snooze the alarm
        5. Dismiss the alarm
        """
        self.streamingVideoPlayBackWithAlarm("test_API_video_playback_047")

    def testPseudo_streaming_HTTP_H264_640x480_60fps_NoAudio_mkv(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_048")

    def testPseudo_streaming_HTTP_H264_L4_0_HP_720x576_30fps_AAC_160kbps_48KHz(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_049")

    def testPseudo_streaming_HTTP_VP8_176x144_15fps_334Kbps_NoAudio_webm(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_050")

    def testPlaying_streaming_Music_Power_Off(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBackWithPowerOff(
            "test_API_video_playback_051")

    def testSHALL_support_H264_video_stream_with_no_size_limitation(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        3. Start/Stop
        """
        self.lowAndHighFramestreamingVideoPlayControlProcess(
            "test_API_video_playback_055")

    def testPFT_7102_Network_streaming_protocols_HTTP_S_Live_Streaming(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_086")

    def testVideo_MPEG4_ASP_L1_720p_30fps_AAC_128kb_48KHz_RTP_streaming(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_089")

    def testVideo_H263_CIF_30FPS_AAC_44KHz_127Kbps_RTP_streaming(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_090")

    def testVideo_H264_f4v_MP_L3_1_640x480_30fps_AAC_44_1KHz_128kbps_over_WLAN(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_091")

    def testVideo_H264_L2_1_BP_CIF_30fps_AAC_Multimedia_56kb_48KHz_RTP_streaming(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_092")

    def testPseudo_streaming_HTTP_H264_MP_320x240_15fps_211Kbps_NoAudio_3gp(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_093")

    def testPseudo_streaming_HTTP_VP8_CIF_25fps_Vorbis_44_1KHz_128kbps_webm_rotate_sleep_resume(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.streamingVideoPlayControlProcess("test_API_video_playback_094")

    def testPseudo_streaming_file_downloading_in_background(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBackWithDownloadFile(
            "test_API_video_playback_103")

    def testPFT_7100_Network_streaming_protocols_RTSP_RTP_SDP(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testRTPStreamingVideoPlayBack("test_API_video_playback_109")

    def testLongTime_video_playback_H264_HP_L4_1_1080P_30fps_4_5Mbps_noAudio_mp4(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch photos
        2. Play video('Long-time Video playback: H264_HP_L4.1_1080P_30fps_4.5Mbps_na.mp4 (10 hours)')
        3. Former name: test_video_playback_long_lasting_mum_007
        """
        self.videoPlayBackLonglasting(
            "mum_test_video_playback_long_lasting_007", 20)

    def testLongTime_video_playback_VP8_VGA_20fps_2Mbps_Vorbis_48KHz_128kbps_webm(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch photos
        2. Play video('Long-time Video playback: VP8_VGA_20fps_2Mbps_Vorbis_48KHz_128kbps.webm (10 hours)')
        3. Former name: test_video_playback_long_lasting_mum_008
        """
        self.videoPlayBackLonglasting(
            "mum_test_video_playback_long_lasting_008", 20)
Exemple #3
0
class VideoAPITest(TestCaseBase):
    """
    @summary: Test Video PlayBack
    """
    def setUp(self):
        """
        @summary: set up
        @return: None
        """
        super(VideoAPITest, self).setUp()
        self.d = g_common_obj.get_device()
        self._test_name = __name__
        self.x = self.d.info["displayWidth"]
        self.y = self.d.info["displayHeight"]
        print "[Setup]: %s" % self._test_name
        g_common_obj.stop_app_am(
            "videoplayer.app.instrument.otc.intel.com.otcvideoplayer")
        # Unlock screen
        g_common_obj.adb_cmd_capture_msg("input keyevent 82")
        self.cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
                                'tests.tablet.mum_auto_video.conf')

        self.multimedia_setting = MultiMediaSetting(self.cfg_file)
        self.hardware = self.multimedia_setting.get_paltform_hardware()
        self.tag = "[Decode API] "

    def tearDown(self):
        """
        @summary: tear tearDown
        @return: None
        """
        super(VideoAPITest, self).tearDown()
        print "[Teardown]: %s" % self._test_name
        g_common_obj.stop_exp_handle()
        time.sleep(3)
        g_common_obj.stop_app_am(
            "videoplayer.app.instrument.otc.intel.com.otcvideoplayer")
        time.sleep(3)

    def appPrepare(self, case_name, model=1):
        # cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
        #     'tests.tablet.mum_auto_video.conf')
        self.video = PhotosImpl(\
            self.config.read(self.cfg_file, case_name))
        g_common_obj.adb_cmd_capture_msg(" rm -rf /sdcard/DCIM/Camera/*")

        self.multimedia_handle = MultiMediaHandle()
        # self.multimedia_setting = MultiMediaSetting(cfg_file)
        self.multimedia_setting.clearFolder(self.video.cfg.get("remove_video"))
        time.sleep(2)
        if model == 1:
            self.push_path = self.multimedia_setting.push_file(
                self.video.cfg.get("push_video"),
                self.video.cfg.get("datapath"))

        self.multimedia_setting.install_apk("video_apk")
        self.multimedia_setting.install_apk("alarm_apk")

        self.video.set_orientation_n()
        # Unlock screen
        g_common_obj.adb_cmd_capture_msg("input keyevent 82")

    def setTimeToSec(self, time):
        time = time.split(":")
        i = 1
        temp = 0
        for s in time[::-1]:
            temp += int(s) * i
            i *= 60
        return int(temp)

    def setRotation(self, mode):
        self.d(className="android.widget.ImageButton").click()
        time.sleep(1)
        self.d(text=mode).click()
        time.sleep(1)

    def videoPlayBack(self, push_path=""):
        if push_path == "":
            push_path = self.push_path
        return self.multimedia_handle.videoPlayBack(push_path)

    def streamingVideoPlayBack(self, path="", flag=1):
        if path == "":
            path = self.video.cfg.get("video_path")
        return self.multimedia_handle.streamingVideoPlayBack(path, flag)

    def checkVideoPlayBack(self, s=30):
        return self.multimedia_handle.checkVideoPlayBack(s)

    def checkVideoPlayBackWithComparePicture(self,
                                             stoptime,
                                             bigfileskiptime=0):
        return self.multimedia_handle.checkVideoPlayBackWithComparePicture(
            stoptime, bigfileskiptime)

    def checkVideoPlayBackComplete(self, s=900):
        tt = -1
        for _ in range(s / 10):
            time.sleep(10)
            if self.d(textContains="Completed").exists:
                return
            else:
                try:
                    if tt == -1:
                        for _ in range(10):
                            if self.d(resourceId="android:id/time").exists:
                                break
                            self.d.click(self.x / 2, self.y / 2)
                        tt = self.d(resourceId="android:id/time").text
                        tt = self.setTimeToSec(tt)
                    for _ in range(10):
                        if self.d(resourceId="android:id/time_current").exists:
                            break
                        self.d.click(self.x / 2, self.y / 2)
                    ct = self.d(resourceId="android:id/time_current").text
                    ct = self.setTimeToSec(ct)
                except Exception as e:
                    if self.d(textContains="Completed").exists:
                        return
                    else:
                        assert False, e
                if ct == tt:
                    assert not self.d(
                        textContains="error").exists or not self.d(
                            textContains="fail"
                        ).exists, "Play back error! please check it."
                    return

    def checkVideoNotSupport(self, s=60):
        for _ in range(s):
            if self.d(text="Can't play this video.").exists:
                return
            assert not self.d(
                resourceId="android:id/time_current").exists and not self.d(
                    resourceId="android:id/time").exists, "error!can play it!"
            time.sleep(1)
            self.d.click(self.x / 2, self.y / 2)

    def testVideoPlayBack(self, case_name):
        assert MultiMediaBasicTestCase().testVideoPlayBack(
            case_name), 'video play failed'

    def testVideoPlayBackAudio(self, case_name):
        assert MultiMediaBasicTestCase().testVideoPlayBack(
            case_name, check_hang=False), 'video play failed'

    def testVideoPlayBackViaVLC(self, case_name, change_file_flag=False):
        MultiMediaBasicTestCase().testVideoPlayBackViaVLC(
            case_name, change_file_flag)

    def testVideoPlayBackViaGallery(self, case_name):
        MultiMediaBasicTestCase().testVideoPlayBackViaGallery(case_name)

    def testVideoPlayBackLongIteration(self, case_name):
        MultiMediaBasicTestCase().testVideoPlayBackLongIterationTimes(
            case_name)

    def testVideoPlayBackWithManyTimes(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_handle.launchVideoApp()
        assert self.checkVideoPlayBack(), 'video play failed'
        time.sleep(2)
        for _ in range(100):
            self.videoPlayBack()
            self.checkVideoPlayBack()
            self.d.press("back")
            time.sleep(2)
        print "case " + str(case_name) + " is pass"

    def testVideoPlayBackWithManyTimes_ASP_file(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        for _ in range(20):
            self.videoPlayBack()
            assert self.checkVideoPlayBack(), "video play failed"
            self.d.press("back")
            self.d.press("back")
            time.sleep(2)
            if not self.d(textContains="OtcVideoPlayer").exists:
                self.multimedia_handle.launchVideoApp()
        self.push_path = self.multimedia_setting.push_file(
            self.video.cfg.get("push_video_2"), self.video.cfg.get("datapath"))
        for _ in range(20):
            self.videoPlayBack()
            assert self.checkVideoPlayBack(), "video play failed"
            self.d.press("back")
            self.d.press("back")
            time.sleep(2)
            if not self.d(textContains="OtcVideoPlayer").exists:
                self.multimedia_handle.launchVideoApp()
        print "case " + str(case_name) + " is pass"

    def interuptionVideoPlayBackSwitchHome(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.videoPlayBack()
        self.checkVideoPlayBack()
        time.sleep(1)
        self.d.press.home()
        self.multimedia_setting.click_recent_app("OtcVideoPlayer")
        time.sleep(1)
        self.checkVideoPlayBack()
        print "case " + str(case_name) + " is pass"

    def testStreamingVideoPlayBack(self, case_name):
        MultiMediaBasicTestCase().testStreamingVideoPlayBack(case_name)

    def interuptionStreamingVideoPlayBackSwitchHome(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name, 2)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.streamingVideoPlayBack()
        assert self.checkVideoPlayBack(), "Video play failed"
        time.sleep(1)
        self.d.press.home()
        self.multimedia_setting.click_recent_app("OtcVideoPlayer")
        time.sleep(1)
        self.checkVideoPlayBack()
        print "case " + str(case_name) + " is pass"

    def videoPlayControlProcess(self, case_name):
        logger.debug(self.tag + 'run case name is ' +
                     sys._getframe().f_back.f_code.co_name)
        MultiMediaBasicTestCase().videoPlayControlProcess(case_name)

    def videoPlayVP8CodecProcess(self, case_name):
        logger.debug(self.tag + 'run case name is ' +
                     sys._getframe().f_back.f_code.co_name)
        MultiMediaBasicTestCase().videoPlayCodecProcess(case_name,
                                                        msg='OMX.*.vp8')

    def videoPlayControlProcess_complte_pasue(self, case_name):
        assert MultiMediaBasicTestCase(
        ).videoPlayControlProcess_Complete_pasue(case_name)

    def videoPlayControlProcessWithVolume(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.videoPlayBack()
        assert self.checkVideoPlayBack(), "video play failed"
        self.multimedia_setting.set_play_time(0.5)
        assert self.checkVideoPlayBack(), "video play failed"
        self.multimedia_handle.clickOtcVideoPlayer_Control(
            resourceId="android:id/rew")
        self.multimedia_handle.clickOtcVideoPlayer_Control(
            resourceId="android:id/ffwd")
        self.multimedia_setting.set_play_time_with_swipe(0.2)
        assert self.checkVideoPlayBack(), "video play failed"
        self.multimedia_handle.clickOtcVideoPlayer_Control(
            resourceId="android:id/pause")
        self.d.press.volume_up()
        self.checkVideoPlayBack()
        self.d.press.volume_down()
        assert self.checkVideoPlayBack(), "video play failed"
        print "case " + str(case_name) + " is pass"

    def videoDecodeSecondDisplay(self, case_name):
        logger.debug(self.tag + 'run case name is ' +
                     sys._getframe().f_back.f_code.co_name)
        self.appPrepare(case_name)
        g_common_obj.adb_cmd_capture_msg('am force-stop com.android.gallery3d')
        assert self.checkSecondDisplay(
        ), 'Cannot find the second display screen'
        assert self.playVideoSecondDisplay(
            self.push_path), 'cannot launch the video'
        g_common_obj.adb_cmd_capture_msg('am force-stop com.android.gallery3d')
        assert self.playVideoMainDisplay(
            self.push_path), 'cannot launch the video'
        logger.debug(self.tag + 'run case ' +
                     sys._getframe().f_back.f_code.co_name + ' is pass')

    def checkSecondDisplay(self):
        """
        check the DUT has two display screen
        :return: True, has two display screen
        """
        display2_out = g_common_obj.adb_cmd_capture_msg(
            "dumpsys |grep mExternalTouchViewport")
        if 'valid=false' in display2_out:
            logger.warning(self.tag +
                           "Cannot find the second display screen:%s" %
                           display2_out)
            return False
        else:
            logger.debug(self.tag + "The second display screen exits.")
            return True

    def playVideoSecondDisplay(self, file_path):
        """
        Play the video using the second display in Gallery
        :return: True, launch success
        """
        g_common_obj.adb_cmd_common("logcat -c")
        play_cmd = 'am start --display 1 -a android.intent.action.VIEW -d "file://%s" -t "video/*" -n com.android.gallery3d/.app.MovieActivity' % file_path
        g_common_obj.adb_cmd_capture_msg(play_cmd)
        time.sleep(5)
        gallery_play_act = 'com.android.gallery3d/com.android.gallery3d.app.MovieActivity'
        display1_surface = g_common_obj.adb_cmd_capture_msg(
            "dumpsys SurfaceFlinger|grep  -A10 'Display 0 HWC layers' ")
        display2_surface = g_common_obj.adb_cmd_capture_msg(
            "dumpsys SurfaceFlinger|grep  -A10 'Display 1 HWC layers' ")
        logger.debug(
            self.tag +
            "Video play failed, display1_surface:\n {0},\ndisplay2_surface:\n{1}"
            .format(display1_surface, display2_surface))
        if gallery_play_act not in display1_surface and gallery_play_act in display2_surface:
            logger.debug(self.tag + "Video play in the second display")
        else:
            logger.debug(self.tag + "Video play failed")
            return False
        # check video play
        return self.checkVideoInfoFromLogcat()

    def playVideoMainDisplay(self, file_path):
        """
        Play the video using the second display in Gallery
        :return: True, launch success
        """
        g_common_obj.adb_cmd_common("logcat -c")
        play_cmd = 'am start --display 0 -a android.intent.action.VIEW -d "file://%s" -t "video/*" -n com.android.gallery3d/.app.MovieActivity' % file_path
        g_common_obj.adb_cmd_capture_msg(play_cmd)
        time.sleep(6)
        gallery_play_act = 'com.android.gallery3d/com.android.gallery3d.app.MovieActivity'
        display1_surface = g_common_obj.adb_cmd_capture_msg(
            "dumpsys SurfaceFlinger|grep  -A10 'Display 0 HWC layers' ")
        display2_surface = g_common_obj.adb_cmd_capture_msg(
            "dumpsys SurfaceFlinger|grep  -A10 'Display 1 HWC layers' ")
        logger.debug(
            self.tag +
            "Video play failed, display1_surface:\n {0} \ndisplay2_surface:\n{1}"
            .format(display1_surface, display2_surface))
        if gallery_play_act in display1_surface and gallery_play_act in display2_surface:
            logger.debug(self.tag + "Video play in the main display")
        else:
            logger.debug(self.tag + "Video play failed")
            return False
        return self.checkVideoInfoFromLogcat()

    def checkVideoInfoFromLogcat(self):
        hardware_decode_msg = g_common_obj.adb_cmd_capture_msg(
            "logcat -d |grep 'I libva'")
        ur_decode_msg = g_common_obj.adb_cmd_capture_msg(
            "logcat -d |grep 'OMXMaster: makeComponentInstance'")
        logger.debug(
            self.tag +
            "Video play failed, hardware_decode_msg:\n {0},\nur_decode_msg:\n{1}"
            .format(hardware_decode_msg, ur_decode_msg))
        if not hardware_decode_msg and not ur_decode_msg:
            logger.debug(
                self.tag +
                "cannot find the libva or OMXMaster, video play abnormal")
            return False
        else:
            return True

    def testVideoNotSupport(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name, 2)
        self.multimedia_handle.launchVideoApp()
        time.sleep(2)
        self.streamingVideoPlayBack(flag=2)
        self.checkVideoNotSupport()
        print "case " + str(case_name) + " is pass"

    def testPlayback_VP8_640x480_20fps_Vorbis_48KHz_192Kbps_mkv_check_pause_resume_seek_rotate_sleep(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.videoPlayControlProcess("test_API_video_playback_033")

    def testPlayback_H264_MP_1080P_60fps_50Mbps_AAC_LC_48KHz_320Kbps_mp4_check_pause_resume_seek_rotate_sleep(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.videoPlayControlProcess("test_API_video_playback_034")

    def testPlayback_H264_HP_1080P_60fps_50Mbps_AAC_LC_48KHz_320Kbps_mp4_check_pause_resume_seek_rotate_sleep(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.videoPlayControlProcess("test_API_video_playback_035")

    def testPlayback_H264_BP_1080P_60fps_50Mbps_AAC_LC_48KHz_320Kbps_mp4_check_pause_resume_seek_rotate_sleep(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.videoPlayControlProcess("test_API_video_playback_036")

    def testh265_HEVC_With_10Bit_2160P_30Fps(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.videoPlayControlProcess_complte_pasue(
            "test_API_video_playback_128")

    def testh265_HEVC_With_10Bit_1080p_30Fps_8Mbps(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.videoPlayControlProcess_complte_pasue(
            "test_API_video_playback_129")

    def testh265_HEVC_With_10Bit_2160P_30Fps_60Mbps(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.videoPlayControlProcess_complte_pasue(
            "test_API_video_playback_130")

    def testCheck_SeparateCard_for_each_apps_with_multi_tasking(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Switch to Home, then back from Home
        """
        self.interuptionVideoPlayBackSwitchHome("test_API_video_playback_038")

    def testPlay_H263_MP4_container(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_043")

    def testSHALL_support_m4v_extension_MP4_video_file(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.videoPlayControlProcessWithVolume("test_API_video_playback_045")

    def testPlaying_streaming_Music_Home(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Switch to Home, then back from Home
        """
        self.interuptionStreamingVideoPlayBackSwitchHome(
            "test_API_video_playback_058")

    def testSupport_native_display_resolution_FWVGA_854x480_30fps(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_074")

    def testPlayback_H263_3GPv5_L1_0_BP_QCIF_15fps_AMR_WB_256kb_16KHz(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_075")

    def testPlayback_H264_Level1_0_Main_Profile_QCIF_176x144_10fps_AAC_Multimedia_96kb_48KHz(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_076")

    def testIterative_video_playback_H264_HP_1080P_60fps_50Mbps_AAC_LC_48KHz_320Kbps_mp4_iteratively(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBackLongIteration("test_API_video_playback_077")

    def testPlayback_H264_Level4_0_Main_Profile_HD_1920x1080_30fps_AAC_Multimedia_128kb_48KHz_and_pause_resume(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_078")

    def testH263_352_288_30fps_858kbps_No_Audio_mp4(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_079")

    def testH263_Level20_Sub_QCIF_30fps_128_KbS(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_080")

    def testPlay_H263_20F_QQVGA_AMRNB_12_2k(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_131")

    def testPlayback_VP8_CIF_25fps_Vorbis_44_1KHz_128kbps_webm_iteratively(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBackLongIteration("test_API_video_playback_081")

    def testVideo_H264_29_970fps_5mn29s_640x480_MP4_RTP_streaming(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testStreamingVideoPlayBack("test_API_video_playback_088")

    def testPlayback_MP4_h264_HiP_4_0_1080p_30FPS_25Mbps_AAC_LC_48KHz_256Kbps_1Min_179MB_BBB_mp4(
            self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.videoPlayControlProcessWithVolume("test_API_video_playback_101")

    def testPlayback_MPEG4_ASP_1080P_30fps_6Mbps_AAC_LC_48KHz_128Kbps(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_111")

    def testPlayback_MPEG4_ASP_Lv5_720X480_30fps_AAC_ST_160kbp_48KHZ(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_112")

    def testPlayback_MPEG4_SP_and_MEPG4_ASP_Continuously(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBackWithManyTimes_ASP_file(
            "test_API_video_playback_114")

    def testCorrupt_File_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoNotSupport("test_API_video_playback_115")

    def testPlayback_MPEG4_ASP_Lv0_176X144_30fps_AAC_Plus_ST_64kbp_32KHz(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_116")

    def testH264_480X320_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_118")

    def testH264_854x480_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_119")

    def testH265_480X320_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_120")

    def testH265_854x480_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_121")

    def testh265_simple_10bit_lowbitrat_mkv(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch VLC app
            2. Play video
            """
        self.testVideoPlayBackViaVLC("test_API_video_playback_140")

    def testh265_HEVC_With_10Bit_medium_mp4(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch VLC app
            2. Play video
            """
        self.testVideoPlayBackViaVLC("test_API_video_playback_141")

    def testVideo_Playback_MPEG4_SPL0_QCIF_176x144_15Fps(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch VLC app
            2. Play video
            """
        if self.hardware == "gordon_peak":
            self.testVideoPlayBackViaGallery("test_API_video_playback_142")
        elif self.hardware in ["androidia_64", "r2_cht_mrd"]:
            self.testVideoPlayBack("test_API_video_playback_142")
        else:
            self.testVideoPlayBackViaVLC("test_API_video_playback_142")

    def testPlayback_H264_4K_External_Storage(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch VLC app
            2. Play video
            """
        if self.hardware in ["androidia_64", "r2_cht_mrd"]:
            self.testVideoPlayBack("test_API_video_playback_143")
        else:
            self.testVideoPlayBackViaVLC("test_API_video_playback_143",
                                         change_file_flag=True)

    def testVideo_Playback_DIVX5_720p_30Fps(self):
        """
        This test used to test DIVX Video playback
        he test case spec is following:
        1. Launch VLC app
        2. Play video
        """
        self.testVideoPlayBackViaVLC("test_API_video_playback_144")

    def testVideo_Playback_DIVX6_1080p_23Fps(self):
        """
        This test used to test DIVX Video playback
        he test case spec is following:
        1. Launch VLC app
        2. Play video
        """
        self.testVideoPlayBackViaVLC("test_API_video_playback_145")

    def testVideo_Playback_Xvid_960x720_30Fps(self):
        """
        This test used to test DIVX Video playback
        he test case spec is following:
        1. Launch VLC app
        2. Play video
        """
        self.testVideoPlayBackViaVLC("test_API_video_playback_153")

    def testVP8_480X320_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_122")

    def testVP8_854x480_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_123")

    def testVP8_HW_4K_Decode(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.videoPlayVP8CodecProcess("test_API_video_playback_151")

    def testVP9_480X320_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_124")

    def testVP9_854x480_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_125")

    def testMPEG4_480X320_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_126")

    def testMPEG4_854x480_Playback(self):
        """
        This test used to test Video playback
        The test case spec is following:
        1. Launch play video app
        2. Play video
        """
        self.testVideoPlayBack("test_API_video_playback_127")

    def testVideo_Playback_H264_HP_1408x1152_Ts_Pause_Resume_Rotate_Sleep(
            self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch play video app
            2. Play video and check
            3. rotate screen and press power key to suspeng/resume
        """
        self.videoPlayControlProcess("test_video_playback_031")

    def testVideo_Playback_H264_1080P_Ts_Pause_Resume_Rotate_Sleep(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch play video app
            2. Play video and check
            3. rotate screen and press power key to suspeng/resume
        """
        self.videoPlayControlProcess("test_API_video_playback_146")

    def testVideo_Playback_H264_1080_Mkv_Local(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch play video app
            2. Play video and check
            3. rotate screen and press power key to suspeng/resume
        """
        self.videoPlayControlProcess("test_API_video_playback_154")

    def testVideo_Playback_HEAAC_V2_Mp4(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch play video app
            2. Play video and check
        """
        self.testVideoPlayBackAudio("test_API_video_playback_152")

    def testVideo_Playback_Mp3_Mkv(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch play video app
            2. Play video and check
        """
        self.testVideoPlayBackAudio("test_video_playback_110")

    def testVideo_Playback_MPEG4_SPL2_QVGA_15Fps(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch play video app
            2. Play video and check
            3. rotate screen and press power key to suspeng/resume
        """
        self.videoPlayControlProcess("test_video_playback_015")

    def testVideo_Playback_MPEG4_SP_VGA_30Fps(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch play video app
            2. Play video and check
            3. rotate screen and press power key to suspeng/resume
        """
        self.videoPlayControlProcess("test_video_playback_098")

    def testVideo_Playback_MPEG4_SP2_CIF_3gp(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch play video app
            2. Play video and check
            3. rotate screen and press power key to suspeng/resume
        """
        self.videoPlayControlProcess("test_video_playback_101")

    def testVideo_Playback_MPEG4_SP1_CIF(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Launch play video app
            2. Play video and check
            3. rotate screen and press power key to suspeng/resume
        """
        self.videoPlayControlProcess("test_API_video_playback_132")

    def testVideo_Decode_Second_Display_H264_1080P(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Connect two screen.
            2. Play video on the second screen.
        """
        self.videoDecodeSecondDisplay("test_API_video_playback_147")

    def testVideo_Decode_Second_Display_VP8_720P(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Connect two screen.
            2. Play video on the second screen.
        """
        self.videoDecodeSecondDisplay("test_API_video_playback_148")

    def testVideo_Decode_Second_Display_MPEG4_480P(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Connect two screen.
            2. Play video on the second screen.
        """
        self.videoDecodeSecondDisplay("test_video_playback_017")

    def testVideo_Decode_Second_Display_H264_720P_60fps(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Connect two screen.
            2. Play video on the second screen.
        """
        self.videoDecodeSecondDisplay("test_API_video_playback_149")

    def testVideo_Decode_Second_Display_H265_480x360(self):
        """
            This test used to test Video playback
            The test case spec is following:
            1. Connect two screen.
            2. Play video on the second screen.
        """
        self.videoDecodeSecondDisplay("test_API_video_playback_150")