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

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: remove attributes from page constructor Created 6 years, 9 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/measurements/smoothness_unittest.py ('k') | tools/telemetry/telemetry/core/discover.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..5ed17cca09bb31d00903bb1219974179898e3333
--- /dev/null
+++ b/tools/perf/page_sets/top_10.py
@@ -0,0 +1,126 @@
+# 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.page.actions.javascript import JavascriptAction
+from telemetry.page.actions.scroll import ScrollAction
+from telemetry.page.actions.wait import WaitAction
+from telemetry.page.page_set import PageSet
+from telemetry.page.page import Page
+
+
+class SimpleScrollPage(Page):
+ def __init__(self, url='', credentials=''):
+ super(SimpleScrollPage, self).__init__(url, '')
+ self.credentials = credentials
+
+ def RunSmoothness(self, action_runner):
+ action_runner.RunAction(ScrollAction())
+
+ def RunNavigateSteps(self, action_runner):
+ action_runner.RunAction(NavigateAction())
+
+
+class Google(SimpleScrollPage):
+ def __init__(self):
+ super(Google, self).__init__(
+ 'https://www.google.com/#hl=en&q=barack+obama')
+
+ def RunNavigateSteps(self, action_runner):
+ super(Google, self).RunNavigateSteps(action_runner)
+ action_runner.RunAction(WaitAction(
+ {'condition': 'element', 'text': 'Next'}))
+
+
+class Gmail(SimpleScrollPage):
+ def __init__(self):
+ super(Gmail, self).__init__(
+ 'https://mail.google.com/mail/', credentials='google')
+
+ def RunNavigateSteps(self, action_runner):
+ super(Gmail, self).RunNavigateSteps(action_runner)
+ action_runner.RunAction(WaitAction(
+ {'javascript' : 'window.gmonkey !== undefined &&'
+ 'document.getElementById("gb") !== null'}))
+
+
+class GoogleCalendar(SimpleScrollPage):
+ def __init__(self):
+ super(GoogleCalendar, self).__init__(
+ 'https://www.google.com/calendar/', credentials='google')
+
+ def RunNavigateSteps(self, action_runner):
+ super(GoogleCalendar, self).RunNavigateSteps(action_runner)
+ action_runner.RunAction(JavascriptAction(
+ { 'expression' :
+ '(function() { var elem = document.createElement("meta");'
+ 'elem.name="viewport";'
+ 'elem.content="initial-scale=1";'
+ 'document.body.appendChild(elem); })();'}))
+ action_runner.RunAction(WaitAction({'seconds' : 2}))
+ action_runner.RunAction(WaitAction({
+ 'condition' : 'element', 'selector' : 'div[class~="navForward"]'}))
+
+
+class Youtube(SimpleScrollPage):
+ def __init__(self):
+ super(Youtube, self).__init__(
+ 'http://www.youtube.com', credentials='google')
+
+ def RunNavigateSteps(self, action_runner):
+ super(Youtube, self).RunNavigateSteps(action_runner)
+ action_runner.RunAction(WaitAction({'seconds' : 2}))
+
+
+class Facebook(SimpleScrollPage):
+ def __init__(self):
+ super(Facebook, self).__init__(
+ 'http://www.facebook.com/barackobama', credentials='facebook')
+ self.name = "Facebook"
+
+ def RunNavigateSteps(self, action_runner):
+ super(Facebook, self).RunNavigateSteps(action_runner)
+ action_runner.RunAction(WaitAction(
+ {'condition': 'element', 'text': 'About'}))
+
+
+class Top10PageSet(PageSet):
+ def __init__(self):
+ super(Top10PageSet, 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')
+
+ # top google property; a google tab is often open
+ self.AddPage(Google())
+
+ # productivity, top google properties
+ self.AddPage(Gmail())
+
+ # productivity, top google properties
+ self.AddPage(GoogleCalendar())
+
+ # #3 (Alexa global)
+ self.AddPage(Youtube())
+
+ # top social, Public profile
+ self.AddPage(Facebook())
+
+ # #6 (Alexa) most visited worldwide,Picked an interesting page
+ wikipedia_page = SimpleScrollPage('http://en.wikipedia.org/wiki/Wikipedia')
+ wikipedia_page.name = "Wikipedia"
+ self.AddPage(wikipedia_page)
+
+ # #1 world commerce website by visits; #3 commerce in the US by time spent
+ self.AddPage(SimpleScrollPage('http://www.amazon.com'))
+
+ # #4 Alexa
+ self.AddPage(SimpleScrollPage('http://www.yahoo.com/'))
+
+ # #16 Alexa
+ self.AddPage(SimpleScrollPage('http://www.bing.com/'))
+
+ # #20 Alexa
+ self.AddPage(SimpleScrollPage('http://www.ask.com/'))
« no previous file with comments | « tools/perf/measurements/smoothness_unittest.py ('k') | tools/telemetry/telemetry/core/discover.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698