def test_Open16Tab(self):
        logger.info('Enter -- MUAT:ChromeTest:test_Open16Tab')
        
        #open chrome
        self.adb_tools.adb_shell("am start -n org.chromium.chrome/com.google.android.apps.chrome.Main")
        time.sleep(3)
        pc_max = self.d(resourceId='android:id/pc_max', className='android.widget.ImageView', packageName='org.chromium.chrome')
        pc_max.click()
        time.sleep(2)
        menuButton=self.d(resourceId='org.chromium.chrome:id/menu_button',packageName='org.chromium.chrome')
        menuButton.click()
        records=self.d(text=u"历史记录",packageName='org.chromium.chrome')
        records.click()
       
        for i in range(16):
            self.mouse.click(830,430,constants.MouseRightKey)
            self.mouse.click(890,460,constants.MouseLeftKey)
            time.sleep(1)
        str ='after open chrome 16 tab...\n' 
        getcpuinfo(str)
        #close chrome
        closebtn = self.d(resourceId='android:id/pc_close', className='android.widget.ImageView', packageName='org.chromium.chrome')
        closebtn.click()

        logger.info('Exit -- MUAT:ChromeTest:test_OpenChromeTab')
    def test_LanchTask(self):
        logger.info('Enter -- MUAT:ChromeTest:test_LanchTask')
        serial_number = None
        if self.param and self.param.parameters and self.param.parameters.serial_number:
            serial_number = self.param.parameters.serial_number
        #open chrome
        self.adb_tools.adb_shell("am start -n org.chromium.chrome/com.google.android.apps.chrome.Main")
        time.sleep(3)
        pc_max = self.d(resourceId='android:id/pc_max', className='android.widget.ImageView', packageName='org.chromium.chrome')
        self.assertTrue(pc_max.exists)
        pc_max.click()
        time.sleep(2)
        menuButton=self.d(resourceId='org.chromium.chrome:id/menu_button',packageName='org.chromium.chrome')
        menuButton.click()
        records=self.d(text=u"历史记录",packageName='org.chromium.chrome')
        records.click()
       
        for i in range(16):
            self.mouse.click(830,430,constants.MouseRightKey)
            self.mouse.click(890,460,constants.MouseLeftKey)
            time.sleep(1)
        str ='lanch taskmgr after open chrome 16 tab...\n' 
        getcpuinfo(str)
            
        wanted_re = re.compile(r'I.ActivityManager.*com.aliyun.mpc.taskmgr.*\+(.*)ms' )
        adb_log = AdbLog(mode=AdbLog.MODE_RE, wanted_re=wanted_re, logger=logger, serial_number=serial_number)
        adb_log.clear()
        adb_log.start()

        # start apk
        self.adb_tools.adb_shell('am start -n  com.aliyun.mpc.taskmgr/.TaskMgr')
        
        # check the log and get the data
        while True:
            if adb_log.result:
                break
            else:
                time.sleep(1)
        # store the result
        cost_time = 0
        try:
            if 's' in adb_log.result[0][0]:
                composit = adb_log.result[0][0].split('s')
                cost_time = int(composit[0]) * 1000 + int(composit[1])
            else:
                cost_time = int(adb_log.result[0][0])
        except:
            logger.error('retrieve cost time from (%s) error' % (adb_log.result))
        
        logger.info('start TaskMgr cost: %s' % (cost_time))
        # close apk
        self.adb_tools.adb_shell('am force-stop com.aliyun.mpc.taskmgr')
        #close chrome
        closebtn = self.d(resourceId='android:id/pc_close', className='android.widget.ImageView', packageName='org.chromium.chrome')
        closebtn.click()

        logger.info('Exit -- MUAT:ChromeTest:test_LanchTask')
    def test_Open10AppTab(self):
        logger.info('Enter -- MUAT:ChromeTest:test_Open10AppTab')
        serial_number = None
        if self.param and self.param.parameters and self.param.parameters.serial_number:
            serial_number = self.param.parameters.serial_number
        
        #open youku
        self.adb_tools.adb_shell('am start -n com.youku.phone.x86/com.youku.phone.x86.ActivityWelcome')
        time.sleep(3)
        #open ttpod
        logger.info('open the ttpod application................')
        self.adb_tools.adb_shell("am start -n com.sds.android.ttpod/.EntryActivity")
        time.sleep(3)
        #open QQ
        logger.info('open QQ application.......................')
        self.adb_tools.adb_shell("am start -n com.tencent.mobileqq/.activity.SplashActivity")
        time.sleep(3)
        #open xiami
        logger.info('open xiami application.......................')
        self.adb_tools.adb_shell("am start -n fm.xiami.main/fm.xiami.bmamba.activity.StartMainActivity")
        time.sleep(3)
        #open qianniu
        logger.info('open qianniiu application.......................')
        self.adb_tools.adb_shell('am start -n com.taobao.qianniu/.ui.InitActivity')
        time.sleep(3)
        #open weibo
        logger.info('open weibo application.......................')
        self.adb_tools.adb_shell('am start -n com.sina.weibotab/.ui.ActivitySplash')
        time.sleep(3)
        #open wps_pro
        logger.info('open wps application.......................')
        self.adb_tools.adb_shell("am start -n com.kingsoft.moffice_pro/cn.wps.moffice.documentmanager.PreStartActivity")
        time.sleep(3)
        #open gaode map
        logger.info('open minimap application.......................')
        self.adb_tools.adb_shell("am start -n com.autonavi.minimap/.Splashy")
        time.sleep(3)
        #open wangxin
        logger.info('open mobileim application.......................')
        self.adb_tools.adb_shell("am start -n com.alibaba.mobileim/.SplashActivity")
        time.sleep(3)
        #open taobao
        logger.info('open taobaoHD application.......................')
        self.adb_tools.adb_shell("am start -n com.taobao.apad/.activity.MainActivity")
        time.sleep(3)
        #open chrome
        self.adb_tools.adb_shell("am start -n org.chromium.chrome/com.google.android.apps.chrome.Main")
        time.sleep(3)
        pc_max = self.d(resourceId='android:id/pc_max', className='android.widget.ImageView', packageName='org.chromium.chrome')
        self.assertTrue(pc_max.exists)
        pc_max.click()
        time.sleep(2)
        menuButton=self.d(resourceId='org.chromium.chrome:id/menu_button',packageName='org.chromium.chrome')
        menuButton.click()
        records=self.d(text=u"历史记录",packageName='org.chromium.chrome')
        records.click()
        for i in range(16):
            self.mouse.click(830,430,constants.MouseRightKey)
            self.mouse.click(890,460,constants.MouseLeftKey)
            time.sleep(1)
        str ='after 10Apps open chrome 16 tab...\n' 
        getcpuinfo(str)
        #记录打开applist的时间
         # click blank region to disappear applist
        self.d.click(constants.MUAT_APP_LIST_EMPTY_X, constants.MUAT_APP_LIST_EMPTY_Y)
        time.sleep(1)
        # start adb log capture thread
        detect_re = re.compile(r'MPT click .(%s), (%s). at (.*)$' % (constants.MUAT_APP_LIST_POINT_X, constants.MUAT_APP_LIST_POINT_Y))
        wanted_re = re.compile(r'MPT: sf post one frame at (.*)$')

        adb_log = AdbLog(mode=AdbLog.MODE_RE | AdbLog.MODE_NEED_DETECT, wanted_re=wanted_re, detect_re=detect_re, logger=logger, serial_number=serial_number)
        adb_log.clear()
        adb_log.start()

        # click app list
        self.d.click(constants.MUAT_APP_LIST_POINT_X, constants.MUAT_APP_LIST_POINT_Y)
        logger.debug('click applist point (%s,%s)' % (constants.MUAT_APP_LIST_POINT_X, constants.MUAT_APP_LIST_POINT_Y))
        time.sleep(2)

        # check the log and get the data
        while True:
            if len(adb_log.result) == 2:
                break
            else:
                time.sleep(1)

        # store the result
        click_point_x = 0
        click_point_y = 0
        start_time = 0
        end_time = 0
        cost_time = 0
        try:
            click_point_x   = int(adb_log.result[0][0])
            click_point_y   = int(adb_log.result[0][1])
            start_time      = int(adb_log.result[0][2])
            end_time        = int(adb_log.result[1][0])
            if click_point_x == constants.MUAT_APP_LIST_POINT_X and click_point_y == constants.MUAT_APP_LIST_POINT_Y:
                cost_time = end_time - start_time
            else:
                logger.error('detect_re detect the wrong point: (%s)' % (adb_log.result[0]))
        except:
            logger.error('retrieve time from (%s) error' % (adb_log.result))

        logger.info('after 10Apps start applist cost: %s' % (cost_time))
        self.d.click(constants.MUAT_APP_LIST_EMPTY_X, constants.MUAT_APP_LIST_EMPTY_Y)
        wanted_re = re.compile(r'I.ActivityManager.*com.aliyun.mpc.taskmgr.*\+(.*)ms' )
        adb_log = AdbLog(mode=AdbLog.MODE_RE, wanted_re=wanted_re, logger=logger, serial_number=serial_number)
        adb_log.clear()
        adb_log.start()
        
        #记录打开任务管理器的时间
        # start apk
        self.adb_tools.adb_shell('am start -n  com.aliyun.mpc.taskmgr/.TaskMgr')
        
        # check the log and get the data
        while True:
            if adb_log.result:
                break
            else:
                time.sleep(1)
        # store the result
        cost_time = 0
        try:
            if 's' in adb_log.result[0][0]:
                composit = adb_log.result[0][0].split('s')
                cost_time = int(composit[0]) * 1000 + int(composit[1])
            else:
                cost_time = int(adb_log.result[0][0])
        except:
            logger.error('retrieve cost time from (%s) error' % (adb_log.result))
        
        logger.info('after 10Apps start TaskMgr cost: %s' % (cost_time))
        # close apk
        self.adb_tools.adb_shell('am force-stop com.aliyun.mpc.taskmgr')
        
        #close youku
        logger.info('close the youku application................')
        self.adb_tools.adb_shell('am force-stop com.youku.phone.x86')
        time.sleep(2)
        #close ttpod
        logger.info('close the ttpod application................')
        self.adb_tools.adb_shell("am force-stop com.sds.android.ttpod")
        time.sleep(2)
        #close QQ
        logger.info('close QQ application.......................')
        self.adb_tools.adb_shell("am force-stop com.tencent.mobileqq")
        time.sleep(2)
        #close xiami
        logger.info('close xiami application.......................')
        self.adb_tools.adb_shell("am force-stop fm.xiami.main")
        time.sleep(2)
        #close qianniu
        logger.info('close qianniiu application.......................')
        self.adb_tools.adb_shell('am force-stop com.taobao.qianniu')
        time.sleep(2)
        #close weibo
        logger.info('close weibo application.......................')
        self.adb_tools.adb_shell('am force-stop com.sina.weibotab')
        time.sleep(2)
        #open wps_pro
        logger.info('close wps application.......................')
        self.adb_tools.adb_shell("am force-stop com.kingsoft.moffice_pro")
        time.sleep(2)
        #close gaode map
        logger.info('close minimap application.......................')
        self.adb_tools.adb_shell("am force-stop com.autonavi.minimap")
        time.sleep(2)
        #close wangxin
        logger.info('close mobileim application.......................')
        self.adb_tools.adb_shell("am force-stop com.alibaba.mobileim")
        time.sleep(2)
        #close taobao
        logger.info('close taobaoHD application.......................')
        self.adb_tools.adb_shell("am force-stop com.taobao.apad")
        time.sleep(2)
        #close chrome
        closebtn = self.d(resourceId='android:id/pc_close', className='android.widget.ImageView', packageName='org.chromium.chrome')
        closebtn.click()
        
        logger.info('Exit -- MUAT:ChromeTest:test_Open10AppTab')
        
        
        
        
        
        
        
        
        
        
        
    def test_LanchApplist(self):
        logger.info('Enter -- MUAT:ChromeTest:test_LanchApplist')
        serial_number = None
        if self.param and self.param.parameters and self.param.parameters.serial_number:
            serial_number = self.param.parameters.serial_number
        #open chrome
        self.adb_tools.adb_shell("am start -n org.chromium.chrome/com.google.android.apps.chrome.Main")
        time.sleep(3)
        pc_max = self.d(resourceId='android:id/pc_max', className='android.widget.ImageView', packageName='org.chromium.chrome')
        pc_max.click()
        time.sleep(2)
        menuButton=self.d(resourceId='org.chromium.chrome:id/menu_button',packageName='org.chromium.chrome')
        menuButton.click()
        records=self.d(text=u"历史记录",packageName='org.chromium.chrome')
        records.click()
        # 从历史记录中打开网页
        for i in range(16):
            self.mouse.click(830,430,constants.MouseRightKey)
            self.mouse.click(890,460,constants.MouseLeftKey)
            time.sleep(1)
        str ='lanch applist after open chrome 16 tab...\n' 
        getcpuinfo(str)
            
        # click blank region to disappear applist
        self.d.click(constants.MUAT_APP_LIST_EMPTY_X, constants.MUAT_APP_LIST_EMPTY_Y)
        time.sleep(1)

        # start adb log capture thread
        detect_re = re.compile(r'MPT click .(%s), (%s). at (.*)$' % (constants.MUAT_APP_LIST_POINT_X, constants.MUAT_APP_LIST_POINT_Y))
        wanted_re = re.compile(r'MPT: sf post one frame at (.*)$')

        adb_log = AdbLog(mode=AdbLog.MODE_RE | AdbLog.MODE_NEED_DETECT, wanted_re=wanted_re, detect_re=detect_re, logger=logger, serial_number=serial_number)
        adb_log.clear()
        adb_log.start()

        # click app list
        self.d.click(constants.MUAT_APP_LIST_POINT_X, constants.MUAT_APP_LIST_POINT_Y)
        logger.debug('click applist point (%s,%s)' % (constants.MUAT_APP_LIST_POINT_X, constants.MUAT_APP_LIST_POINT_Y))
        time.sleep(2)

        # check the log and get the data
        while True:
            if len(adb_log.result) == 2:
                break
            else:
                time.sleep(1)

        # store the result
        click_point_x = 0
        click_point_y = 0
        start_time = 0
        end_time = 0
        cost_time = 0
        try:
            click_point_x   = int(adb_log.result[0][0])
            click_point_y   = int(adb_log.result[0][1])
            start_time      = int(adb_log.result[0][2])
            end_time        = int(adb_log.result[1][0])
            if click_point_x == constants.MUAT_APP_LIST_POINT_X and click_point_y == constants.MUAT_APP_LIST_POINT_Y:
                cost_time = end_time - start_time
            else:
                logger.error('detect_re detect the wrong point: (%s)' % (adb_log.result[0]))
        except:
            logger.error('retrieve time from (%s) error' % (adb_log.result))

        logger.info('start applist cost: %s' % (cost_time))
        self.d.click(constants.MUAT_APP_LIST_EMPTY_X, constants.MUAT_APP_LIST_EMPTY_Y)
        time.sleep(1)
        #close chrome
        closebtn = self.d(resourceId='android:id/pc_close', className='android.widget.ImageView', packageName='org.chromium.chrome')
        closebtn.click()
        logger.info('Exit -- MUAT:ChromeTest:test_LanchApplist')
	def test_OpenChromeTab(self):
		logger.info('Enter -- MUAT:ChromeTest:test_OpenChromeTab')
		#open youku
		self.adb_tools.adb_shell('am start -n com.youku.phone.x86/com.youku.phone.x86.ActivityWelcome')
		time.sleep(3)
		#open ttpod
		logger.info('open the ttpod application................')
		self.adb_tools.adb_shell("am start -n com.sds.android.ttpod/.EntryActivity")
		time.sleep(3)
		#open QQ
		logger.info('open QQ application.......................')
		self.adb_tools.adb_shell("am start -n com.tencent.mobileqq/.activity.SplashActivity")
		time.sleep(3)
		#open xiami
		logger.info('open xiami application.......................')
		self.adb_tools.adb_shell("am start -n fm.xiami.main/fm.xiami.bmamba.activity.StartMainActivity")
		time.sleep(3)
		#open qianniu
		logger.info('open qianniiu application.......................')
		self.adb_tools.adb_shell('am start -n com.taobao.qianniu/.ui.InitActivity')
		time.sleep(3)
		#open weibo
		logger.info('open weibo application.......................')
		self.adb_tools.adb_shell('am start -n com.sina.weibotab/.ui.ActivitySplash')
		time.sleep(3)
		#open wps_pro
		logger.info('open wps application.......................')
		self.adb_tools.adb_shell("am start -n com.kingsoft.moffice_pro/cn.wps.moffice.documentmanager.PreStartActivity")
		time.sleep(3)
		#open gaode map
		logger.info('open minimap application.......................')
		self.adb_tools.adb_shell("am start -n com.autonavi.minimap/.Splashy")
		time.sleep(3)
		#open wangxin
		logger.info('open mobileim application.......................')
		self.adb_tools.adb_shell("am start -n com.alibaba.mobileim/.SplashActivity")
		time.sleep(3)
		#open taobao
		logger.info('open taobaoHD application.......................')
		self.adb_tools.adb_shell("am start -n com.taobao.apad/.activity.MainActivity")
		time.sleep(3)
		#open alilang
# 		logger.info('open alilang application.......................')
# 		self.adb_tools.adb_shell("am start -n com.alibaba.android.security.activity/.WelcomeActivity")
# 		time.sleep(3)
		getcpuinfo("after open 10 app.....\n")
		time.sleep(10)
		#browser
		self.adb_tools.adb_shell("am start -n com.android.browser/.BrowserActivity")
		time.sleep(3)
		url = self.d(resourceId='com.android.browser:id/url', className='android.widget.EditText', packageName='com.android.browser')
		url.clear_text()
		url.set_text('cun.taobao.com')
		self.d.press(0x42)
		time.sleep(3)
		getcpuinfo("after open 1 tab....\n")
		for i in range(15):
			tabbtn = self.d(resourceId='com.android.browser:id/newtab')
			tabbtn.click()
			time.sleep(2)
			url = self.d(resourceId='com.android.browser:id/url')
			url.clear_text()
			url.set_text("cun.taobao.com")
			self.d.press(0x42)
			time.sleep(3)
			info = "open %s tab...\n" % (i+2)
			getcpuinfo(info)


		time.sleep(10)
		closebtn = self.d(resourceId="android:id/pc_close", className="android.widget.ImageView", packageName="com.android.browser")
		closebtn.click()
		time.sleep(3)
		getcpuinfo("after close the browser......\n")
		time.sleep(10)
		#open chrome
		self.adb_tools.adb_shell("am start -n org.chromium.chrome/com.google.android.apps.chrome.Main")
		time.sleep(3)
# 		pc_max = self.d(resourceId='android:id/pc_max', className='android.widget.ImageView', packageName='org.chromium.chrome')
# 		pc_max.click()
# 		time.sleep(2)
		# url_bar = self.d(resourceId='org.chromium.chrome:id/url_bar')
		# url_bar.click()
		# url_bar.clear_text()
		# url_bar.set_text("cun.taobao.com")
		# self.d.press(0x42)
		# time.sleep(5)
		getcpuinfo("after open chrome 1 tab.....\n")
		# d = Device('F3YMD3000812')
		# d.press(0x3e, 0x71)
		time.sleep(10)
		for i in range(15):
			# d.press(0x30, 0x71)
			# new_tab = self.d(resourceId='empty_new_tab_button')
			# new_tab.click()
			# time.sleep(3)
			# url_bar = self.d(resourceId='org.chromium.chrome:id/url_bar')
			# url_bar.click()
			# url_bar.clear_text()
			# url_bar.set_text("cun.taobao.com")
			# self.d.press(0x42)
			# time.sleep(5)
			# self.d(className='android.view.View').child(index=0).click()
			#self.mouse.click(940, 466, constants.MouseLeftKey)
			time.sleep(1)
			self.d(resourceId='org.chromium.chrome:id/menu_button', className='android.widget.ImageButton').click()
			time.sleep(2)
			self.d(resourceId='org.chromium.chrome:id/menu_item_text').click()
			time.sleep(1)
			url_bar = self.d(resourceId='org.chromium.chrome:id/url_bar')
			url_bar.clear_text()
			url_bar.set_text("cun.taobao.com")
			self.d.press(0x42)
			time.sleep(2)
# 			self.d(resourceId='org.chromium.chrome:id/title').click()
# 			time.sleep(10)
			str ='after open chrome %s tab...\n' % (i+2)
			getcpuinfo(str)
		#close chrome
		closebtn = self.d(resourceId='android:id/pc_close', className='android.widget.ImageView', packageName='org.chromium.chrome')
		closebtn.click()

		logger.info('Exit -- MUAT:ChromeTest:test_OpenChromeTab')