Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Unified Diff: tools/telemetry/telemetry/page/actions/action_runner.py

Issue 277143003: Add NavigateToPage API for action_runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/page_sets/webrtc_cases.py ('k') | tools/telemetry/telemetry/page/actions/all_page_actions.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index fc042c761462b30435ac78439eaeb39b6e96eeef..c0847031efed26caabc41ad46939f73427f00a33 100644
--- a/tools/telemetry/telemetry/page/actions/action_runner.py
+++ b/tools/telemetry/telemetry/page/actions/action_runner.py
@@ -1,20 +1,19 @@
# Copyright 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.
+from telemetry.page.actions.navigate import NavigateAction
from telemetry.web_perf import timeline_interaction_record as tir_module
class ActionRunner(object):
- def __init__(self, page, tab, page_test=None):
- self._page = page
+ def __init__(self, tab):
self._tab = tab
- self._page_test = page_test
#TODO(nednguyen): remove this when crbug.com/361809 is marked fixed
def RunAction(self, action):
if not action.WillWaitAfterRun():
- action.WillRunAction(self._page, self._tab)
- action.RunActionAndMaybeWait(self._page, self._tab)
+ action.WillRunAction(self._tab)
+ action.RunActionAndMaybeWait(self._tab)
def BeginInteraction(self, logical_name, flags):
""" Issues the begin of interaction record.
@@ -33,3 +32,18 @@ class ActionRunner(object):
self._tab.ExecuteJavaScript('console.timeEnd("%s");' %
tir_module.TimelineInteractionRecord.GetJavascriptMarker(logical_name,
flags))
+
+ def NavigateToPage(self, page, timeout_seconds=None):
+ """ Navigate to page.
+ page is an instance of page.Page
+ """
+ if page.is_file:
+ target_side_url = self._tab.browser.http_server.UrlOf(page.file_path_url)
+ else:
+ target_side_url = page.url
+ attributes = {
+ 'url': target_side_url ,
+ 'script_to_evaluate_on_commit': page.script_to_evaluate_on_commit}
+ if timeout_seconds:
+ attributes['timeout_seconds'] = timeout_seconds
+ self.RunAction(NavigateAction(attributes))
« no previous file with comments | « tools/perf/page_sets/webrtc_cases.py ('k') | tools/telemetry/telemetry/page/actions/all_page_actions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698