Index: tools/chrome_remote_control/chrome_remote_control/page_interaction.py |
diff --git a/tools/perf/perf_tools/robohornetpro.py b/tools/chrome_remote_control/chrome_remote_control/page_interaction.py |
similarity index 20% |
copy from tools/perf/perf_tools/robohornetpro.py |
copy to tools/chrome_remote_control/chrome_remote_control/page_interaction.py |
index ab06aced934dcd068ca01c682d15616c62d74dd8..05b387090ba26117dd861f8c68f083782490253e 100644 |
--- a/tools/perf/perf_tools/robohornetpro.py |
+++ b/tools/chrome_remote_control/chrome_remote_control/page_interaction.py |
@@ -2,21 +2,35 @@ |
# 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 multi_page_benchmark |
-from chrome_remote_control import util |
+class PageInteractionNotSupported(Exception): |
+ pass |
+ |
+class PageInteractionFailed(Exception): |
+ pass |
+ |
+class PageInteraction(object): |
+ """Represents an interaction that a user might try to perform to a page.""" |
-class RobohornetPro(multi_page_benchmark.MultiPageBenchmark): |
def CustomizeBrowserOptions(self, options): |
- # Benchmark require use of real Date.now() for measurement. |
- options.wpr_make_javascript_deterministic = False |
+ """Override to add test-specific options to the BrowserOptions object""" |
+ pass |
+ |
+ def SupportedForPage(self, page, tab): |
+ raise NotImplementedError() |
+ |
+ def PerformInteraction(self, page, tab): |
+ raise NotImplementedError() |
+ |
+ def CleanUp(self, page, tab): |
+ raise NotImplementedError() |
- def MeasurePage(self, _, tab, results): |
- tab.runtime.Execute('ToggleRoboHornet()') |
+_page_interaction_classes = {} |
+def GetAllClasses(): |
+ return list(_page_interaction_classes.values()) |
- done = 'document.getElementById("results").innerHTML.indexOf("Total") != -1' |
- def _IsDone(): |
- return tab.runtime.Evaluate(done) |
- util.WaitFor(_IsDone, 60) |
+def FindClassWithName(name): |
+ return _page_interaction_classes.get(name) |
- result = int(tab.runtime.Evaluate('stopTime - startTime')) |
- results.Add('Total', 'ms', result) |
+def RegisterClass(name, interaction_class): |
+ assert name not in _page_interaction_classes |
+ _page_interaction_classes[name] = interaction_class |