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

Unified Diff: mojo/python/tests/async_wait_unittest.py

Issue 588593002: mojo: Allow basic RunLoop to be quit from a posted task. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Follow review Created 6 years, 3 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 | « mojo/public/cpp/utility/tests/run_loop_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/python/tests/async_wait_unittest.py
diff --git a/mojo/python/tests/async_wait_unittest.py b/mojo/python/tests/async_wait_unittest.py
index c80cae0f7a8da4fbf2ca1fdf1e1b7e50300c5fb9..849b3cbaf7b426e116365150673a60b12e782c13 100644
--- a/mojo/python/tests/async_wait_unittest.py
+++ b/mojo/python/tests/async_wait_unittest.py
@@ -18,34 +18,35 @@ class AsyncWaitTest(unittest.TestCase):
self.handles = system.MessagePipe()
self.cancel = self.handles.handle0.AsyncWait(system.HANDLE_SIGNAL_READABLE,
system.DEADLINE_INDEFINITE,
- self.OnResult)
- self.loop.PostDelayedTask(self.WriteToHandle, 100)
+ self._OnResult)
def tearDown(self):
+ self.cancel()
self.handles = None
self.array = None
self.loop = None
- def OnResult(self, value):
+ def _OnResult(self, value):
self.array.append(value)
- def WriteToHandle(self):
+ def _WriteToHandle(self):
self.handles.handle1.WriteMessage()
- def testAsyncWait(self):
+ def _PostWriteAndRun(self):
+ self.loop.PostDelayedTask(self._WriteToHandle, 0)
self.loop.RunUntilIdle()
+
+ def testAsyncWait(self):
+ self._PostWriteAndRun()
self.assertEquals(len(self.array), 1)
self.assertEquals(system.RESULT_OK, self.array[0])
- self.cancel()
def testAsyncWaitCancel(self):
- self.loop.PostDelayedTask(self.cancel, 50)
- self.loop.RunUntilIdle()
+ self.loop.PostDelayedTask(self.cancel, 0)
+ self._PostWriteAndRun()
self.assertEquals(len(self.array), 0)
- self.cancel()
def testAsyncWaitImmediateCancel(self):
self.cancel()
- self.loop.RunUntilIdle()
+ self._PostWriteAndRun()
self.assertEquals(len(self.array), 0)
- self.cancel()
« no previous file with comments | « mojo/public/cpp/utility/tests/run_loop_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698