8282
8383VIEW_SERVER_HOST = 'localhost'
8484VIEW_SERVER_PORT = 4939
85+ CULEBRATESTER2_PORT = 9987
8586
8687ADB_DEFAULT_PORT = 5555
8788
@@ -2459,8 +2460,8 @@ class ViewClientOptions:
24592460 SERIALNO = 'serialno'
24602461 AUTO_DUMP = 'autodump'
24612462 FORCE_VIEW_SERVER_USE = 'forceviewserveruse'
2462- LOCAL_PORT = 'localport' # ViewServer local port
2463- REMOTE_PORT = 'remoteport' # ViewServer remote port
2463+ LOCAL_PORT = 'localport' # ViewServer or CulebraTester2-public local port
2464+ REMOTE_PORT = 'remoteport' # ViewServer or CulebraTester2-public remote port
24642465 START_VIEW_SERVER = 'startviewserver'
24652466 IGNORE_UIAUTOMATOR_KILLED = 'ignoreuiautomatorkilled'
24662467 COMPRESSED_DUMP = 'compresseddump'
@@ -2490,7 +2491,7 @@ class ViewClient:
24902491
24912492 UiAutomatorHelper backend
24922493 =========================
2493- Requires B{Culebra Tester } installed on Android device.
2494+ Requires B{CulebraTester2-public } installed on Android device.
24942495 '''
24952496
24962497 osName = platform .system ()
@@ -2501,8 +2502,8 @@ class ViewClient:
25012502 imageDirectory = None
25022503 ''' The directory used to store screenshot images '''
25032504
2504- def __init__ (self , device , serialno , adb = None , autodump = True , forceviewserveruse = False , localport = VIEW_SERVER_PORT ,
2505- remoteport = VIEW_SERVER_PORT , startviewserver = True , ignoreuiautomatorkilled = False , compresseddump = True ,
2505+ def __init__ (self , device , serialno , adb = None , autodump = True , forceviewserveruse = False , localport = None ,
2506+ remoteport = None , startviewserver = True , ignoreuiautomatorkilled = False , compresseddump = True ,
25062507 useuiautomatorhelper = False , debug = {}):
25072508 '''
25082509 Constructor
@@ -2548,7 +2549,11 @@ def __init__(self, device, serialno, adb=None, autodump=True, forceviewserveruse
25482549
25492550 if useuiautomatorhelper :
25502551 self .useUiAutomator = True
2551- self .uiAutomatorHelper = UiAutomatorHelper (device )
2552+ if not localport :
2553+ localport = CULEBRATESTER2_PORT
2554+ if not remoteport :
2555+ remoteport = CULEBRATESTER2_PORT
2556+ self .uiAutomatorHelper = UiAutomatorHelper (device , localport = localport , remoteport = remoteport )
25522557 # we might return here if all the dependencies to `adb` commands were removed when uiAutomatorHelper is used
25532558 # return
25542559
@@ -2666,6 +2671,10 @@ def __init__(self, device, serialno, adb=None, autodump=True, forceviewserveruse
26662671 ' ro.debuggable=%s\n ' % (self .ro ['secure' ], self .ro ['debuggable' ])
26672672 raise Exception (msg )
26682673
2674+ if not localport :
2675+ localport = VIEW_SERVER_PORT
2676+ if not remoteport :
2677+ remoteport = VIEW_SERVER_PORT
26692678 self .localPort = localport
26702679 self .remotePort = remoteport
26712680 # FIXME: it seems there's no way of obtaining the serialno from the MonkeyDevice
0 commit comments