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

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
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..44abaea92213f0a665d9ded74f953999fd56d6d0
--- /dev/null
+++ b/tools/perf/page_sets/top_10.py
@@ -0,0 +1,110 @@
+# 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.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 RunNavigateSteps(self, action_runner):
+ action_runner.RunAction(NavigateAction())
+
+ def RunSmoothness(self, action_runner):
+ action_runner.RunAction(ScrollAction())
+
+class PageSetTop10(PageSet):
+ def __init__(self):
+ super(PageSetTop10, 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
+ 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).navigate_steps(action_runner)
+ action_runner.RunAction(WaitAction().
+ UntilTextElementAvailable(text='Next'))
+
+ self.AddPage(Google())
+
+ # productivity, top google properties
+ 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).navigate_steps(action_runner)
+ action_runner.RunAction(WaitAction().UntilTrue(
+ 'window.gmonkey !== undefined &&'
+ 'document.getElementById("gb") !== null'))
+
+ self.AddPage(Gmail())
+
+ # productivity, top google properties
+ 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).navigate_steps(action_runner)
+ action_runner.RunAction(JavascriptAction().OfExpression(
+ '(function() { var elem = document.createElement("meta");'
+ 'elem.name="viewport";'
+ 'elem.content="initial-scale=1";'
+ 'document.body.appendChild(elem); })();'))
+ action_runner.RunAction(WaitAction().ForSeconds(2))
+ action_runner.RunAction(WaitAction().UntilSelectorElementAvailable(
+ selector='div[class~="navForward"]'))
+
+ self.AddPage(GoogleCalendar())
+
+ # #3 (Alexa global)
+ class Youtube(SimpleScrollPage):
+ def __init__(self):
+ super(Youtube, self).__init__(
+ 'https://www.youtube.com', credentials='google')
+
+ def RunNavigateSteps(self, action_runner):
+ super(Youtube, self).RunNavigateSteps(action_runner)
+ action_runner.RunAction(WaitAction().ForSeconds(2))
+
+ self.AddPage(Youtube())
+
+ # top social, Public profile
+ class Facebook(SimpleScrollPage):
nduca 2014/03/05 01:10:43 mind hoisting these inner classes out to toplevel?
nednguyen 2014/03/05 20:53:31 Done.
+ def __init__(self):
+ super(Facebook, self).__init__(
+ 'http://www.facebook.com/barackobama', credentials='facebook')
+
+ def RunNavigateSteps(self, action_runner):
+ super(Facebook, self).RunNavigateSteps(action_runner)
+ action_runner.RunAction(WaitAction().UntilTextElementAvailable("About"))
+
+ self.AddPage(Facebook())
+
+ # #6 (Alexa) most visited worldwide,Picked an interesting page
+ self.AddPage(SimpleScrollPage('http://en.wikipedia.org/wiki/Wikipedia'))
+ # #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 | « no previous file | tools/telemetry/telemetry/core/browser_credentials.py » ('j') | tools/telemetry/telemetry/page/actions/wait.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698