1 # Copyright (c) 2012 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.
6 from telemetry.core import util
8 class TestWait(unittest.TestCase):
13 util.WaitFor(test, 0.1)
15 def testTimeout(self):
18 self.assertRaises(util.TimeoutException, lambda: util.WaitFor(test, 0.1))
20 def testCallable(self):
21 """Test methods and anonymous functions, functions are tested elsewhere."""
25 util.WaitFor(Test().Method, 0.1)
27 util.WaitFor(lambda: 1, 0.1)
29 # Test noncallable condition.
30 self.assertRaises(TypeError, lambda: util.WaitFor('test', 0.1))
33 self.assertEquals('test', util.WaitFor(lambda: 'test', 0.1))