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

Side by Side Diff: mojo/python/tests/async_wait_unittest.py

Issue 675563002: Remove mojo/python and gyp targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « mojo/python/system/mojo/embedder.pyx ('k') | mojo/python/tests/bindings_constants_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import mojo_unittest
6
7 # pylint: disable=E0611
8 from mojo import system
9
10
11 class AsyncWaitTest(mojo_unittest.MojoTestCase):
12
13 def setUp(self):
14 super(AsyncWaitTest, self).setUp()
15 self.array = []
16 self.handles = system.MessagePipe()
17 self.cancel = self.handles.handle0.AsyncWait(system.HANDLE_SIGNAL_READABLE,
18 system.DEADLINE_INDEFINITE,
19 self._OnResult)
20
21 def tearDown(self):
22 self.cancel()
23 self.handles = None
24 self.array = None
25 super(AsyncWaitTest, self).tearDown()
26
27 def _OnResult(self, value):
28 self.array.append(value)
29
30 def _WriteToHandle(self):
31 self.handles.handle1.WriteMessage()
32
33 def _PostWriteAndRun(self):
34 self.loop.PostDelayedTask(self._WriteToHandle, 0)
35 self.loop.RunUntilIdle()
36
37 def testAsyncWait(self):
38 self._PostWriteAndRun()
39 self.assertEquals(len(self.array), 1)
40 self.assertEquals(system.RESULT_OK, self.array[0])
41
42 def testAsyncWaitCancel(self):
43 self.loop.PostDelayedTask(self.cancel, 0)
44 self._PostWriteAndRun()
45 self.assertEquals(len(self.array), 0)
46
47 def testAsyncWaitImmediateCancel(self):
48 self.cancel()
49 self._PostWriteAndRun()
50 self.assertEquals(len(self.array), 0)
OLDNEW
« no previous file with comments | « mojo/python/system/mojo/embedder.pyx ('k') | mojo/python/tests/bindings_constants_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698