Package org.robolectric.fakes
Class RoboWebMessagePort
- java.lang.Object
-
- android.webkit.WebMessagePort
-
- org.robolectric.fakes.RoboWebMessagePort
-
@Config(minSdk=23) public class RoboWebMessagePort extends WebMessagePort
Robolectric implementation ofWebMessagePort
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class android.webkit.WebMessagePort
WebMessagePort.WebMessageCallback
-
-
Constructor Summary
Constructors Constructor Description RoboWebMessagePort()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static RoboWebMessagePort[]
createPair()
RoboWebMessagePort
getConnectedPort()
com.google.common.collect.ImmutableList<String>
getOutgoingMessages()
Returns the list of all messages sent to its connected ports.com.google.common.collect.ImmutableList<String>
getReceivedMessages()
Returns the list of all messages received from its connected ports.WebMessagePort.WebMessageCallback
getWebMessageCallback()
boolean
isClosed()
void
postMessage(WebMessage message)
void
setConnectedPort(RoboWebMessagePort port)
Links another port to this port.void
setWebMessageCallback(WebMessagePort.WebMessageCallback callback)
void
setWebMessageCallback(WebMessagePort.WebMessageCallback callback, Handler handler)
-
-
-
Method Detail
-
createPair
public static RoboWebMessagePort[] createPair()
-
postMessage
public void postMessage(WebMessage message)
- Specified by:
postMessage
in classWebMessagePort
-
setWebMessageCallback
public void setWebMessageCallback(WebMessagePort.WebMessageCallback callback)
- Specified by:
setWebMessageCallback
in classWebMessagePort
-
setWebMessageCallback
public void setWebMessageCallback(WebMessagePort.WebMessageCallback callback, @Nullable Handler handler)
- Specified by:
setWebMessageCallback
in classWebMessagePort
-
setConnectedPort
public void setConnectedPort(@Nullable RoboWebMessagePort port)
Links another port to this port. After set, messages which sent from this port will arrive at the connected one.
-
getConnectedPort
public RoboWebMessagePort getConnectedPort()
-
getWebMessageCallback
public WebMessagePort.WebMessageCallback getWebMessageCallback()
-
getOutgoingMessages
public com.google.common.collect.ImmutableList<String> getOutgoingMessages()
Returns the list of all messages sent to its connected ports.
-
getReceivedMessages
public com.google.common.collect.ImmutableList<String> getReceivedMessages()
Returns the list of all messages received from its connected ports.
-
close
public void close()
- Specified by:
close
in classWebMessagePort
-
isClosed
public boolean isClosed()
-
-