Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: mojo/android/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java

Issue 409943003: Makes HandleWatcher block until no longer waiting on pipe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more java fixes Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | mojo/common/handle_watcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/android/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java
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 abe7fa37d7251bbdf9eb3f68d3915e9846d755a2..97bab765d79b98086b15d0d1d2aa6eb7254d6e86 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();
sky 2014/07/23 23:37:15 We're saying the handle must remain valid until ca
+ 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();
sky 2014/07/23 23:37:14 This test doesn't make sense as we're saying the h
darin (slow to review) 2014/07/24 03:39:47 Perhaps the AsyncWait function should DCHECK that
- 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,
sky 2014/07/23 23:37:14 Same thing here.
- 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();
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | mojo/common/handle_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698