com.xtremelabs.robolectric.shadows
Class ShadowHandler
java.lang.Object
com.xtremelabs.robolectric.shadows.ShadowHandler
@Implements(value=android.os.Handler.class)
public class ShadowHandler
- extends java.lang.Object
Shadow for Handler that puts posted Runnable
s into a queue instead of sending them to be handled on a
separate thread.Runnable
s that are scheduled to be executed immediately can be triggered by calling
flush()
.
todo: add utility method to advance time and trigger execution of Runnables scheduled for a time in the future
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ShadowHandler
public ShadowHandler()
__constructor__
public void __constructor__()
__constructor__
public void __constructor__(android.os.Looper looper)
post
@Implementation
public boolean post(java.lang.Runnable r)
postDelayed
@Implementation
public boolean postDelayed(java.lang.Runnable r,
long delayMillis)
obtainMessage
@Implementation
public android.os.Message obtainMessage(int what,
java.lang.Object obj)
sendMessage
@Implementation
public final boolean sendMessage(android.os.Message msg)
sendEmptyMessage
@Implementation
public final boolean sendEmptyMessage(int what)
flush
public static void flush()
- Causes any posted
Runnable
s that are scheduled to run immediately to actually be run. This gives
visibility into the order in which things will happen. An event can be triggered and its immediate effects
examined, and then flush()
can be called and the side-effects of the original event can be examined.