예제 #1
0
 def extended_desktop_mosaic_mode_display_work_for_O(self):
     '''
     1. adb pull /vendor/etc/hwc_display.ini
         save Default setting file
     2. edit the file:
         MOSIAC="true"
         CLONE="False"
     3. adb push hwc_display.ini /vendor/etc/hwc_display.ini
     4. adb reboot
     '''
     self.check_car_mode_exists()
     self.multi_touch_screen_mode_setup()
     file_path = "./temp/files"
     file_name = "hwc_display.ini"
     os.system("mkdir -p {}".format(file_path))
     g_common_obj.adb_cmd_common("pull /vendor/etc/hwc_display.ini {}".format(file_path))
     file_path_name = os.path.join(file_path, file_name)
     bak_file = os.path.join(file_path, "hwc_display.ini_bak")
     os.system("cp {} {}".format(file_path_name, bak_file))
     cmd_1 = """ sed -i 's/MOSAIC="false"/MOSAIC="true"/g' {} """.format(file_path_name)
     cmd_2 = """ sed -i 's/CLONE="true"/CLONE="false"/g' {} """.format(file_path_name)
     os.system(cmd_1)
     os.system(cmd_2)
     time.sleep(2)
     g_common_obj.adb_cmd_common("push {} /vendor/etc/hwc_display.ini".format(file_path_name))
     self.reboot_devices()
     g_common_obj.adb_cmd_capture_msg("setenforce 0")
     self.extended_desktop_mosaic_mode_touch_work()
예제 #2
0
    def long_touch_on_1_1(self):
        """send event for long click on left top corner."""

        def _get_eventId():
            '''get the input equipment id'''
            temps=[]
            equipments = g_common_obj.adb_cmd_capture_msg("getevent -p")
            tmp = re.findall(r'(/dev/input/event\d+)|(input props:.*\n.*)', equipments)
            for i in range(len(tmp)):
                if i%2 == 0:
                    continue
                else:
                    n_equip = tmp[i-1][0] + '\n' + tmp[i][1].replace('input props:\n','').strip()
                    temps.append(n_equip)
            for _ in temps:
                t = _.splitlines()
                if t[1] != "<none>":
                    return re.findall(r'\d+', t[0])[0]

        do = 'long_touch_on_1_1'
        eventId = _get_eventId()
        assert do in self.actions
        assert eventId != ''

        cmd = 'sh %s/%s.sh %s' % (self.dut_res_dir, do, eventId)
        g_common_obj.adb_cmd_capture_msg(repr(cmd))
예제 #3
0
 def init_environment(self):
     """ Init the test environment
     """
     config = TestConfig()
     cfg_file = 'tests.tablet.artifactory.conf'
     cfg_arti = config.read(cfg_file, 'artifactory')
     config_handle = ConfigHandle()
     cfg_arti["location"] = config_handle.read_configuration('artifactory', 'location', '/etc/oat/', 'sys.conf')
     cfg = config.read(cfg_file, 'content_androidvid')
     self.arti = Artifactory(cfg_arti.get('location'))
     apk_name = cfg.get("name")
     file_path = self.arti.get(apk_name)
     print "%s" % file_path
     result = config_handle.check_apps(self.pkg_name)
     if result == 0:
         g_common_obj.adb_cmd_common('install ' + file_path)
     video_name = cfg.get("video_arti")
     video_path = self.arti.get(video_name)
     g_common_obj.adb_cmd_common('push ' + video_path + ' /sdcard/')
     cmd = "am broadcast -a \
     android.intent.action.MEDIA_MOUNTED -d file:///sdcard/"
     g_common_obj.adb_cmd(cmd)
     self.video = cfg.get("filename")
     bench_files = config.read(cfg_file, 'gfxbench31_files')
     busybox_path = self.arti.get(bench_files.get("busybox"))
     busybox_tar_path = bench_files.get("busybox_path")
     print g_common_obj.push_file(busybox_path, busybox_tar_path)
     print g_common_obj.adb_cmd_capture_msg("chmod 777 " + busybox_tar_path)
     self.md5_id = config.read(cfg_file, 'md5_id')
     self.check_path = self.md5_id.get('check_path')
 def play_and_record_video_with_instrument(self, cmd_arguments, case_name):
     duration = 12
     self.play_result = -1
     if self.camera_helper.android_version == "o":
         self.logger.debug(
             "play_and_record_video_with_instrument case_name=%s" %
             case_name)
         if "fps" in case_name.lower():
             cmd_arguments_list = cmd_arguments.split(" ")
             width, height = cmd_arguments_list[4], cmd_arguments_list[5]
         else:
             output_size = self.check_string_with_regular_expression(
                 case_name, r"_(\d*x\d*)", "")[1][1]
             width, height = output_size.split("x")
         t_format = "NV21" if "NV21" in case_name else "NV21"  #need extend
         cmd_result = g_common_obj.adb_cmd_capture_msg(
             self.o_image_play_cmd % (width, height, t_format, duration))
     else:
         self.logger.debug(
             "play_and_record_video_with_instrument cmd=%s %s" %
             (self.sh_file_dst_path, cmd_arguments))
         cmd_result = g_common_obj.adb_cmd_capture_msg(
             "%s %s" % (self.sh_file_dst_path, cmd_arguments))
     self.logger.debug(
         "play_and_record_video_with_instrument cmd_result = %s" %
         cmd_result)
     if "OK" not in cmd_result:
         self.play_result = 0
     else:
         self.play_result = 1
예제 #5
0
    def zoom_out(self):
        """send event for zoom out"""
        do = 'event_zoom_out'
        assert do in self.actions

        cmd = 'sh %s/%s.sh' % (self.dut_res_dir, do)
        g_common_obj.adb_cmd_capture_msg(repr(cmd))
예제 #6
0
 def get_result(self):
     cmd = "cat %s*.json" % (self.RESULT_DIR)
     cmd2 = "cat %s*.json" % (self.RESULT_DIR2)
     msg = g_common_obj.adb_cmd_capture_msg(repr(cmd))
     if msg.find("No such file or directory") != -1:
         msg = g_common_obj.adb_cmd_capture_msg(repr(cmd2))
     return msg
예제 #7
0
    def __wait_wifi_onoff_comp(onoff):
        """Wait Wi-Fi on/off complete"""
        cmd = 'dumpsys wifi | grep Wi-Fi; echo $?'
        loop = 40
        while(loop > 0):
            res_list = g_common_obj.adb_cmd_capture_msg(cmd).split('\r\n')

            if g_common_obj.adb_cmd_capture_msg("getprop |grep 'version.release'").split(':')[-1].strip() == '[O]':
                ret = int(res_list[-1][-1].strip())
            else:
                ret = int(res_list[-1].strip())
            if ret != 0:
                continue
            if onoff is True:
                if "enabled" in ''.join(res_list):
                    print "[INFO] Wifi is enabled."
                    break
                else:
                    print "[INFO] Wifi is enabling."
                    loop -= 1
                    time.sleep(3)
                    continue
            else:
                if "disabled" in ''.join(res_list):
                    print "[INFO] Wifi is disabled."
                    break
                else:
                    loop -= 1
                    time.sleep(3)
                    continue
예제 #8
0
 def hide_package(self, packageName):
     if packageName in self.get_packages():
         try:
             g_common_obj.adb_cmd_capture_msg('pm hide %s' % packageName)
             adb32._adb_reboot()
         except:
             raise Exception("Fail to hide given package.")
예제 #9
0
    def get_android_version(self):
        """adb shell getprop | grep ro.build.version.release"""
        array = []
        cmd = 'getprop | grep ro.build.version.release | cut -d ":" -f2 | cut -d "[" -f2 | cut -d "]" -f1'
        cmd1 = 'getprop | grep ro.build.version.release | cut -d ":" -f2 | cut -d "[" -f2 | cut -d "]" -f1 | cut -d "." -f1'
        cmd2 = 'getprop | grep ro.build.version.release | cut -d ":" -f2 | cut -d "[" -f2 | cut -d "]" -f1 | cut -d "." -f2'
        cmd3 = 'getprop | grep ro.build.version.release | cut -d ":" -f2 | cut -d "[" -f2 | cut -d "]" -f1 | cut -d "." -f3'
        #         androidversion, androidversion_mini, androidversion_micro = 0, 0, 0
        androidversion = g_common_obj.adb_cmd_capture_msg(cmd)
        androidversion_large = g_common_obj.adb_cmd_capture_msg(cmd1)
        if androidversion_large.isdigit():
            androidversion_mini = g_common_obj.adb_cmd_capture_msg(cmd2)
            androidversion_micro = g_common_obj.adb_cmd_capture_msg(cmd3)
            androidversion_large = 0 if len(
                androidversion_large) == 0 else int(androidversion_large)
            androidversion_mini = 0 if len(androidversion_mini) == 0 else int(
                androidversion_mini)
            androidversion_micro = 0 if len(
                androidversion_micro) == 0 else int(androidversion_mini)
        else:
            androidversion_large = androidversion_large.upper()
            print androidversion_large
            androidversion_large = ord(androidversion_large) - 71
            androidversion_mini = 0
            androidversion_micro = 0

        array.append(androidversion_large)
        array.append(androidversion_mini)
        array.append(androidversion_micro)
        print array
        return array
예제 #10
0
    def startApp(self):
        """
        Skip Email first launch screen
        """
        g_common_obj.launch_app_from_home_sc("Email")
        assert self.d(packageName = EmailImpl.mail_pkg_name).wait.exists()
        if self.d(textContains="Getting").exists:
            self.d(textContains="Getting").wait.gone(timeout=600000)
        assert not self.d(textContains="Getting").exists, \
        "ERROR: SYNC for more than 10 mins"
        if self.d(resourceId="com.android.email:id/account_email").exists:
            self.d(resourceId="com.android.email:id/account_email").click()
            g_common_obj.adb_cmd_capture_msg(
                "input text " + self.cfg.get("email_account"))
            time.sleep(2)
            self.d(resourceId="com.android.email:id/next").click()
            self.d(resourceId="com.android.email:id/regular_password").\
            wait.exists()
            self.d(resourceId="com.android.email:id/regular_password").click()
            time.sleep(2)
            g_common_obj.adb_cmd_capture_msg(
                "input text " + self.cfg.get("email_pwd"))
            time.sleep(2)
            self.d(resourceId="com.android.email:id/next").click()
            assert self.d(text="Account options").wait.exists(timeout=60000)
            for _ in (0, 10):
                if self.d(
                    resourceId="com.android.email:id/next")\
                .wait.exists(timeout=60000):
                    self.d(resourceId="com.android.email:id/next").click()
                else:
                    break
            assert self.d(text="Inbox").wait.exists(timeout=60000)

        g_common_obj.back_home()
예제 #11
0
 def enter_camera_from_home(self):
     """
     @summary: enter camera from home using am command
     """
     if self.ArcSoftCamera().lock_screen_icon().exists:
         g_common_obj.adb_cmd_capture_msg("input keyevent 82")
         self.logger.debug("unlock screen")
     time.sleep(3)
     self.d.press.home()
     os.system("adb shell am start -S %s/%s" %
               (self.PACKAGE_NAME_ARCSOFTCAMERA,
                self.ACTIVITY_NAME_ARCSOFTCAMERA))
     time_left = 0
     start = time.time()
     while time_left < 20:
         if self.isShutterBtnExists():
             break
         if self.GoogleDefaultCamera().camera_page_text("NEXT").exists():
             self.check_notification_after_switch_mode()
         self.checkCameraAccessDevicesLocation()
         time_left = time.time() - start
         time.sleep(0.5)
         self.judge_if_camera_crash()
     if not self.isWidgetExists(self.ArcSoftCamera().shutter_button()):
         assert False, "camera launch fail,launch time is greater than 20 seconds"
예제 #12
0
 def generate_test_file(self, dir_path, filename, fsize, location):
     """generate file with specified size"""
     file_path = os.path.join(dir_path, filename)
     print "Start to generate file: %s with size: %s on %s" % \
     (file_path, fsize, location)
     bs, count = self.parse_bs_count(fsize)
     assert_equals(bs>0, True, \
         "Fail to get proper bs and count value for dd command")
     cmd = "dd if=/dev/zero of=%s bs=%d count=%d" % (file_path, bs, count)
     print "Generate file with cmd: %s" % cmd
     if location.upper() == "DEVICE":
         # create folder
         create_folder_cmd = 'mkdir -p %s; echo $?' % dir_path
         g_common_obj.adb_cmd_capture_msg(create_folder_cmd)
         # create file
         cmd = "%s; echo $?" % cmd.rstrip()
         result_list = g_common_obj.adb_cmd_capture_msg(cmd).split('\n')
     elif location.upper() == "HOST":
         # create folder
         create_folder_cmd = 'mkdir -p %s 2>&1; echo $?' % dir_path
         os.popen(create_folder_cmd)
         # create file
         cmd = "%s 2>&1; echo $?" % cmd.rstrip()
         result_list = os.popen(cmd).readlines()
     else:
         assert_equals(False, True, \
             "Can not support this location information")
     if len(result_list):
         ret = result_list[-1].rstrip()
         assert_equals(int(ret), 0, "Generate file fail")
         print "Generate file successful"
     else:
         assert_equals(False, True, "Generate file fail")
예제 #13
0
 def check_app_launched_successfully(self, packagename, activityname):
     """
         @summary: check the app is launched successfully
     """
     app="%s/%s" %(packagename, activityname)
     cmd="dumpsys window|grep mCurrentFocus"
     currentfocus=g_common_obj.adb_cmd_capture_msg(cmd).strip()
     currentfocus_result=currentfocus.find(app)
     
     #handle the alternative windows for chrome
     if packagename=="com.android.chrome":
         app="com.android.chrome/com.google.android.apps.chrome"
         currentfocus=g_common_obj.adb_cmd_capture_msg(cmd).strip()
         currentfocus_result=currentfocus.find(app)
     #handle the alternative windows for photos
     elif packagename=="com.google.android.apps.photos":
         app="google.android.apps.plus/com.google.android.apps.photos.phone.PhotosHomeActivity"
         currentfocus=g_common_obj.adb_cmd_capture_msg(cmd).strip()
         currentfocus_result=currentfocus.find(app)
         if currentfocus_result==-1:
             app="com.google.android.apps.plus/.phone.PhotosIntroActivity"
             currentfocus=g_common_obj.adb_cmd_capture_msg(cmd).strip()
             currentfocus_result=currentfocus.find(app)
     #handle the alternative windows for music
     elif packagename=="com.google.android.music":
         if currentfocus_result==-1:
             app="com.google.android.music/.tutorial.TutorialSelectAccountActivity"
             currentfocus=g_common_obj.adb_cmd_capture_msg(cmd).strip()
             currentfocus_result=currentfocus.find(app)
     #########################
     errormessage= "[Error]: the app %s does not launch successfully" % app
     assert currentfocus_result!=-1, errormessage
     print "[INFO]: launch app successfully"
예제 #14
0
 def long_press_power_buttou(self):
     power_key_cmd = "input keyevent --longpress 26"
     for i in range(10):
         time.sleep(2)
         g_common_obj.adb_cmd_capture_msg(power_key_cmd)
         if self.d(text="Power off").exists:
             break
예제 #15
0
 def widevine_video_play(self, timeout=10):
     """
     @summary: play widevine drm protected video
     @return: None
     """
     self.launch_app_from_home_sc("Widevine Demo")
     self._locator.package_widevine.wait.exists(timeout=5000)
     self._locator.btn_stream.click()
     assert not self._locator.btn_no_content.exists, \
     "ERROR: The wifi is not available! Please check!"
     self._locator.btn_first_view.click.wait()
     self._locator.btn_acquire_rights.click()
     time.sleep(30)
     wide_info = self._locator.btn_wide_info.text
     wide_info = wide_info.encode('gbk')
     assert wide_info.find("Rights installed") != -1, \
     "ERROR: Acquire rights failed in 30s"
     self._locator.btn_first_video.click()
     time.sleep(60)
     wide_info = self._locator.btn_wide_info.text
     wide_info = wide_info.encode('gbk')
     assert wide_info.find("Playback start") != -1, \
     "ERROR: The video doesn't play in 60s"
     assert wide_info.find("Playback start.acquireRights = -2000") == -1, \
     "Acquire rights failed"
     time.sleep(timeout)
     assert not self._locator.btn_cannot_play.exists, \
     "Can not play this video!"
     self._locator.btn_stop.click()
     g_common_obj.adb_cmd_capture_msg("am force-stop com.widevine.demo")
예제 #16
0
 def check_notification_in_pdfreader(self):
     """ check notification during reading in FBReader
     """
     if self.d(text="Allow").exists:
         self.d(text="Allow").click.wait()
         time.sleep(1)
     if self.d(text="ALLOW").exists:
         self.d(text="ALLOW").click.wait()
         time.sleep(1)
     print "------------GFX_fbreader1-------------"
     # filter out not-match info
     cmd = "dumpsys SurfaceFlinger | grep -E 'StatusBar| NavigationBar' | grep -Ev '\:|\[|\('"
     msg1 = g_common_obj.adb_cmd_capture_msg(repr(cmd))
     print msg1
     assert msg1 == "", "The notification or statusbar is popuped"
     x = self.d.info["displayWidth"]
     y = self.d.info["displayHeight"]
     for _ in range(0, 5):
         self.d.swipe(x / 2, 0, x / 2, y)
         self.d.open.quick_settings()
         time.sleep(1)
         if self.d(
                 resourceId=
                 "com.android.systemui:id/quick_settings_container").exists:
             break
     time.sleep(3)
     print "------------GFX_fbreader2-------------"
     msg2 = g_common_obj.adb_cmd_capture_msg(repr(cmd))
     print msg2
     assert msg2 != "", "The notification not popup"
예제 #17
0
 def playVideoSecondDisplay(self, file_path):
     """
     Play the video using the second display in Gallery
     :return: True, launch success
     """
     g_common_obj.adb_cmd_common("logcat -c")
     play_cmd = 'am start --display 1 -a android.intent.action.VIEW -d "file://%s" -t "video/*" -n com.android.gallery3d/.app.MovieActivity' % file_path
     g_common_obj.adb_cmd_capture_msg(play_cmd)
     time.sleep(5)
     gallery_play_act = 'com.android.gallery3d/com.android.gallery3d.app.MovieActivity'
     display1_surface = g_common_obj.adb_cmd_capture_msg(
         "dumpsys SurfaceFlinger|grep  -A10 'Display 0 HWC layers' ")
     display2_surface = g_common_obj.adb_cmd_capture_msg(
         "dumpsys SurfaceFlinger|grep  -A10 'Display 1 HWC layers' ")
     logger.debug(
         self.tag +
         "Video play failed, display1_surface:\n {0},\ndisplay2_surface:\n{1}"
         .format(display1_surface, display2_surface))
     if gallery_play_act not in display1_surface and gallery_play_act in display2_surface:
         logger.debug(self.tag + "Video play in the second display")
     else:
         logger.debug(self.tag + "Video play failed")
         return False
     # check video play
     return self.checkVideoInfoFromLogcat()
예제 #18
0
    def push_pictures(self, count=1, exts=None):
        remote_pictures = []
        pictures = self.configer.read(self.config_file, "Pictures")
        if exts:
            pictures = {
                k: v
                for k, v in pictures.iteritems() if v.lower().endswith(exts)
            }
        if count > len(pictures.items()):
            assert False, \
                "[FAILURE] There are not enough resource."

        for _, value in pictures.iteritems():
            pic_path = self.arti.get(value)
            ret = g_common_obj.push_file(pic_path, self.dut_photos_dir)
            remote_pictures.append(self.dut_video_dir + '/' +
                                   os.path.basename(pic_path))
            assert ret, 'Failed push %s' % (pic_path)
            count -= 1
            if count == 0:
                break

        cmd = \
            "am broadcast -a android.intent.action.MEDIA_MOUNTED -d file://%s"\
            % (self.dut_photos_dir)
        g_common_obj.adb_cmd_capture_msg(repr(cmd))
        print "[Debug] pushed %s" % (remote_pictures)
        return remote_pictures
예제 #19
0
 def remove_file(self):
     """
     remove the screenshot file
     """
     os.system("rm -rf %s/%s" % (self.tmp, self.basic_folder))
     os.system("rm -rf " + self.stream_folder)
     g_common_obj.adb_cmd_capture_msg("rm -rf " + self.cfg.get("tar_path"))
 def power_off_device(self, sleepTime=1):
     self.d.wakeup()
     g_common_obj.adb_cmd_capture_msg("input keyevent 26")
     time.sleep(sleepTime)
     output = g_common_obj.adb_cmd_capture_msg("dumpsys window | grep mScreenOnFully")
     screenOff = output.find("mScreenOnFully=false")
     assert screenOff != -1, "backlight turned off failed."
예제 #21
0
 def _check_dependency(self):
     g_common_obj.root_on_device()
     g_common_obj.remount_device()
     g_common_obj.adb_cmd_capture_msg("logcat -G 16M")
     g_common_obj.adb_cmd_capture_msg("logcat -c")
     selection = {
         'L': 'apk_l',
         'M': 'apk_m',
         'N': 'apk_n',
         'O': 'apk_o',
         'P': 'apk_p'
     }
     if not pkgmgr.query_package_name(self.package_name):
         try:
             file_path = environment_utils.get_resource_file(
                 'tests.common.dEQP.conf', 'dEQP', selection[self.os_ver])
             pkgmgr.apk_install(file_path)
         except KeyError as e:
             print("DEQP app version not match with android os: %s" %
                   str(e))
         # Need to update above when new version is released.
     for i in self._mustpass_list:
         op = g_common_obj.adb_cmd_capture_msg('ls %s%s' %
                                               (self._mustpass_path, i))
         if 'No such file' in op or op == '':
             file_path = environment_utils.get_resource_file(
                 'tests.common.dEQP.conf', 'dEQP',
                 i.split('-')[0] + '_mustpass')
             if not g_common_obj.push_file(file_path, self._mustpass_path):
                 raise Exception(
                     "Fail to push must pass list, please use script to get resource before test."
                 )
예제 #22
0
 def videoEncodeIteration(self, case_name):
     """
     This test used to test video encode then playback
     The test case spec is following:
     1. Launch camera
     2. record video
     3. playback
     """
     print "run case is " + str(case_name)
     self.appPrepare(case_name)
     self.multimedia_camera_helper = MultiMediaCameraHelper()
     self.multimedia_camera_helper.camera.startCameraApp()
     self.multimedia_camera_helper.camera.selectMode("Video")
     camera_type = self.changeCameraTypeStr(self.video.cfg.get("camera_type"))
     if "bxtp" in self.multimedia_setting.get_paltform_hardware():
         logger.debug("For BXT, do not switch Rear/Front")
     else:
         self.multimedia_camera_helper.camera.switchRearOrFront(camera_type)
     resolution = self.multimedia_camera_helper.changeResolution(self.camera.cfg.get("resolution"))
     self.multimedia_camera_helper.camera.setVideoResolution(resolution, camera_type)
     record_times = int(self.camera.cfg.get("record_times"))
     record_time = int(self.camera.cfg.get("record_time"))
     for index in range(record_times):
         print "record_times is ", index
         total, used, free = self.multimedia_setting.get_sdcard_memory()
         if free < (total/30):
             g_common_obj.adb_cmd_capture_msg(" rm -rf /sdcard/DCIM/Camera/*")
             g_common_obj.adb_cmd_capture_msg(self.camera.cfg.get("refresh_sd"))
             break
         self.multimedia_camera_helper.camera.recordVideo(1, record_time)
     print "case " + str(case_name) + " is pass"
예제 #23
0
 def videoEncodeLongLasting(self, case_name):
     """
     This test used to test video encode then playback
     The test case spec is following:
     1. Launch camera
     2. record video
     """
     print "run case is " + str(case_name)
     self.appPrepare(case_name)
     self.camera.enter_camera_from_home()
     self.camera.switch_module_in_camera()
     self.camera.change_front_back_camera(self.camera.cfg.get("camera_type"))
     self.camera.click_camera_menu_setting_vert()
     self.camera.enter_camera_setting_video_quality()
     self.camera.set_camera_setting_video_quality(self.camera.cfg.get("resolution"),self.camera.cfg.get("camera_type"))
     self.camera.press_back()
     self.camera.press_back()
     start_time = time.time()
     record_time = int(self.camera.cfg.get("record_time"))
     while record_time > 0:
         record_time = record_time - (time.time() - start_time)
         total, used, free = self.multimedia_setting.get_sdcard_memory()
         if free < (total/30):
             g_common_obj.adb_cmd_capture_msg(" rm -rf /sdcard/DCIM/Camera/*")
             g_common_obj.adb_cmd_capture_msg(self.camera.cfg.get("refresh_sd"))
         self.camera.capture_video_camera_initial_page(record_time)
         print "case " + str(case_name) + " is pass"
예제 #24
0
 def clear_data(self):
     """
     @summary: clean browser data
     """
     clear_cmd = "pm clear com.android.chrome"
     g_common_obj.adb_cmd_capture_msg(clear_cmd)
     self.d.press.home()
예제 #25
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_handle = MultiMediaHandle()
        self.multimedia_setting = MultiMediaSetting(self.cfg_file)
        self.multimedia_drm_helper = MultiMediaDRMHelper()

        self.multimedia_setting.install_apk(
            "widevine_apk")  #install widevine apk
        self.widevine_package_name, self.widevine_activity_name = self.multimedia_setting.get_package_and_activity_name(
            "widevine_apk")

        if model == 1:  # play local video mode
            self.dst_path = self.cfg.get("dst_path")
            self.clearResourcefolder()
            self.dst_path = self.multimedia_setting.push_file_new(
                self.cfg.get("src_path"),
                self.dst_path)  #push video file to device
        elif model == 2:  # play network video mode
            self.src_path = self.cfg.get("src_path")

#         g_common_obj.set_vertical_screen()
        g_common_obj.stop_app_am(self.widevine_package_name)
        g_common_obj.adb_cmd_capture_msg("input keyevent 82")  #Unlock screen
예제 #26
0
    def testConfigFirstBootWizard(self):
        """
        Config first boot wizard
        """
        print "[RunTest]: %s" % self.__str__()

        self.d.wakeup()
        self.d.press("home")
        time.sleep(2)
        if self.d(textContains="Drive safely").exists:
            self.d(text="Owner").click.wait()
            return
        android_version_release = g_common_obj.adb_cmd_capture_msg(
            "getprop |grep 'version.release'").split(':')[-1].strip()
        ro_boot_hardware = g_common_obj.adb_cmd_capture_msg(
            "getprop |grep 'ro.boot.hardware'").split(':')[-1].strip()
        if (android_version_release == '[8.0.0]') or (android_version_release
                                                      == '[8.1.0]'):
            if ro_boot_hardware != '[androidia_64]':
                return
        if self.d(textContains="Chrome") or self.d(textContains="Play Store"):
            return
        self.d.wakeup()
        if self.d(resourceId="com.android.systemui:id/lock_icon"):
            self.func.close_lock_screen()
            return

        succeed = False
        for i in range(self.retry_num):
            try:
                if self.d(text="OK").exists:
                    self.d(text="OK").click.wait()

                if self.d(text="Welcome") or \
                        self.d(resourceId="com.google.android.setupwizard:id/welcome_title") or \
                        self.d(resourceId="com.google.android.setupwizard:id/start"):
                    self.d.click(100, 100)
                    self.d.click(self.x - 100, 100)
                    self.d.click(self.x - 100, self.y - 100)
                    self.d.click(100, self.y - 100)
                    time.sleep(2)
                    if self.d(text="OK").exists:
                        self.d(text="OK").click.wait()
                        self.d(text="OK").wait.gone(timeout=3000)
                    self.func.close_lock_screen()
                    succeed = True
                    return

                if self.d(text="Welcome") or \
                        self.d(resourceId="com.google.android.setupwizard:id/welcome_title") or \
                        self.d(resourceId="com.google.android.setupwizard:id/start"):
                    self.func.setup_guideline()
                    if self.d(text="OK").exists:
                        self.d(text="OK").click.wait()
                    succeed = True
                break
            except Exception as e:
                print e
        assert succeed
예제 #27
0
 def relaunchPhotos(self):
     g_common_obj.adb_cmd_capture_msg(
         "am broadcast -a android.intent.action.MEDIA_MOUNTED --ez read-only false -d file://storage/sdcard1"
     )
     time.sleep(5)
     g_common_obj2.launch_app_am("com.google.android.apps.photos", \
                                "com.google.android.apps.photos.localmedia.ui.LocalFoldersActivity")
     time.sleep(5)
예제 #28
0
 def test_files_downloaded(self):
     assert g_common_obj.adb_cmd_capture_msg(
         "getprop | grep BRCM"
     ), "DUT doesn't seem to have a broadcom gps chip, quit test"
     assert g_common_obj.adb_cmd_capture_msg('[ -e "/data/gps/lto2.dat" ] && echo "Pass" || echo "Fail"') == "Pass", \
     "The file lto2.dat not found!"
     assert g_common_obj.adb_cmd_capture_msg('[ -e "/data/gps/ltoStatus.txt" ] && echo "Pass" || echo "Fail"') == "Pass", \
     "The file ltoStatus.txt not found!"
예제 #29
0
 def clean(self):
     for each in [self.dut_photos_dir, self.dut_video_dir]:
         cmd = \
             "rm -rf %s/*; sync; "\
             "am broadcast -a android.intent.action.MEDIA_MOUNTED -d file://%s"\
             % (each, each)
         g_common_obj.adb_cmd_capture_msg(repr(cmd))
     special_actions.clean()
예제 #30
0
 def close_wifi(self):
     """ Close wifi
     """
     try:
         cmd = 'svc wifi disable'
         g_common_obj.adb_cmd_capture_msg(repr(cmd))
     except:
         pass