public abstract class AbstractTestRunner extends android.test.InstrumentationTestRunner implements CommandListener, DebugListener
This main thread will wait there until the thread MessengerRunner's termination.
This class implements the interface CommandListener, which describes the actions to do when
receiving a message from 'TCP Messenger'. The subclass of this class should give a concrete
implementation for methods described in CommandListener.
MessengerService
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.Object |
lock |
protected MessengerRunner |
messageRunner |
(package private) boolean |
mIsBound
true if we are successfully bound to the TCP Messenger Service.
|
(package private) java.util.HashMap<java.lang.String,java.util.Vector<ProcessorInterface>> |
processorsMap
Do we need multiple processors for one target?
If not, we may just define the cache as HashMap
|
static java.lang.String |
resource_bind_service |
static java.lang.String |
resource_service_attached |
static java.lang.String |
resource_service_disconnect |
static java.lang.String |
resource_service_release |
(package private) boolean |
runnerStopped |
static java.lang.String |
TAG |
Constructor and Description |
---|
AbstractTestRunner() |
Modifier and Type | Method and Description |
---|---|
void |
addProcessor(java.lang.String target,
ProcessorInterface processor)
According to the target, put the processor to a cache
|
abstract void |
afterStart()
Called as part of the
onCreate(Bundle) initialization after Instrumentation.start() . |
abstract boolean |
beforeStart()
Called as part of the
onCreate(Bundle) initialization after doBindService()
immediately before Instrumentation.start() . |
void |
debug(java.lang.String message) |
protected boolean |
doBindService()
Attempt to force the launch and persistent binding to the separate TCP Messenger Service.
|
protected boolean |
doUnbindService()
Unregister and then unbind with the separate TCP Messenger Service.
|
void |
finishInstrumentation() |
java.lang.String |
getListenerName()
Unique name to identify the listener.
|
java.util.Vector<ProcessorInterface> |
getProcessors(java.lang.String target)
According to the target, get the processors from a cache
|
void |
handleDispatchProps(java.util.Properties props) |
MessageResult |
handleEngineShutdown() |
boolean |
isDebugEnabled() |
void |
messengerRunnerStopped() |
void |
onCreate(android.os.Bundle savedInstanceState)
Called when the Instrumentation class is first created.
|
void |
onReceiveDebug(java.lang.String message)
Receive debug logging requests from the Messenger Service
|
void |
onStart()
Called automatically from start().
|
void |
removeProcessor(java.lang.String target,
ProcessorInterface processor)
Remove the processor from the cache, the processor should belong to 'target'
|
void |
removeProcessors()
Be careful when you call this method, which will remove all the processors from cache
|
void |
removeProcessors(java.lang.String target)
Be careful when you call this method, which will remove all the processors
related to 'target' from cache
|
boolean |
sendServiceResult(java.util.Properties props)
Exposes the messageRunner.sendServiceResult(Properties) method.
|
void |
setDebugEnabled(boolean enable) |
getAllTests, getAndroidTestRunner, getArguments, getLoader, getTestSuite
addMonitor, addMonitor, addMonitor, callActivityOnCreate, callActivityOnCreate, callActivityOnDestroy, callActivityOnNewIntent, callActivityOnPause, callActivityOnPostCreate, callActivityOnPostCreate, callActivityOnRestart, callActivityOnRestoreInstanceState, callActivityOnRestoreInstanceState, callActivityOnResume, callActivityOnSaveInstanceState, callActivityOnSaveInstanceState, callActivityOnStart, callActivityOnStop, callActivityOnUserLeaving, callApplicationOnCreate, checkMonitorHit, endPerformanceSnapshot, finish, getAllocCounts, getBinderCounts, getComponentName, getContext, getTargetContext, getUiAutomation, getUiAutomation, invokeContextMenuAction, invokeMenuActionSync, isProfiling, newActivity, newActivity, newApplication, newApplication, onDestroy, onException, removeMonitor, runOnMainSync, sendCharacterSync, sendKeyDownUpSync, sendKeySync, sendPointerSync, sendStatus, sendStringSync, sendTrackballEventSync, setAutomaticPerformanceSnapshots, setInTouchMode, start, startActivitySync, startAllocCounting, startPerformanceSnapshot, startProfiling, stopAllocCounting, stopProfiling, waitForIdle, waitForIdleSync, waitForMonitor, waitForMonitorWithTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handleDispatchFile, handleMessage, handleRemoteShutdown, handleServerConnected, handleServerDisconnected, handleServerShutdown
public static final java.lang.String TAG
public static final java.lang.String resource_service_attached
public static final java.lang.String resource_service_disconnect
public static final java.lang.String resource_service_release
public static final java.lang.String resource_bind_service
protected MessengerRunner messageRunner
java.lang.Object lock
boolean runnerStopped
java.util.HashMap<java.lang.String,java.util.Vector<ProcessorInterface>> processorsMap
boolean mIsBound
CAUTION: The Instrumentation thread monitors this to determine if the thread should exit.
public boolean sendServiceResult(java.util.Properties props)
public void setDebugEnabled(boolean enable)
public boolean isDebugEnabled()
public void debug(java.lang.String message)
public void onReceiveDebug(java.lang.String message)
onReceiveDebug
in interface DebugListener
public void onCreate(android.os.Bundle savedInstanceState)
We do this through the following sequence of execution:
doBindService()
beforeStart()
Instrumentation.start()
afterStart()
onCreate
in class android.test.InstrumentationTestRunner
public abstract boolean beforeStart()
onCreate(Bundle)
initialization after doBindService()
immediately before Instrumentation.start()
.
Allows subclasses to do any additional setup prior to starting the Instrumentation Thread as part of the onCreate call.
public abstract void afterStart()
onCreate(Bundle)
initialization after Instrumentation.start()
.
Allows subclasses to do any additional setup after the Instrumentation Thread has been started as part of the onCreate call.
public void onStart()
onStart
in class android.test.InstrumentationTestRunner
Instrumentation.start()
public void finishInstrumentation()
public void messengerRunnerStopped()
messengerRunnerStopped
in interface CommandListener
protected boolean doBindService()
protected boolean doUnbindService()
public java.lang.String getListenerName()
NamedListener
getListenerName
in interface NamedListener
public MessageResult handleEngineShutdown()
handleEngineShutdown
in interface CommandListener
public void addProcessor(java.lang.String target, ProcessorInterface processor)
target
- The key with which the processors are stored in cacheprocessor
- The processor to be stored in cachepublic java.util.Vector<ProcessorInterface> getProcessors(java.lang.String target)
target
- The key with which the processors are stored in cachepublic void removeProcessors()
public void removeProcessors(java.lang.String target)
target
- The key with which the processors are stored in cachepublic void removeProcessor(java.lang.String target, ProcessorInterface processor)
target
- The key with which the processors are stored in cacheprocessor
- The processor to be removed from cachepublic void handleDispatchProps(java.util.Properties props)
handleDispatchProps
in interface CommandListener
props
- A Properties object, contains the input parameters including command, target etc.Message
,
Message
,
SoloMessage
Copyright © SAS Institute. All Rights Reserved.