Index: tools/chrome_remote_control/chrome_remote_control/click_to_navigate_interaction.py |
diff --git a/build/android/pylib/run_tests_helper.py b/tools/chrome_remote_control/chrome_remote_control/click_to_navigate_interaction.py |
similarity index 20% |
copy from build/android/pylib/run_tests_helper.py |
copy to tools/chrome_remote_control/chrome_remote_control/click_to_navigate_interaction.py |
index 15e5d5381bcc9b6d9a3e97dcbed40191556a9904..7a7312bffbf51a9065c84ed2ef53be9340a49586 100644 |
--- a/build/android/pylib/run_tests_helper.py |
+++ b/tools/chrome_remote_control/chrome_remote_control/click_to_navigate_interaction.py |
@@ -1,26 +1,24 @@ |
# 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. |
+from chrome_remote_control import page_interaction |
-"""Helper functions common to native, java and python test runners.""" |
+class ClickToNavigateInteraction(page_interaction.PageInteraction): |
+ def __init__(self, data): |
nduca
2012/11/07 18:55:57
what is data here? Is it the page object? Or some
marja
2012/11/08 10:24:00
I changed this to follow the same pattern as page.
|
+ super(ClickToNavigateInteraction, self).__init__() |
+ self._data = data |
-import logging |
-import os |
+ def SupportedForPage(self, page, tab): |
+ pass |
nduca
2012/11/07 18:55:57
return True?
marja
2012/11/08 10:24:00
Done. (Oops!)
|
+ def PerformInteraction(self, _, tab): |
+ assert self._data['selector'] |
+ code = 'document.querySelector(\'' + self._data['selector'] + '\').click();' |
+ def DoClick(): |
+ tab.runtime.Execute(code) |
+ tab.page.PerformActionAndWaitForNavigate(DoClick) |
-def GetExpectations(file_name): |
- """Returns a list of test names in the |file_name| test expectations file.""" |
- if not file_name or not os.path.exists(file_name): |
- return [] |
- return [x for x in [x.strip() for x in file(file_name).readlines()] |
- if x and x[0] != '#'] |
+ def CleanUp(self, page, tab): |
+ pass |
- |
-def SetLogLevel(verbose_count): |
- """Sets log level as |verbose_count|.""" |
- log_level = logging.WARNING # Default. |
- if verbose_count == 1: |
- log_level = logging.INFO |
- elif verbose_count >= 2: |
- log_level = logging.DEBUG |
- logging.getLogger().setLevel(log_level) |
+page_interaction.RegisterClass('click_to_navigate', ClickToNavigateInteraction) |