Esempio n. 1
0
    def getDevice(self,
                  dmtype="adb",
                  hwid=None,
                  host=None,
                  port=None,
                  packagename=None,
                  verbose=False):
        '''
        Returns a device with the specified parameters
        '''
        logLevel = mozlog.ERROR
        if verbose:
            logLevel = mozlog.DEBUG

        if hwid:
            return mozdevice.DroidConnectByHWID(hwid, logLevel=logLevel)

        if dmtype == "adb":
            if host and not port:
                port = 5555
            return mozdevice.DroidADB(packageName=packagename,
                                      host=host,
                                      port=port,
                                      logLevel=logLevel)
        elif dmtype == "sut":
            if not host:
                self.parser.error("Must specify host with SUT!")
            if not port:
                port = 20701
            return mozdevice.DroidSUT(host=host, port=port, logLevel=logLevel)
        else:
            self.parser.error("Unknown device manager type: %s" % type)
Esempio n. 2
0
    def getDevice(self, dmtype="adb", hwid=None, host=None, port=None):
        '''
        Returns a device with the specified parameters
        '''
        if self.options.verbose:
            mozdevice.DroidSUT.debug = 4

        if hwid:
            return mozdevice.DroidConnectByHWID(hwid)

        if dmtype == "adb":
            if host and not port:
                port = 5555
            return mozdevice.DroidADB(packageName=self.options.packagename,
                                      host=host,
                                      port=port)
        elif dmtype == "sut":
            if not host:
                self.parser.error("Must specify host with SUT!")
            if not port:
                port = 20701
            return mozdevice.DroidSUT(host=host, port=port)
        else:
            self.parser.error("Unknown device manager type: %s" % type)