def __whichAdb(self, adb): if adb: if not os.access(adb, os.X_OK): raise Exception('adb="%s" is not executable' % adb) else: # Using adbclient we don't need adb executable yet (maybe it's needed if we want to # start adb if not running) or to redirect ports adb = obtainAdbPath() return adb
def setUpClass(cls): cls.adb = obtainAdbPath() # we use 'fakeserialno' and settransport=False so AdbClient does not try to find the # serialno in setTransport() try: adbClient = AdbClient('fakeserialno', settransport=False) except RuntimeError as ex: if re.search('Connection refused', str(ex)): raise RuntimeError("adb is not running") raise (ex) devices = adbClient.getDevices() if len(devices) == 0: raise RuntimeError( "This tests require at least one device connected. None was found." ) for device in devices: if device.status == 'device': cls.androidSerial = device.serialno if VERBOSE: print("AdbClientTest: using device %s" % cls.androidSerial) return raise RuntimeError("No on-line devices found")
from config import Config from layout import Layout # https://material.google.com/layout/structure.html#structure-system-bars NAVBAR_DP_HEIGHT = 48 MAX_X = 0 MAX_Y = 0 STATUS_BAR_HEIGHT = 0 # Visibility VISIBLE = 0x0 INVISIBLE = 0x4 GONE = 0x8 ADB_PATH = obtainAdbPath() SERIAL_NO = '' BACK_BUTTON = 'back button' # Return a unique string if the package is not the focused window. Since # activities cannot have spaces, we ensure that no activity will be named this. EXITED_APP = 'exited app' FAILED_FINDING_NAME = 'failed finding name' # How many times we should try pressing the back button to return to the app # before giving up. NUM_BACK_PRESSES = 3 # Number of dumps we'll try in a row before succumbing to socket timeouts and # giving up. MAX_DUMPS = 6 # To prevent getting stuck in apps with a large number of UIs or dynamic content # that can change the view hierarchy each time it's loaded, we limit the number # of crawls to perform and max number of layouts to store per app.