Index: tools/telemetry/telemetry/page/actions/action_runner.py |
diff --git a/tools/telemetry/telemetry/page/actions/action_runner.py b/tools/telemetry/telemetry/page/actions/action_runner.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c0c23698d2f69675db06d7f2523f7851defd9a4b |
--- /dev/null |
+++ b/tools/telemetry/telemetry/page/actions/action_runner.py |
@@ -0,0 +1,20 @@ |
+# Copyright (c) 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. |
+ |
+class ActionRunner(object): |
+ def __init__(self, page, tab, page_test=None): |
+ self._page = page |
+ self._tab = tab |
+ self._page_test = page_test |
+ |
+ def RunAction(self, action): |
+ if not action.WillWaitAfterRun(): |
+ action.WillRunAction(self._page, self._tab) |
+ if self._page_test: |
+ self._page_test.WillRunAction(self._page, self._tab, action) |
+ try: |
+ action.RunActionAndMaybeWait(self._page, self._tab) |
+ finally: |
+ if self._page_test: |
+ self._page_test.DidRunAction(self._page, self._tab, action) |