def get_memory_data(package_name, pic_name='memory'):
        i = 0
        last_page_name = ''
        last_memory_data = 0
        memory_increase = 0
        while i < config.collect_data_count:
            LogUtil.log_i('Inspect memory')
            memory_data = int(AndroidUtil.get_memory_data(package_name))  # 当前采集到的数据
            now_page_name = AndroidUtil.get_cur_activity()
            # 目前暂时粗略的计算增量,当页面不一样时,计算增量
            if now_page_name != last_page_name:
                memory_increase = memory_data - last_memory_data
                if memory_increase < 0:
                    # 对于发生GC的情况,内存增量可能是负值, 暂时先不做处理
                    pass
                PerformanceControl.memory_datas.append([now_page_name, last_page_name, memory_increase])
                last_page_name = now_page_name
            else:
                last_memory_data = memory_data
                i += 1
                continue
            # 内存增量大于某个值就认为是有问题
            if memory_increase >= 10 * 1024:
                AdbUtil.screenshot(pic_name)
                LogUtil.log_i('Inspect memory 12')
            LogUtil.log_i('Inspect memory 13')

            # 设定多久采集一次数据
            time.sleep(config.collect_data_interval)
            i += 1
        def handle_error_data(frame_count, jank_count, fps, current_page):
            # 暂时当fps < 50 或者 jank_count > 10 我们认为是不达标的
            if fps < 50 or jank_count > 10:
                # 截图
                AdbUtil.screenshot(self.pic_name)
                # 保存日志

                GetFpsDataThread.fps_error_datas.append([
                    frame_count, jank_count, fps, current_page, self.pic_name
                ])
    def get_cpu_data_silent(package_name, pic_name='cpu'):
        i = 0
        while i < config.collect_data_count:
            LogUtil.log_i('Inspect cpu')
            current_page, cpu_data = AndroidUtil.get_cpu_data(package_name)  # 当前采集到的数据
            if cpu_data >= 50.00:

                AdbUtil.screenshot(pic_name)
            else:
                pass
            PerformanceControl.cpu_datas.append([current_page, cpu_data])
            time.sleep(config.collect_data_interval)  # 设定多久采集一次数据
            i += 1
        LogUtil.log_i('Inspect cpu finish')
 def run(self):
     exec_count = 0
     while True:
         LogUtil.log_i('Inspect cpu')
         if exec_count > config.collect_data_count:
             break
         current_page, cpu_datas = AndroidUtil.get_cpu_data(self.package_name)#当前采集到的数据
         if cpu_datas >= 50.00:
             # 对错误进行处理
             AdbUtil.screenshot(self.pic_name)
         else:
             pass
         GetCpuDataThread.cpu_datas.append([current_page, cpu_datas])
         # 设定多久采集一次数据
         time.sleep(config.collect_data_interval)
         exec_count += 1
     LogUtil.log_i('Inspect cpu finish')
Esempio n. 5
0
 def run(self):
     i = 0
     pkgName = config.test_package_name
     while i < config.collect_data_count:
         LogUtil.log_i('Inspect cpu')
         cpudata = AndroidUtil.get_cpu_data(pkgName)  #当前采集到的数据
         if cpudata >= 50.00:
             cpuerror = cpudata
             self.CPUerror.append(cpuerror)
             AdbUtil.screenshot()
         else:
             pass
         self.CPUdata.append(cpudata)
         time.sleep(config.collect_data_interval)  #设定多久采集一次数据
         i += 1
     print "CPUerror:", self.CPUerror, "CPUdata:", self.CPUdata
     GetCpuDataThread.task_finish = True
     LogUtil.log_i('Inspect cpu finish')
Esempio n. 6
0
    def run(self):
        i = 0
        pkgName = config.test_package_name
        while i < config.collect_data_count:
            LogUtil.log_i('Inspect memory')
            memorydata = int(AndroidUtil.get_memory_data(pkgName))  #当前采集到的数据
            if memorydata >= 50 * 1024:
                memoryerror = memorydata
                self.Memoryerror.append(memoryerror)
                AdbUtil.screenshot()
                LogUtil.log_i('Inspect memory 12')
            LogUtil.log_i('Inspect memory 13')
            self.Memorydata.append(memorydata)
            # time.sleep(self.interval)#设定多久采集一次数据
            i += 1

        GetMemoryDataThread.task_finish = True
        print self.Memoryerror, self.Memorydata
Esempio n. 7
0
def get_battery_data():

    # 创建存放测试数据本地目录
    if not os.path.exists(data_folder):
        os.mkdir(data_folder)
    battery_data = AdbUtil.get_battery_data(package_name)
    # 现将结果写入到txt中
    fo = open(data_folder + '/batterystats.txt', 'wb')
    fo.write(battery_data)
    fo.close()

    # 解析采集的电量数据
    # 思路是:每种数据之间会有空格分隔,以空格作为分隔
    battery_data = battery_data.split('Estimated power use (mAh):')[1].strip()
    battery_data = battery_data.split('\r\n')

    pkg_name = ''
    compute_drain = ''
    actual_drain = ''
    for i in range(len(battery_data)):
        # 处理整体电流情况
        if i == 0:
            battery_total_data = battery_data[i]
            battery_total_datas = battery_total_data.split(',')
            compute_drain = battery_total_datas[1]
            actual_drain = battery_total_datas[2]
            continue
        # 处理单个uid消耗电量的情况
        battery_str = battery_data[i]
        if battery_str is None or battery_str == '':
            break
        battery_strs = battery_str.split(': ')
        uid = battery_strs[0].strip()
        # 处理uid,查找出packagename
        if uid is not None and 'Uid' in uid:
            uid_uid = uid.split(' ')[1]
            if 'u0' in uid_uid:
                uid_uid = 'u0_' + uid_uid[2:]
                pkg_name = AdbUtil.get_package_name_by_uid(uid_uid)
        battery_str_data = battery_strs[1]
        battery_excel_data.append([uid, pkg_name, battery_str_data])
        pkg_name = ''
        i += 1
    return compute_drain, actual_drain, battery_excel_data
Esempio n. 8
0
def get_silent_cpu_data(pic_name='silent_cpu'):
    exec_count = 0
    while True:
        if exec_count > config.collect_data_count:
            __pre_silent_cpu_data()
            __publish_silent_cpu_data()
            break
        # if config.run_finish or config.run_silent_state == config.SlientState.FINISH:
        #     break
        LogUtil.log_i('silent Inspect cpu')
        current_page, cpu_data = AndroidUtil.get_cpu_data(
            package_name)  # 当前采集到的数据
        if cpu_data >= 50.00:

            AdbUtil.screenshot(pic_name)
        else:
            pass
        cpu_datas_silent.append([current_page, cpu_data])
        time.sleep(config.collect_data_interval)  # 设定多久采集一次数据
        exec_count += 1
    LogUtil.log_i('silent Inspect cpu finish')
Esempio n. 9
0
def get_memory_data(pic_name='memory'):
    exec_count = 0
    while True:
        if exec_count > config.collect_data_count:
            __pre_memory_data()
            __publish_memory_data()
            break
        # if config.run_finish:
        #     break

        LogUtil.log_i('Inspect memory' + str(exec_count))
        memory_data = int(
            AndroidUtil.get_memory_data(package_name))  # 当前采集到的数据
        now_page_name = AndroidUtil.get_cur_activity()
        memory_datas.append([now_page_name, memory_data])
        # 内存增量大于某个值就认为是有问题
        if memory_data >= 10 * 1024:
            AdbUtil.screenshot(pic_name)

        # 设定多久采集一次数据
        time.sleep(config.collect_data_interval)
        exec_count += 1
Esempio n. 10
0
    def run(self):
        exec_count = 0
        last_page_name = ''
        last_memory_data = 0
        try:
            while True:
                LogUtil.log_i('Inspect memory')
                if exec_count > config.collect_data_count:
                    break
                memory_data = int(
                    AndroidUtil.get_memory_data(self.package_name))  #当前采集到的数据
                now_page_name = AndroidUtil.get_cur_activity()
                # 目前暂时粗略的计算增量,当页面不一样时,计算增量
                if now_page_name != last_page_name:
                    memory_increase = memory_data - last_memory_data
                    if memory_increase < 0:
                        # 对于发生GC的情况,内存增量可能是负值, 暂时先不做处理
                        pass
                    GetMemoryDataThread.memory_datas.append(
                        [now_page_name, last_page_name, memory_increase])
                    last_page_name = now_page_name
                else:
                    last_memory_data = memory_data
                    exec_count += 1
                    continue

                # 内存增量大于某个值就认为是有问题
                if memory_increase >= 10 * 1024:
                    AdbUtil.screenshot(self.pic_name)
                    LogUtil.log_i('Inspect memory 12')
                LogUtil.log_i('Inspect memory 13')

                # 设定多久采集一次数据
                time.sleep(config.collect_data_interval)
                exec_count += 1
        except Exception as e:
            LogUtil.log_e('get cpu error' + e.message)
    def can_collect_data(package_name):
        # 1. 判断手机是否连接
        mobile_connect = AdbUtil().attach_devices()
        tips = ''
        if not mobile_connect:
            tips = '请连接设备,当前无设备可用'
            return mobile_connect, tips

        # 2. 判断当前进程是否还活着
        process_alive = AndroidUtil.process_alive(package_name)
        if not process_alive:
            tips = 'app进程已被杀死,请打开app后再开始测试'
            return process_alive, tips

        return True, tips
Esempio n. 12
0
def auto_collect_data_process():
    try:
        # 获取测试应用的包名和版本号,存到数据库中
        version_code = AdbUtil.get_verson(package_name)
        common_data_list.append([package_name, version_code, ''])
        __save_package_version()
        # 创建进程池来执行进程
        # result = None
        pool = multiprocessing.Pool(processes=6)
        # result = pool.apply_async(run_monkey, (config.test_package_name(), RUN_MONKEY_COUNT,))
        result = None
        for i in range(len(METHOD_ARRAY)):
            result = pool.apply_async(get_data, (METHOD_ARRAY[i], ))
        pool.close()
        pool.join()
        if result.successful():
            LogUtil.log_i('excute success')
        LogUtil.log_i('All process worked!!')
    except Exception as e:
        LogUtil.log_e('collect data failure ' + e.message)
 def handle_error_data(cost_time):
     if cost_time != '' and cost_time is not None:
         cost_time_value = handle_cost_time(cost_time)
         if cost_time_value > 3000:
             AdbUtil.screenshot(pic_name)
 def handle_error_data(jank_count, fps):
     # 暂时当fps < 50 或者 jank_count > 10 我们认为是不达标的
     if fps < 50 or jank_count > 10:
         # 截图
         AdbUtil.screenshot(pic_name)
Esempio n. 15
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
import time
from util.AndroidUtil import AndroidUtil
from util.AdbUtil import AdbUtil
from util.LogUtil import LogUtil
import common.GlobalConfig as config

__author__ = 'lzz'
"""
function: 采集内存数据的逻辑
date:2016/11/23

"""
AdbUtil = AdbUtil()
AndroidUtil = AndroidUtil()


class GetMemoryDataThread(threading.Thread):
    # 用于收集所有的内存数据
    memory_datas = []

    def __init__(self, thread_id, package_name, pic_name='memory'):
        threading.Thread.__init__(self)
        self.threadId = thread_id

        GetMemoryDataThread.clear_data()
        self.pic_name = pic_name
        self.package_name = package_name
Esempio n. 16
0
 def handle_error_data():
     if self.cost_time != '' and self.cost_time is not None:
         cost_time_value = handle_cost_time(self.cost_time)
         if cost_time_value > 3000:
             AdbUtil.screenshot(self.pic_name)
             GetKpiDataThread.kpi_error_datas.append([self.now_page_name, self.jump_page, self.cost_time, self.pic_name])
Esempio n. 17
0
def publish_battery_data():
    if len(battery_excel_data) < 1:
        return
    version_code = AdbUtil.get_verson(package_name)
    BatteryData().save_db_data(battery_excel_data, package_name, version_code)
Esempio n. 18
0
from util.AndroidUtil import AndroidUtil
from util.LogUtil import LogUtil
from performance.models import *

__author__ = 'zhouliwei'
"""
function: 用于收集数据并进行处理、保存的逻辑
date:2016/11/25

"""
# 跑monkey的次数
RUN_MONKEY_COUNT = 150

# 当前测试的包名
package_name = config.test_package_name
version_code = AdbUtil.get_verson(package_name)

METHOD_ARRAY = ['cpu', 'memory', 'kpi', 'fps', 'flow']
# METHOD_ARRAY = ['cpu', 'memory', 'kpi', 'fps', 'flow', 'monkey']
SILENT_ARRAY = ['cpu', 'flow']

# 用于存放计算之后的值[平均fps, 平均jank_count]
fps_data_dict = {}

# 用于存放计算之后的cpu值
cpu_data_dict = {}

# 用于存放计算之后的kpi值
kpi_data_dict = {}

# 用于存放计算之后的memory值
Esempio n. 19
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.adbUtil = AdbUtil()
        self.operAdbWin = AdbOperateWin()
        self.deviceList = []
        self.adbCmdList = []
        mainLayout = QtGui.QVBoxLayout()
        devicesGroupBox = QtGui.QGroupBox(_fromUtf8("设备"))
        operateGroupBox = QtGui.QGroupBox(_fromUtf8("操作"))
        operationAdbListGroupBox = QtGui.QGroupBox(_fromUtf8("指令"))
        adbListGroupBox = QtGui.QGroupBox(_fromUtf8("常用指令集"))
        firstHBox = QtGui.QHBoxLayout()
        devicesHBox = QtGui.QHBoxLayout()
        operationAdbListHBox = QtGui.QHBoxLayout()
        operateHBox = QtGui.QHBoxLayout()
        adbListHBox = QtGui.QHBoxLayout()

        self.getDevicesBtn = QtGui.QPushButton(_fromUtf8("获取设备"))
        self.getDevicesBtn.connect(self.getDevicesBtn,
                                   QtCore.SIGNAL('clicked()'),
                                   self.getDevicesBtnClick)
        self.getDevicesBtn.connect(self.getDevicesBtn,
                                   QtCore.SIGNAL('getDeviceSuccessSignal'),
                                   self.getDeviceSucess)
        self.devicesListComboBox = QtGui.QComboBox()
        self.devicesListComboBox.connect(
            self.devicesListComboBox,
            QtCore.SIGNAL('currentIndexChanged(QString)'),
            self.deviceComboBoxCurrentChange)

        operListPackagesBtn = QtGui.QPushButton(_fromUtf8("APP包列表"))
        operScreenCapBtn = QtGui.QPushButton(_fromUtf8("截屏"))
        operStartScreenRecordBtn = QtGui.QPushButton(_fromUtf8("开始录屏"))
        operStopScreenRecordBtn = QtGui.QPushButton(_fromUtf8("结束录屏"))
        operListPackagesBtn.connect(operListPackagesBtn,
                                    QtCore.SIGNAL('clicked()'),
                                    self.operListPackageBtnClick)
        operScreenCapBtn.connect(operScreenCapBtn, QtCore.SIGNAL('clicked()'),
                                 self.operScreenCapBtnClick)
        operStartScreenRecordBtn.connect(operStartScreenRecordBtn,
                                         QtCore.SIGNAL('clicked()'),
                                         self.operStartScreenRecordBtnClick)
        operStopScreenRecordBtn.connect(operStopScreenRecordBtn,
                                        QtCore.SIGNAL('clicked()'),
                                        self.operStopScreenRecordBtnClick)

        addDeleteAdbListBtn = QtGui.QPushButton(_fromUtf8("增删"))
        addDeleteAdbListBtn.connect(addDeleteAdbListBtn,
                                    QtCore.SIGNAL('clicked()'),
                                    self.addDeleteAdbListBtnClick)
        queryAdbListBtn = QtGui.QPushButton(_fromUtf8("查询"))
        queryAdbListBtn.connect(queryAdbListBtn, QtCore.SIGNAL('clicked()'),
                                self.queryAdbListBtnClick)
        self.operAdbWin.connect(
            self.operAdbWin, QtCore.SIGNAL('operateCmdSignal(QString, int)'),
            self.hasOperAdbListSlot)

        # 显示常用指令集
        self.adbListEdit = QtGui.QTextEdit()

        devicesHBox.addWidget(self.getDevicesBtn)
        devicesHBox.addWidget(self.devicesListComboBox)

        operateHBox.addWidget(operListPackagesBtn)
        operateHBox.addWidget(operScreenCapBtn)
        operateHBox.addWidget(operStartScreenRecordBtn)
        operateHBox.addWidget(operStopScreenRecordBtn)

        operationAdbListHBox.addWidget(addDeleteAdbListBtn, 1)
        operationAdbListHBox.addWidget(queryAdbListBtn, 1)

        adbListHBox.addWidget(self.adbListEdit)

        devicesGroupBox.setLayout(devicesHBox)
        operationAdbListGroupBox.setLayout(operationAdbListHBox)
        operateGroupBox.setLayout(operateHBox)
        adbListGroupBox.setLayout(adbListHBox)

        firstHBox.addWidget(devicesGroupBox, 1)
        firstHBox.addWidget(operationAdbListGroupBox, 1)

        mainLayout.addLayout(firstHBox)
        mainLayout.addWidget(operateGroupBox)
        mainLayout.addWidget(adbListGroupBox)

        self.setLayout(mainLayout)
Esempio n. 20
0
class AdbToolWidget(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.adbUtil = AdbUtil()
        self.operAdbWin = AdbOperateWin()
        self.deviceList = []
        self.adbCmdList = []
        mainLayout = QtGui.QVBoxLayout()
        devicesGroupBox = QtGui.QGroupBox(_fromUtf8("设备"))
        operateGroupBox = QtGui.QGroupBox(_fromUtf8("操作"))
        operationAdbListGroupBox = QtGui.QGroupBox(_fromUtf8("指令"))
        adbListGroupBox = QtGui.QGroupBox(_fromUtf8("常用指令集"))
        firstHBox = QtGui.QHBoxLayout()
        devicesHBox = QtGui.QHBoxLayout()
        operationAdbListHBox = QtGui.QHBoxLayout()
        operateHBox = QtGui.QHBoxLayout()
        adbListHBox = QtGui.QHBoxLayout()

        self.getDevicesBtn = QtGui.QPushButton(_fromUtf8("获取设备"))
        self.getDevicesBtn.connect(self.getDevicesBtn,
                                   QtCore.SIGNAL('clicked()'),
                                   self.getDevicesBtnClick)
        self.getDevicesBtn.connect(self.getDevicesBtn,
                                   QtCore.SIGNAL('getDeviceSuccessSignal'),
                                   self.getDeviceSucess)
        self.devicesListComboBox = QtGui.QComboBox()
        self.devicesListComboBox.connect(
            self.devicesListComboBox,
            QtCore.SIGNAL('currentIndexChanged(QString)'),
            self.deviceComboBoxCurrentChange)

        operListPackagesBtn = QtGui.QPushButton(_fromUtf8("APP包列表"))
        operScreenCapBtn = QtGui.QPushButton(_fromUtf8("截屏"))
        operStartScreenRecordBtn = QtGui.QPushButton(_fromUtf8("开始录屏"))
        operStopScreenRecordBtn = QtGui.QPushButton(_fromUtf8("结束录屏"))
        operListPackagesBtn.connect(operListPackagesBtn,
                                    QtCore.SIGNAL('clicked()'),
                                    self.operListPackageBtnClick)
        operScreenCapBtn.connect(operScreenCapBtn, QtCore.SIGNAL('clicked()'),
                                 self.operScreenCapBtnClick)
        operStartScreenRecordBtn.connect(operStartScreenRecordBtn,
                                         QtCore.SIGNAL('clicked()'),
                                         self.operStartScreenRecordBtnClick)
        operStopScreenRecordBtn.connect(operStopScreenRecordBtn,
                                        QtCore.SIGNAL('clicked()'),
                                        self.operStopScreenRecordBtnClick)

        addDeleteAdbListBtn = QtGui.QPushButton(_fromUtf8("增删"))
        addDeleteAdbListBtn.connect(addDeleteAdbListBtn,
                                    QtCore.SIGNAL('clicked()'),
                                    self.addDeleteAdbListBtnClick)
        queryAdbListBtn = QtGui.QPushButton(_fromUtf8("查询"))
        queryAdbListBtn.connect(queryAdbListBtn, QtCore.SIGNAL('clicked()'),
                                self.queryAdbListBtnClick)
        self.operAdbWin.connect(
            self.operAdbWin, QtCore.SIGNAL('operateCmdSignal(QString, int)'),
            self.hasOperAdbListSlot)

        # 显示常用指令集
        self.adbListEdit = QtGui.QTextEdit()

        devicesHBox.addWidget(self.getDevicesBtn)
        devicesHBox.addWidget(self.devicesListComboBox)

        operateHBox.addWidget(operListPackagesBtn)
        operateHBox.addWidget(operScreenCapBtn)
        operateHBox.addWidget(operStartScreenRecordBtn)
        operateHBox.addWidget(operStopScreenRecordBtn)

        operationAdbListHBox.addWidget(addDeleteAdbListBtn, 1)
        operationAdbListHBox.addWidget(queryAdbListBtn, 1)

        adbListHBox.addWidget(self.adbListEdit)

        devicesGroupBox.setLayout(devicesHBox)
        operationAdbListGroupBox.setLayout(operationAdbListHBox)
        operateGroupBox.setLayout(operateHBox)
        adbListGroupBox.setLayout(adbListHBox)

        firstHBox.addWidget(devicesGroupBox, 1)
        firstHBox.addWidget(operationAdbListGroupBox, 1)

        mainLayout.addLayout(firstHBox)
        mainLayout.addWidget(operateGroupBox)
        mainLayout.addWidget(adbListGroupBox)

        self.setLayout(mainLayout)

    # 获取USB连接设备列表
    def getDevicesBtnClick(self):
        thread = threading.Thread(target=self.getDeviceList)
        thread.setDaemon(True)
        thread.start()

    # 操作常用指令(添加和删除)
    def addDeleteAdbListBtnClick(self):
        self.operAdbWin.setTips(
            _fromUtf8("添加指令时,名称|描述(选填), 命令(必填);删除指令时,填入命令即可。"))
        self.operAdbWin.show()

    # 查询所有保存的常用adb 指令集
    def queryAdbListBtnClick(self):
        adbDao = AdbDao()
        adbBeanList = adbDao.queryAll()
        if not adbBeanList:
            self.printLog(_fromUtf8("请先添加常用的ADB指令~"))
            return
        # 重新初始化
        self.adbCmdList[:] = []
        for adbBean in adbBeanList:
            self.adbCmdList.append(unicode(adbBean.adb_cmd))
        self.adbListEdit.setText("\n".join(self.adbCmdList))

    # 槽函数,响应 AdbOperateWin 中的操作
    def hasOperAdbListSlot(self, cmd, operate):
        if not cmd:
            return
        if operate == AdbOperateWin.operateAdd:
            self.adbCmdList.append(unicode(cmd))
        elif operate == AdbOperateWin.operateDelete:
            self.adbCmdList.remove(cmd)
        self.adbListEdit.setText("\n".join(self.adbCmdList))

    # 获取设备上的APP包列表
    def operListPackageBtnClick(self):
        thread = threading.Thread(target=self.getPackageList)
        thread.setDaemon(True)
        thread.start()

    def operScreenCapBtnClick(self):
        deviceMode = None
        if self.devicesListComboBox.currentText():
            deviceMode = unicode(self.devicesListComboBox.currentText())
        thread = threading.Thread(target=self.adbUtil.doScreenCap,
                                  args=(
                                      deviceMode,
                                      self.doScreenCallBack,
                                  ))
        thread.setDaemon(True)
        thread.start()

    def operStartScreenRecordBtnClick(self):
        deviceMode = None
        if self.devicesListComboBox.currentText():
            deviceMode = unicode(self.devicesListComboBox.currentText())
        print "deviceMode->> ", deviceMode
        thread = threading.Thread(target=self.adbUtil.doStartScreenRecord,
                                  args=(
                                      deviceMode,
                                      self.doScreenCallBack,
                                  ))
        thread.setDaemon(True)
        thread.start()

    def operStopScreenRecordBtnClick(self):
        thread = threading.Thread(target=self.adbUtil.doStopScreenRecord,
                                  args=(self.doScreenCallBack, ))
        thread.setDaemon(True)
        thread.start()

    def doScreenCallBack(self, msg):
        self.printLog(msg)

    def getDeviceList(self):
        deviceInfoList = self.adbUtil.getDeviceList()
        self.emitGetDeviceSuccess(deviceInfoList)

    def deviceComboBoxCurrentChange(self, currentText):
        if not currentText or not self.deviceList:
            return
        for deviceInfo in self.deviceList:
            if deviceInfo.model == currentText:
                self.adbUtil.setCurrentSerialNo(deviceInfo.serialNo)
                break

    # 获取设备APP 包
    def getPackageList(self):
        self.printLog(self.adbUtil.getDeviceAllPackage())

    def printLog(self, log):
        self.emit(QtCore.SIGNAL('printLogSignal(QString)'), log)

    def printLogSignal(self, log):
        pass

    def getDeviceSucess(self, deviceList):
        if not deviceList:
            self.printLog(_fromUtf8("未获取到设备, 请检查USB连接~"))
            return
        self.deviceList = deviceList
        for deviceInfo in deviceList:
            # 解决QComboBox重复添加的问题
            if self.devicesListComboBox.findText(deviceInfo.model) == -1:
                self.devicesListComboBox.addItem(deviceInfo.model)
                self.printLog(deviceInfo.serialNo)

    def getDeviceSuccessSignal(self, deviceList):
        pass

    def emitGetDeviceSuccess(self, deviceList):
        self.getDevicesBtn.emit(QtCore.SIGNAL('getDeviceSuccessSignal'),
                                deviceList)
 def handle_error_data(current_flow):
     if current_flow > 1 * 1024:
         AdbUtil.screenshot(self.pic_name)
 def handle_error_data(current_flow):
     if current_flow > 5 * 1024:
         # 异常处理
         AdbUtil.screenshot(pic_name)
Esempio n. 23
0
 def handle_error_data(current_flow):
     if current_flow > 1 * 1024:
         current_page = AndroidUtil.get_cur_activity()
         AdbUtil.screenshot(self.pic_name)
         GetFlowDataThread.flow_error_datas.append(
             [current_flow, current_page, self.pic_name])
 def handle_error_data():
     if self.cost_time != '' and self.cost_time is not None:
         cost_time_value = handle_cost_time(self.cost_time)
         if cost_time_value > 3000:
             AdbUtil.screenshot(self.pic_name)