MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / ViewClient

Class ViewClient

src/com/dtmilano/android/viewclient.py:2518–4606  ·  view source on GitHub ↗

ViewClient is a I{ViewServer} client. ViewServer backend ================== If not running the ViewServer is started on the target device or emulator and then the port mapping is created. LocalViewServer backend ======================= ViewServer is started as an a

Source from the content-addressed store, hash-verified

2516
2517
2518class ViewClient:
2519 """
2520 ViewClient is a I{ViewServer} client.
2521
2522 ViewServer backend
2523 ==================
2524 If not running the ViewServer is started on the target device or emulator and then the port
2525 mapping is created.
2526
2527 LocalViewServer backend
2528 =======================
2529 ViewServer is started as an application services instead of as a system service.
2530
2531 UiAutomator backend
2532 ===================
2533 No service is started.
2534
2535 null backend
2536 ============
2537 Allows only operations using PX or DIP as hierarchy is not dumped and thus Views not recognized.
2538
2539 UiAutomatorHelper backend
2540 =========================
2541 Requires B{CulebraTester2-public} installed on Android device.
2542 """
2543
2544 osName = platform.system()
2545 ''' The OS name. We sometimes need specific behavior. '''
2546 isLinux = (osName == 'Linux')
2547 isDarwin = (osName == 'Darwin')
2548
2549 imageDirectory = None
2550 ''' The directory used to store screenshot images '''
2551
2552 def __init__(self, device, serialno, adb=None, autodump=True, forceviewserveruse=False, localport=None,
2553 remoteport=None, startviewserver=True, ignoreuiautomatorkilled=False, compresseddump=True,
2554 useuiautomatorhelper=False, debug={}):
2555 """
2556 Constructor
2557
2558 @type device: AdbClient
2559 @param device: The device running the C{View server} to which this client will connect
2560 @type serialno: str
2561 @param serialno: the serial number of the device or emulator to connect to
2562 @type adb: str
2563 @param adb: the path of the C{adb} executable or None and C{ViewClient} will try to find it
2564 @type autodump: boolean
2565 @param autodump: whether an automatic dump is performed at the end of this constructor
2566 @type forceviewserveruse: boolean
2567 @param forceviewserveruse: Force the use of C{ViewServer} even if the conditions to use
2568 C{UiAutomator} are satisfied
2569 @type localport: int
2570 @param localport: the local port used in the redirection
2571 @type remoteport: int
2572 @param remoteport: the remote port used to start the C{ViewServer} in the device or
2573 emulator
2574 @type startviewserver: boolean
2575 @param startviewserver: Whether to start the B{global} ViewServer

Calls

no outgoing calls

Tested by 15

helperFunction · 0.72
testInit_adbMethod · 0.40
testInit_adbNoneMethod · 0.40
testConstructorMethod · 0.40
testMapSerialNo_regexMethod · 0.40
testMapSerialNo_NoneMethod · 0.40
__mockTreeMethod · 0.40
__mockWindowsMethod · 0.40