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

Unified Diff: tools/perf/page_sets/top_10.py

Issue 180873008: Add support for python pageset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 | « no previous file | tools/telemetry/telemetry/page/actions/javascript.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/top_10.py
diff --git a/tools/perf/page_sets/top_10.py b/tools/perf/page_sets/top_10.py
new file mode 100644
index 0000000000000000000000000000000000000000..314fe6ecbfeb3fb6f14c5aa619b5e3826d8af7d2
--- /dev/null
+++ b/tools/perf/page_sets/top_10.py
@@ -0,0 +1,61 @@
+# 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.javascript import JavascriptAction
+from telemetry.page.actions.navigate import NavigateAction
+from telemetry.page.actions.scroll import ScrollAction
+from telemetry.page.actions.wait import WaitAction
+from telemetry.page.python_page_set import PythonPageSet
+from telemetry.page.page import Page
+
+class ScrollPage(Page):
+ def __init__(self, url='', navigate_steps=None, credentials=''):
+ super(ScrollPage, self).__init__(url, '')
+ if not navigate_steps:
+ self._navigate_steps = []
+ else:
+ self._navigate_steps = navigate_steps
+
+ @property
+ def navigate_steps():
+ return self._navigate_steps
+
+ @property
+ def smoothness():
+ return [ScrollAction()]
+
+class Top10(PythonPageSet):
+ def __init__(self):
+ super(Top10, self).__init__(
+ description='10 Pages chosen from Alexa top sites',
+ archive_data_file='data/top_10.json',
+ credentials_path='data/credentials.json',
+ user_agent_type='desktop')
+
+ self.AddPages(
+ #top google property; a google tab is often open
nduca 2014/02/27 18:26:57 from our chat class Top10(PageSet): def __init_
nednguyen 2014/02/27 19:49:33 Done.
+ ScrollPage(url='https://www.google.com/#hl=en&q=barack+obama',
+ navigate_steps=[
+ NavigateAction(),
+ WaitAction().UntilTextElementAvailable(text='Next')]),
+ #productivity, top google properties
+ ScrollPage(url='https://mail.google.com/mail/',
+ navigate_steps=[
+ NavigateAction(),
+ WaitAction.UntilTrue(
+ expression='''window.gmonkey !== undefined &&
+document.getElementById('gb') !== null''')]),
+ #productivity, top google properties
+ ScrollPage(url='https://google.com/calendar/',
+ navigate_steps=[
+ NavigateAction(),
+ JavascriptAction().OfExpression(
+ '''(function() { var elem = document.createElement("meta");
+ elem.name="viewport";
+ elem.content="initial-scale=1";
+ document.body.appendChild(elem); })();'''),
+ WaitAction().ForSeconds(2),
+ WaitAction().UntilSelectorElementAvailable(
+ selector='div[class~="navForward"]')],
+ credentials='google'))
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/actions/javascript.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698