Exemplo n.º 1
0
class Volume(UIATestBase):
    """
    @summary: Test change volume
    """
    def setUp(self):
        super(Volume, self).setUp()
        self._test_name = __name__
        print
        print "[Setup]: %s" % self._test_name
        self.systemui = SystemUI()

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

    def testVolume(self):
        """
        This test case is to change volume

        Test Case Step:
        1. Launch settings app, select "Sound & notification"
        2. Change the volume
        """
        print "[RunTest]: %s" % self.__str__()

        self.systemui.change_volume_silent_settings()
Exemplo n.º 2
0
class Suspend(UIATestBase):
    """
    @summary: Test suspend and wakeup
    """
    def setUp(self):
        super(Suspend, self).setUp()
        self._test_name = __name__
        print
        print "[Setup]: %s" % self._test_name
        self.systemui = SystemUI()

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

    def testSuspend(self):
        """
        This test case is to test suspend and wakeup

        Test Case Step:
        1. Make the device sleep for 60s
        2. Make the device wakeup
        """
        print "[RunTest]: %s" % self.__str__()

        self.systemui.suspend_wakeup()
Exemplo n.º 3
0
 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"
Exemplo n.º 4
0
 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"
Exemplo n.º 5
0
 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"
Exemplo n.º 6
0
 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()
Exemplo n.º 7
0
 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!"
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 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!"
Exemplo n.º 10
0
 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!"
Exemplo n.º 11
0
 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()
Exemplo n.º 12
0
 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!"
Exemplo n.º 13
0
 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!"
Exemplo n.º 14
0
 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!"
Exemplo n.º 15
0
 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!"
Exemplo n.º 16
0
 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"
Exemplo n.º 17
0
 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
Exemplo n.º 18
0
    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()
Exemplo n.º 19
0
 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)
Exemplo n.º 20
0
 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
Exemplo n.º 21
0
 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!"
Exemplo n.º 22
0
 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)
Exemplo n.º 23
0
 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)
Exemplo n.º 24
0
class TestBackLight(UIATestBase):
    def setUp(self):
        super(TestBackLight, self).setUp()
        self.systemui = SystemUI()

    def tearDown(self):
        super(TestBackLight, self).tearDown()
        self.systemui = None

    def testBackLightSwitch(self):
        self.systemui.suspend_wakeup()

    def test_Backlight_SuspendResume(self):
        self.systemui.power_off_device(sleepTime=3)
        self.systemui.power_on_device(sleepTime=3)
Exemplo n.º 25
0
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)
Exemplo n.º 26
0
 def setUp(self):
     super(Volume, self).setUp()
     self._test_name = __name__
     print
     print "[Setup]: %s" % self._test_name
     self.systemui = SystemUI()
Exemplo n.º 27
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)
Exemplo n.º 28
0
 def test_Switch_Camera(self):
     SystemUI().unlock_screen()
     self._demoInstance.switch_camera_preview()
Exemplo n.º 29
0
class ImageAPITest(UIATestBase):
    """
    @summary: Test Video PlayBack
    """

    def setUp(self):
        """
        @summary: set up
        @return: None
        """
        super(ImageAPITest, 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("com.intel.otc.instrument.otcphotos")
        # Unlock screen
        g_common_obj.adb_cmd_capture_msg("input keyevent 82")

    def tearDown(self):
        """
        @summary: tear tearDown
        @return: None
        """
        super(ImageAPITest, self).tearDown()
        print "[Teardown]: %s" % self._test_name
        g_common_obj.stop_exp_handle()
        time.sleep(3)
        g_common_obj.stop_app_am("com.intel.otc.instrument.otcphotos")
        time.sleep(1)
        g_common_obj.adb_cmd_capture_msg(self.video.cfg.get("remove_video"))

    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 getOrientation(self):
        d = self.get_device()
        width = d.info["displayWidth"]
        height = d.info["displayHeight"]
        if width > height:
            return 1
        else:
            return 0

    def appPrepare(self, case_name, model=1):
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.mum_auto_image.conf')
        self.video = PhotosImpl(\
            self.config.read(cfg_file, case_name))
        self.camera = CameraImpl(\
            self.config.read(cfg_file, case_name))
        
        self.multimedia_setting = MultiMediaSetting(cfg_file)
        self.multimedia_setting.install_apk("photo_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 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 launchPhotoAPPWithShortCut(self):
        self.d.press.home()
        self.d(description="Apps").click()
        for _ in range(3):
            if self.d(textContains="Choose some apps").exists:
                self.d(text="OK").click()
        assert not self.d(text="OK").exists, "skip the tips failed!"
        while not self.d(text="otcphoto-app").exists:
            self.d(className="android.view.View").swipe.left()
        self.d(text="otcphoto-app").click()
        time.sleep(3)
        assert self.d(textContains="/").exists, "launch photo 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 enterPhotoPath(self, path):
        push_str = path.strip("\"").split("/")
        if push_str[0] == "" and push_str[1] == "sdcard":
            push_str = push_str[2:]
        print push_str
        for t_str in push_str:
            if t_str != "":
                self.d(text=t_str).click()
                time.sleep(2)

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

    def getPictureSize(self):
        scaleLabel = self.d(resourceId="com.intel.otc.instrument.otcphotos:id/scaleLabel").info["text"]
        return int(scaleLabel.strip("%"))

    def imageViewCheckWithWallpaper(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.multimedia_setting.push_file(self.video.cfg.get("push_picture"), self.video.cfg.get("datapath"))
        self.launchPhotoAPP()
        self.enterPhotoPath(path)
        file_name = os.path.split(path)[1]
        self.checkPictureExist(file_name)
        self.d.press.back()
        self.d(text=file_name).long_click()
        self.d(text="Wallpaper").click()
        time.sleep(5)
        assert self.d(text="WallPaper is updated.").exists, "Set wallpaper failed!"
        print "case " + str(case_name) + " is pass"

    def imageViewCheckWithDelete(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.multimedia_setting.push_file(self.video.cfg.get("push_picture"), self.video.cfg.get("datapath"))
        self.launchPhotoAPP()
        self.enterPhotoPath(path)
        file_name = os.path.split(path)[1]
        self.checkPictureExist(file_name)
        g_common_obj.adb_cmd_capture_msg(self.video.cfg.get("remove_video"))
        self.d.press.home()
        self.launchPhotoAPP()
        self.enterPhotoPath(os.path.split(path)[0])
        assert not self.d(text=file_name).exists, "%s file exist!" % file_name
        print "case " + str(case_name) + " is pass"

    def imageViewCheckWithMonoryFull(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        g_common_obj.adb_cmd_capture_msg("rm -rf /storage/sdcard0/DCIM/Camera/*")
        self.camera.clean_up_camera_data()
        make_big_file.fill_no_space_except(int(self.camera.cfg.get("device_storage_limited")))
        path = self.video.cfg.get("push_picture").split(" ")[-1].strip("\"")
        print path
        self.multimedia_setting.push_file(self.video.cfg.get("push_picture"), self.video.cfg.get("datapath"))
        self.launchPhotoAPP()
        self.enterPhotoPath(path)
        file_name = os.path.split(path)[1]
        self.checkPictureExist(file_name)
        g_common_obj.adb_cmd_capture_msg("rm -rf /mnt/sdcard/bigfile")
        print "case " + str(case_name) + " is pass"

    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.multimedia_setting.push_file(self.video.cfg.get("push_picture"), self.video.cfg.get("datapath"))
        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 imageViewTenTimes(self, case_name, t_time=10):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        path = self.video.cfg.get("push_picture").split(" ")[-1].strip("\"")
        print path
        self.multimedia_setting.push_file(self.video.cfg.get("push_picture"), self.video.cfg.get("datapath"))
        self.launchPhotoAPP()
        self.enterPhotoPath(path)
        file_name = os.path.split(path)[1]
        self.checkPictureExist(file_name)
        for _ in range(10):
            self.d.press.back()
            self.d(text=file_name).click()
            self.checkPictureExist(file_name)
        print "case " + str(case_name) + " is pass"

    def testMultiMedia_Gallery_CropPicture_LockScreen(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithUnlock("test_API_image_032")

    def testMultiMedia_Gallery3D_Select_Unselected_Items_20_Times(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewTenTimes("test_API_image_033", 20)

    def testImage_View_Edit_GIF(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithWallpaper("test_API_image_034")

    def testImage_View_Edit_JPG(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithWallpaper("test_API_image_035")

    def testImage_View_Edit_BMP(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithWallpaper("test_API_image_036")

    def testImage_View_Edit_WBMP(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithWallpaper("test_API_image_037")

    def testImage_Edit_Save_With_Memory_Full(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithMonoryFull("test_API_image_039")

    def testImage_View_Edit_WEBP(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithWallpaper("test_API_image_040")

    def testImage_View_Edit_PNG(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithWallpaper("test_API_image_041")

    def test_Album_Delete(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithDelete("test_API_image_042")
Exemplo n.º 30
0
class ImageAPITest(TestCaseBase):
    """
    @summary: Test Video PlayBack
    """
    def setUp(self):
        """
        @summary: set up
        @return: None
        """
        super(ImageAPITest, 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"]
        self.dpx = self.d.info["displaySizeDpX"]
        self.dpy = self.d.info["displaySizeDpY"]
        self.tag = "[Image Decode image_api_test] "
        self.serial = self.d.server.adb.device_serial()
        logger.debug(self.tag + "[Setup]: %s" % self._test_name)
        g_common_obj.stop_app_am("com.intel.otc.instrument.otcphotos")
        # Unlock screen
        g_common_obj.adb_cmd_capture_msg("input keyevent 82")

    def tearDown(self):
        """
        @summary: tear tearDown
        @return: None
        """
        super(ImageAPITest, self).tearDown()
        print "[Teardown]: %s" % self._test_name
        g_common_obj.stop_exp_handle()
        time.sleep(3)
        g_common_obj.stop_app_am("com.intel.otc.instrument.otcphotos")
        time.sleep(1)
        g_common_obj.adb_cmd_capture_msg(self.video.cfg.get("remove_video"))

    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 getOrientation(self):
        d = self.get_device()
        width = d.info["displayWidth"]
        height = d.info["displayHeight"]
        if width > height:
            return 1
        else:
            return 0

    def appPrepare(self, case_name, model=1):
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.mum_auto_image.conf')
        self.video = PhotosImpl(\
            self.config.read(cfg_file, case_name))

        self.multimedia_handle = MultiMediaHandle()
        self.multimedia_setting = MultiMediaSetting(cfg_file)
        self.multimedia_setting.install_apk("photo_apk")
        self.multimedia_setting.install_apk("alarm_apk")
        self.video.set_orientation_n()
        if self.video.cfg.get("push_picture") is not None:
            self.multimedia_setting.push_file(
                self.video.cfg.get("push_picture"),
                self.video.cfg.get("datapath"))
        refresh_sd_cmd = self.config.read(cfg_file, 'common_cmd')['refresh_sd']
        g_common_obj.adb_cmd_capture_msg(refresh_sd_cmd)
        # Unlock screen
        g_common_obj.adb_cmd_capture_msg("input keyevent 82")

    def launchPhotoAPP(self):
        logger.debug(self.tag + "launch otcphotos app")
        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 checkPhotosBackupAndHandle(self):
        """
        check 'back up & sync' exist and handle it
        :return:
        """
        for _ in range(3):
            if self.d(textContains="Update Google Photos").exists:
                logger.debug("Ignore update google photos")
                self.d(textMatches="NOT NOW").click()
            time.sleep(1)
            if self.d(resourceId=
                      'com.android.packageinstaller:id/permission_allow_button'
                      ).exists:
                self.d(
                    resourceId=
                    'com.android.packageinstaller:id/permission_allow_button'
                ).click()
                time.sleep(1)
            if self.d(textContains='Google Photos uses face').exists and \
                    self.d(textMatches='[O|o][N|n]').exists:
                logger.debug("back up & sync display, try to init photos")
                x = self.d.info['displayHeight'] / 2
                y = self.d.info['displayWidth'] / 2
                self.d.click(x, y)
            if self.d(textContains="Keep backup off").exists:
                self.d(textMatches="Keep off|KEEP OFF").click()
            if self.d(textStartsWith="Never show").exists:
                self.d(textStartsWith="Never show").click()
            if self.d(textMatches="SKIP|Skip").exists:
                self.d(textMatches="SKIP|Skip").click()
            if self.d(textMatches="CANCEL|Cancel").exists:
                self.d(textMatches="CANCEL|Cancel").click()
            if self.d(description="Photos, selected, tab, 2 of 3").exists or\
                                self.d(resourceId="com.google.android.apps.photos:id/toolbar").exists:
                logger.debug("init completed")
                break

    def launchPhotoAPPWithShortCut(self):
        logger.debug(self.tag + "Launch Photos")
        self.d.press.home()
        if self.get_android_version() == "7.1.1":
            logger.debug("DUT android version is 7.1.1")
            self.d(description="Apps list").click()
        elif self.get_android_version() < "7.1.1":
            logger.debug("DUT android version is beloww 7.1.1")
            if self.d(text="GOT IT").exists:
                self.d(text="GOT IT").click()
            self.d(description="Apps").click()
        elif self.multimedia_setting.get_paltform_hardware() == 'androidia_64':
            logger.debug("For AIA, Photos in Google folder")
            self.d(description="Folder: Google").click()
            self.d(description="Photos").click()
            self.checkPhotosBackupAndHandle()
            assert self.d(
                resourceId="com.google.android.apps.photos:id/toolbar"
            ).exists, "launch photo app failed!"
            return True
        #for N build,firstly go into apps list,skip the tips
        for _ in range(3):
            if self.d(textContains="Choose some apps").exists:
                self.d(text="OK").click()
        assert not self.d(text="OK").exists, "skip the tips failed!"
        while not self.d(text="otcphoto-app").exists:
            self.d(className="android.view.View").swipe.left()
        self.d(text="otcphoto-app").click()
        time.sleep(3)
        assert self.d(textContains="/").exists, "launch photo app failed!"

    def launchGalleryAPPWithShortCut(self):
        # for bxtp o car, launch Gallery
        self.d.press.home()
        app_list_cmd = "adb -s %s shell input tap '%d' '%d'" % (
            self.serial, int(self.dpx * 0.78), int(self.dpy * 0.97))
        print app_list_cmd
        for _ in range(3):
            os.system(app_list_cmd)
            if self.d(resourceId=
                      "com.android.support.car.lenspicker:id/dismiss_area"
                      ).wait.exists(timeout=3000):
                try:
                    self.d(resourceId=
                           "com.android.support.car.lenspicker:id/dismiss_area"
                           ).scroll.vert.to(text='Gallery')
                except:
                    self.d.swipe(self.x / 2, self.y * 0.75, self.x / 2,
                                 self.y * 0.25)
                self.d(text="Gallery").click()
                if self.d(resourceId="com.android.gallery3d:id/gl_root_view"
                          ).wait.exists(timeout=3000):
                    logger.debug("Launch Gallery success!")
                    return True
        logger.debug("Launch Gallery Failed!")
        return False

    def get_android_version(self):

        prop = "ro.build.version.release"
        buf = g_common_obj.adb_cmd_capture_msg("getprop " + prop)
        v_str = buf.strip()
        return v_str

    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 enterPhotoPath(self, path):
        logger.debug(self.tag + "enter picture path :" + path)
        push_str = path.strip("\"").split("/")
        if push_str[0] == "" and push_str[1] == "sdcard":
            push_str = push_str[2:]
        for t_str in push_str:
            logger.debug(self.tag + "try to click %s" % t_str)
            if t_str != "":
                self.d(text=t_str).click()
                time.sleep(2)

    def checkPictureExist(self, file_name):
        logger.debug(self.tag + "check picture exist, filename:" + file_name)
        if self.d(text=file_name).exists:
            logger.debug(self.tag + file_name + " found!")
            return True
        else:
            logger.debug(self.tag + file_name + " not find!")
            return False

    def openPictureWithGallery(self, file):
        print file
        open_picture_cmd = "shell am start -a android.intent.action.VIEW -d file://%s " \
                   " -t image/* -n com.android.gallery3d/.app.GalleryActivity" % (file)
        for _ in range(3):
            g_common_obj.adb_cmd_common(open_picture_cmd)
            time.sleep(1)
            if self.d(resourceId=
                      "com.android.gallery3d:id/photopage_bottom_controls"):
                return True
        logger.debug(self.tag + "open %s failed" % file)
        return False

    def openPictureWithPhotosCmd(self, file):
        logger.debug("Try to open %s with command" % file)
        open_picture_cmd = "shell am start -a android.intent.action.VIEW -d file://%s " \
                           " -t image/* -n com.google.android.apps.photos/.pager.HostPhotoPagerActivity" % (file)
        for _ in range(3):
            g_common_obj.adb_cmd_common(open_picture_cmd)
            time.sleep(1)
            if self.d(
                    resourceId=
                    "com.google.android.apps.photos:id/video_player_controller_fragment_container"
            ):
                logger.debug(self.tag + 'Open picture success.')
                return True
        logger.debug(self.tag + "open %s failed" % file)
        return False

    def getPictureSize(self):
        scaleLabel = self.d(
            resourceId="com.intel.otc.instrument.otcphotos:id/scaleLabel"
        ).info["text"]
        return int(scaleLabel.strip("%"))

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

    def imageViewRotatePicture(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])
        self.d.orientation = "n"
        time.sleep(2)
        self.checkPictureExist(os.path.split(path)[1])
        self.video.set_orientation_n()
        time.sleep(2)
        self.checkPictureExist(os.path.split(path)[1])
        print "case " + str(case_name) + " is pass"

    def imageViewRotatePictureManyTimes(self, case_name, count):
        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])
        for _ in range(count):
            self.d.orientation = "n"
            time.sleep(2)
            self.checkPictureExist(os.path.split(path)[1])
            self.video.set_orientation_n()
            time.sleep(2)
            self.checkPictureExist(os.path.split(path)[1])
        print "case " + str(case_name) + " is pass"

    def imageViewCheck(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])
        print "case " + str(case_name) + " is pass"

    def imageViewCheckAfterDeleteFile(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)
        file_name = os.path.split(path)[1]
        self.checkPictureExist(file_name)
        self.multimedia_setting.clearFolder(self.video.cfg.get("remove_video"))
        time.sleep(2)
        self.d.press.back()
        self.d(text=file_name).click()
        assert not self.d(
            resourceId='com.intel.otc.instrument.otcphotos:id/sizeLabel'
        ).exists, "no warning messsage pop up"
        for _ in range(3):
            self.d.press.back()
        print "case " + str(case_name) + " is pass"

    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 imageViewCheckWithRotation(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.d.orientation = "n"
        self.d.press.home()
        self.multimedia_setting.click_recent_app("otcphoto-app")
        time.sleep(1)
        assert self.d(textContains="/").exists, "launch photo app failed!"
        self.multimedia_setting.launchAlarmAPP()
        self.video.set_orientation_n()
        self.multimedia_setting.click_recent_app("otcphoto-app")
        time.sleep(1)
        assert self.d(textContains="/").exists, "launch photo app failed!"
        self.enterPhotoPath(path)
        self.checkPictureExist(os.path.split(path)[1])
        print "case " + str(case_name) + " is pass"

    def imageViewCheckWithInstallApp(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("\"")
        print 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.multimedia_setting.install_apk("video_apk")
        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])
        self.push_path = 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.multimedia_handle.videoPlayBack(self.push_path)
        self.multimedia_setting.install_apk("vpg_apk")
        self.checkVideoPlayBack(30)
        adb.adb_cmd_common(
            'uninstall videoplayer.app.instrument.otc.intel.com.otcvideoplayer'
        )
        adb.adb_cmd_common('uninstall com.intel.vpg.tool')
        print "case " + str(case_name) + " is pass"

    def imageViewCheckWithShortCut(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        path = self.video.cfg.get("push_picture").split(" ")[-1].strip("\"")
        if "androidia_64" in self.multimedia_setting.get_paltform_hardware():
            self.launchPhotoAPPWithShortCut()
            assert self.openPictureWithPhotosCmd(path), "Picture not exists!"
        elif self.multimedia_setting.get_android_version() == "O":
            self.launchGalleryAPPWithShortCut()
            assert self.openPictureWithGallery(path), "Picture not exists!"
        else:
            self.launchPhotoAPPWithShortCut()
            self.enterPhotoPath(path)
            assert self.checkPictureExist(
                os.path.split(path)[1]), "Picture not exists!"
        print "case " + str(case_name) + " is pass"

    def imageViewCheckFolder(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        path = self.video.cfg.get("push_picture").split(" ")[-1].strip("\"")
        path_2 = self.video.cfg.get("push_picture_2").split(" ")[-1].strip(
            "\"")
        print path, path_2
        self.multimedia_setting.push_file(self.video.cfg.get("push_picture_2"),
                                          self.video.cfg.get("datapath"))
        self.launchPhotoAPP()
        self.enterPhotoPath(path)
        file_name = os.path.split(path)[1]
        file_name_2 = os.path.split(path_2)[1]
        self.checkPictureExist(file_name)
        self.d.press.back()
        self.checkPictureExist(file_name)
        self.checkPictureExist(file_name_2)
        print "case " + str(case_name) + " is pass"

    def imageViewCheckSlideShow(self, case_name):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        path = self.video.cfg.get("push_picture").split(" ")[-1].strip("\"")
        path_2 = self.video.cfg.get("push_picture_2").split(" ")[-1].strip(
            "\"")
        print path, path_2
        self.multimedia_setting.push_file(self.video.cfg.get("push_picture_2"),
                                          self.video.cfg.get("datapath"))
        self.launchPhotoAPP()
        self.enterPhotoPath(path)
        file_name = os.path.split(path)[1]
        file_name_2 = os.path.split(path_2)[1]
        self.checkPictureExist(file_name)
        self.d(className="android.widget.ImageView").swipe.left()
        self.checkPictureExist(file_name_2)
        print "case " + str(case_name) + " is pass"

    def imageViewTenTimes(self, case_name, t_time=10):
        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)
        file_name = os.path.split(path)[1]
        self.checkPictureExist(file_name)
        for _ in range(10):
            self.d.press.back()
            self.d(text=file_name).click()
            self.checkPictureExist(file_name)
        print "case " + str(case_name) + " is pass"

    def getCpuConsumption(self):
        cmd = "shell top -m 1 -n 1"
        t_pattern = re.compile("User (.*)%, System (.*)%, IOW.*")
        result = g_common_obj.adb_cmd_common(cmd)
        print result
        if t_pattern.findall(result) != []:
            (t_user, t_system) = t_pattern.findall(result)[0]
            return int(t_user) + int(t_system)
        else:
            return 0

    def imageViewWithManyTimes(self, case_name, times):
        print "run case is " + str(case_name)
        self.appPrepare(case_name)
        cpu_1 = self.getCpuConsumption()
        for iteration in range(times):
            logger.debug("Execute {0} times, total {1} times".format(
                iteration + 1, times))
            self.launchPhotoAPP()
            time.sleep(5)
            g_common_obj.stop_app_am("com.intel.otc.instrument.otcphotos")
            time.sleep(4)
        time.sleep(10)
        cpu_2 = self.getCpuConsumption()
        logger.info("cpu_1={0}, cpu_2={1}".format(cpu_1, cpu_2))
        assert cpu_1 + 10 >= cpu_2, "Cpu Consumption error! cpu_1=%s, cpu_2=%s" % (
            cpu_1, cpu_2)
        print "case " + str(case_name) + " is pass"

    def imageViewBackHome(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("\"")
        print 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])
        self.d.press.home()
        self.multimedia_setting.click_recent_app("otcphoto-app")
        time.sleep(1)
        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 imageViewWithAlarm(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("\"")
        print path
        if flag != 1:
            self.multimedia_setting.push_file(
                self.video.cfg.get("push_picture_2"),
                self.video.cfg.get("datapath"))
        self.multimedia_setting.launchAlarmAPP()
        self.multimedia_setting.setAlarmTime(30)
        self.launchPhotoAPP()
        self.enterPhotoPath(path)
        self.checkPictureExist(os.path.split(path)[1])
        self.multimedia_setting.waitAlarmTriiggered(50, "Snooze")
        self.multimedia_setting.setAlarmTime(30)
        self.multimedia_setting.click_recent_app("otcphoto-app")
        time.sleep(1)
        self.checkPictureExist(os.path.split(path)[1])
        self.multimedia_setting.waitAlarmTriiggered(50, "Dismiss")
        self.multimedia_setting.click_recent_app("otcphoto-app")
        time.sleep(1)
        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 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 imageViewWithInvalidFile(self, case_name):
        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 + "test file patch:%s" % path)
        self.launchPhotoAPP()
        self.enterPhotoPath(os.path.split(path)[0])
        assert not self.d(text=os.path.split(path)[1]).exists, os.path.split(
            path)[1] + "Invalid file can be find! error!"
        print "case " + str(case_name) + " is pass"

    def imageViewZoomIn_ZoomOut(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])
        self.d(className="android.widget.ImageView").gesture(
            (self.x / 2, self.y / 2 - 20), (self.x / 2, self.y / 2)).to(
                (self.x / 2, self.y / 4), (self.x / 2, self.y * 3 / 4))
        self.checkPictureExist(os.path.split(path)[1])
        x1 = self.getPictureSize()
        assert x1 > 100, "ZoomIn error"
        time.sleep(2)
        self.d(className="android.widget.ImageView").gesture(
            (self.x / 2, self.y / 4), (self.x / 2, self.y * 3 / 4)).to(
                (self.x / 2, self.y / 2 - 20), (self.x / 2, self.y / 2))
        self.checkPictureExist(os.path.split(path)[1])
        x2 = self.getPictureSize()
        assert x1 > x2, "ZoomOut error"
        print "case " + str(case_name) + " is pass"

    def testImage_View_RotatePicture(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        2. Rotate picture to landscape mode
        3. Rotate picture to Portrait mode
        """
        self.imageViewRotatePicture("test_API_image_001")

    def testMultiMedia_Gallery_SlideShow_Continue_Idle(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        2. Press home
        """
        self.imageViewBackHome("test_API_image_002", 2)

    def testMultiMedia_Gallery3D_GIF_87a_ZoomIn_ZoomOut(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        2. Press home
        """
        self.imageViewZoomIn_ZoomOut("test_API_image_004")

    def testMultiMedia_Gallery3D_GIF_89a_ZoomIn_ZoomOut(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        2. Press home
        """
        self.imageViewZoomIn_ZoomOut("test_API_image_005")

    def testImage_ViewMode_Full_And_non_FullScreen_Switch(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewTenTimes("test_API_image_006", 10)

    def testMultiMedia_Gallery3D_SlideShow_AlarmReminder(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithAlarm("test_API_image_007", 2)

    def testImage_View_InvalidFile(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithInvalidFile("test_API_image_008")

    def testMultiMedia_Gallery_Format_UnSupportPicture(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithInvalidFile("test_API_image_009")

    def testMultiMedia_Gallery_SlideShow_Then_PowerOff_ON(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithReboot("test_API_image_010", 2)

    def testMultiMedia_Gallery_Format_ErrorPicture(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithInvalidFile("test_API_image_011")

    def testMultiMedia_Gallery3D_SlideShow_Multiple_Events(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithAlarm("test_API_image_012", 2)

    def testMultiMedia_MediaFramework_Display_Picture(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithInvalidFile("test_API_image_013")

    def testMultiMedia_Gallery3D_ViewImage_Larger_Than_5_or_8_MB(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheck("test_API_image_014")

    def test_Calendar_Alarm_EmailNote_When_SlideShow(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithAlarm("test_API_image_015", 2)

    def testMultiMedia_Gallery3D_Launch_Exit_30_Times(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithManyTimes("test_API_image_016", 30)

    def testMultiMedia_Gallery_Launch_Exit_100_Times(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithManyTimes("test_API_image_017", 100)

    def testImage_Number_Indicator(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckFolder("test_API_image_018")

    def testCalendar_Interact_When_View_Picture(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithAlarm("test_API_image_019")

    def testMultiMedia_Gallery_SlideShow_Long_Time(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckSlideShow("test_API_image_020")

    def testMultiMedia_Gallery_DifferentResolutions_3072x2304(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheck("test_API_image_021")

    def testMultiMedia_MediaFramework_Display_BigSize_Picture(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheck("test_API_image_022")

    def testMultiMedia_MediaFramework_Display_LittleSize_Picture(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheck("test_API_image_023")

    def testMultiMedia_Gallery_Enter_By_ShortCut(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithShortCut("test_API_image_024")

    def testJPEG_HW_Decode(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheck("test_API_image_025")

    def testMultiMedia_Gallery3D_Unsupported_Images_Videos(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewWithInvalidFile("test_API_image_026")

    def testMultiMedia_Gallery3D_Gesturing_Screen(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckSlideShow("test_API_image_027")

    def testMultiMedia_Gallery_Panning_Single(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        2. Press home
        """
        self.imageViewZoomIn_ZoomOut("test_API_image_028")

    def testApp_Install_When_View_Picture_Video_SlideShow(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithInstallApp("test_API_image_029", 2)

    def testMultiMedia_Gallery_Rotation_Background(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckWithRotation("test_API_image_030")

    def testMultiMedia_Gallery_Image_Review_SD_USB(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheck("test_API_image_031")

    def testImage_View_RotatePicture_ManyTimes(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewRotatePictureManyTimes("test_API_image_043", 20)

    def testVideo_NonExist(self):
        """
        This test used to test Image Decode
        The test case spec is following:
        1. Open a picture
        """
        self.imageViewCheckAfterDeleteFile("test_API_image_044")