Index: tools/chrome_remote_control/chrome_remote_control/util.py |
diff --git a/tools/chrome_remote_control/chrome_remote_control/util.py b/tools/chrome_remote_control/chrome_remote_control/util.py |
deleted file mode 100644 |
index f74e4dbe259e2d5c38258b49a5414f2bbec64389..0000000000000000000000000000000000000000 |
--- a/tools/chrome_remote_control/chrome_remote_control/util.py |
+++ /dev/null |
@@ -1,32 +0,0 @@ |
-# Copyright (c) 2012 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 inspect |
-import time |
- |
-class TimeoutException(Exception): |
- pass |
- |
-def WaitFor(condition, |
- timeout, poll_interval=0.1, |
- pass_time_left_to_func=False): |
- assert isinstance(condition, type(lambda: None)) # is function |
- start_time = time.time() |
- while True: |
- if pass_time_left_to_func: |
- res = condition((start_time + timeout) - time.time()) |
- else: |
- res = condition() |
- if res: |
- break |
- if time.time() - start_time > timeout: |
- if condition.__name__ == '<lambda>': |
- try: |
- condition_string = inspect.getsource(condition).strip() |
- except IOError: |
- condition_string = condition.__name__ |
- else: |
- condition_string = condition.__name__ |
- raise TimeoutException('Timed out while waiting %ds for %s.' % |
- (timeout, condition_string)) |
- time.sleep(poll_interval) |