| Index: mojo/android/javatests/src/org/chromium/mojo/system/impl/WatcherImplTest.java
|
| diff --git a/mojo/android/javatests/src/org/chromium/mojo/system/impl/WatcherImplTest.java b/mojo/android/javatests/src/org/chromium/mojo/system/impl/WatcherImplTest.java
|
| index 6a99fe155f47e0e5b1f52403d04275d183a85405..e14adb1160a9b580ba80d253785480063918689e 100644
|
| --- a/mojo/android/javatests/src/org/chromium/mojo/system/impl/WatcherImplTest.java
|
| +++ b/mojo/android/javatests/src/org/chromium/mojo/system/impl/WatcherImplTest.java
|
| @@ -68,6 +68,17 @@ public class WatcherImplTest extends MojoTestCase {
|
|
|
| private static class WatcherResult implements Callback {
|
| private int mResult = Integer.MIN_VALUE;
|
| + private MessagePipeHandle mReadPipe;
|
| +
|
| + /**
|
| + * @param readPipe A MessagePipeHandle to read from when onResult triggers success.
|
| + */
|
| + public WatcherResult(MessagePipeHandle readPipe) {
|
| + mReadPipe = readPipe;
|
| + }
|
| + public WatcherResult() {
|
| + this(null);
|
| + }
|
|
|
| /**
|
| * @see Callback#onResult(int)
|
| @@ -75,6 +86,11 @@ public class WatcherImplTest extends MojoTestCase {
|
| @Override
|
| public void onResult(int result) {
|
| this.mResult = result;
|
| +
|
| + if (result == MojoResult.OK && mReadPipe != null) {
|
| + mReadPipe.readMessage(
|
| + null, 0, MessagePipeHandle.ReadFlags.none().setMayDiscard(true));
|
| + }
|
| }
|
|
|
| /**
|
| @@ -93,7 +109,7 @@ public class WatcherImplTest extends MojoTestCase {
|
| // Checking a correct result.
|
| Pair<MessagePipeHandle, MessagePipeHandle> handles = mCore.createMessagePipe(null);
|
| addHandlePairToClose(handles);
|
| - final WatcherResult watcherResult = new WatcherResult();
|
| + final WatcherResult watcherResult = new WatcherResult(handles.first);
|
| assertEquals(Integer.MIN_VALUE, watcherResult.getResult());
|
|
|
| mWatcher.start(handles.first, Core.HandleSignals.READABLE, watcherResult);
|
|
|