summaryrefslogtreecommitdiffstats
path: root/mojo/android/javatests
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-24 14:57:28 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-24 14:57:28 +0000
commitc902c5745c3a69afd98cc856b79aea7251de19ea (patch)
tree344e074720c35286ced2a439eee27bb1cd61678d /mojo/android/javatests
parentdf1d26053df86738d3c4d54901b6eb28901a2e5e (diff)
downloadchromium_src-c902c5745c3a69afd98cc856b79aea7251de19ea.zip
chromium_src-c902c5745c3a69afd98cc856b79aea7251de19ea.tar.gz
chromium_src-c902c5745c3a69afd98cc856b79aea7251de19ea.tar.bz2
Makes HandleWatcher block until no longer waiting on pipe
BUG=394886 TEST=covered as best as can from tests R=darin@chromium.org, jam@chromium.org Review URL: https://codereview.chromium.org/409943003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/android/javatests')
-rw-r--r--mojo/android/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java56
1 files changed, 3 insertions, 53 deletions
diff --git a/mojo/android/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java b/mojo/android/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java
index abe7fa3..97bab76 100644
--- a/mojo/android/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java
+++ b/mojo/android/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java
@@ -648,8 +648,8 @@ public class CoreImplTest extends MojoTestCase {
assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult());
assertEquals(null, asyncWaiterResult.getException());
- core.getDefaultAsyncWaiter().asyncWait(handles.first, Core.HandleSignals.READABLE,
- Core.DEADLINE_INFINITE, asyncWaiterResult);
+ Cancellable cancellable = core.getDefaultAsyncWaiter().asyncWait(handles.first,
+ Core.HandleSignals.READABLE, Core.DEADLINE_INFINITE, asyncWaiterResult);
assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult());
assertEquals(null, asyncWaiterResult.getException());
@@ -657,7 +657,7 @@ public class CoreImplTest extends MojoTestCase {
assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult());
assertEquals(null, asyncWaiterResult.getException());
- handles.first.close();
+ cancellable.cancel();
nativeRunLoop(RUN_LOOP_TIMEOUT_MS);
// TODO(qsr) Re-enable when MojoWaitMany handles it correctly.
// assertNull(asyncWaiterResult.getException());
@@ -668,56 +668,6 @@ public class CoreImplTest extends MojoTestCase {
* Testing core {@link AsyncWaiter} implementation.
*/
@SmallTest
- public void testAsyncWaiterWaitingOnInvalidHandle() {
- Core core = CoreImpl.getInstance();
-
- // Closing the peer handle.
- Pair<MessagePipeHandle, MessagePipeHandle> handles = core.createMessagePipe(null);
- addHandlePairToClose(handles);
-
- final AsyncWaiterResult asyncWaiterResult = new AsyncWaiterResult();
- assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult());
- assertEquals(null, asyncWaiterResult.getException());
-
- handles.first.close();
- core.getDefaultAsyncWaiter().asyncWait(handles.first, Core.HandleSignals.READABLE,
- Core.DEADLINE_INFINITE, asyncWaiterResult);
- assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult());
- assertEquals(null, asyncWaiterResult.getException());
-
- nativeRunLoop(RUN_LOOP_TIMEOUT_MS);
- assertNotNull(asyncWaiterResult.getException());
- assertEquals(MojoResult.INVALID_ARGUMENT,
- asyncWaiterResult.getException().getMojoResult());
- assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult());
- }
-
- /**
- * Testing core {@link AsyncWaiter} implementation.
- */
- @SmallTest
- public void testAsyncWaiterWaitingOnDefaultInvalidHandle() {
- Core core = CoreImpl.getInstance();
-
- final AsyncWaiterResult asyncWaiterResult = new AsyncWaiterResult();
- assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult());
- assertEquals(null, asyncWaiterResult.getException());
-
- core.getDefaultAsyncWaiter().asyncWait(InvalidHandle.INSTANCE, Core.HandleSignals.READABLE,
- Core.DEADLINE_INFINITE, asyncWaiterResult);
- assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult());
- assertEquals(null, asyncWaiterResult.getException());
-
- nativeRunLoop(RUN_LOOP_TIMEOUT_MS);
- assertNotNull(asyncWaiterResult.getException());
- assertEquals(MojoResult.INVALID_ARGUMENT, asyncWaiterResult.getException().getMojoResult());
- assertEquals(Integer.MIN_VALUE, asyncWaiterResult.getResult());
- }
-
- /**
- * Testing core {@link AsyncWaiter} implementation.
- */
- @SmallTest
public void testAsyncWaiterWaitingWithTimeout() {
Core core = CoreImpl.getInstance();