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.
7 # pylint: disable=F0401
9 from mojo import system
12 def _Increment(array):
18 class RunLoopTest(unittest.TestCase):
23 def testRunLoop(self):
24 loop = system.RunLoop()
27 loop.PostDelayedTask(_Increment(array))
29 self.assertEquals(len(array), 10)
31 def testRunLoopWithException(self):
32 loop = system.RunLoop()
34 raise Exception("error")
36 loop.PostDelayedTask(Throw)
37 loop.PostDelayedTask(_Increment(array))
38 with self.assertRaisesRegexp(Exception, '^error$'):
40 self.assertEquals(len(array), 0)
42 self.assertEquals(len(array), 1)