| # Copyright 2014 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| import mojo_system as system |
| class RunLoopTest(mojo_unittest.MojoTestCase): |
| self.loop.PostDelayedTask(_Increment(array)) |
| self.assertEquals(len(array), 10) |
| def testRunLoopWithException(self): |
| self.loop.PostDelayedTask(Throw) |
| self.loop.PostDelayedTask(_Increment(array)) |
| with self.assertRaisesRegexp(Exception, '^error$'): |
| self.assertEquals(len(array), 0) |
| self.assertEquals(len(array), 1) |
| self.assertEquals(system.RunLoop.Current(), self.loop) |
| self.assertIsNone(system.RunLoop.Current()) |