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

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

Issue 650293007: Refactor top_25 so only page class with custom Run.. logic is defined (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix style nit Created 6 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/top_25.py
diff --git a/tools/perf/page_sets/top_25.py b/tools/perf/page_sets/top_25.py
index aa5d53aa09e3c88b82f7bad285c2405615ccc2c4..b1dd2fd327e1e773aa977f903bd278287b9de351 100644
--- a/tools/perf/page_sets/top_25.py
+++ b/tools/perf/page_sets/top_25.py
@@ -16,12 +16,13 @@ def _WaitForLocationChange(action_runner, old_href):
class Top25Page(page_module.Page):
- def __init__(self, url, page_set, name=''):
+ def __init__(self, url, page_set, name='', credentials=None):
super(Top25Page, self).__init__(
url=url, page_set=page_set, name=name,
credentials_path='data/credentials.json')
self.user_agent_type = 'desktop'
self.archive_data_file = 'data/top_25.json'
+ self.credentials = credentials
def RunSmoothness(self, action_runner):
interaction = action_runner.BeginGestureInteraction(
@@ -39,8 +40,8 @@ class GoogleWebSearchPage(Top25Page):
def __init__(self, page_set):
super(GoogleWebSearchPage, self).__init__(
- url='https://www.google.com/#hl=en&q=barack+obama',
- page_set=page_set)
+ url='https://www.google.com/#hl=en&q=barack+obama',
+ page_set=page_set)
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -53,10 +54,9 @@ class GmailPage(Top25Page):
def __init__(self, page_set):
super(GmailPage, self).__init__(
- url='https://mail.google.com/mail/',
- page_set=page_set)
-
- self.credentials = 'google'
+ url='https://mail.google.com/mail/',
+ page_set=page_set,
+ credentials='google')
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -84,10 +84,9 @@ class GoogleCalendarPage(Top25Page):
def __init__(self, page_set):
super(GoogleCalendarPage, self).__init__(
- url='https://www.google.com/calendar/',
- page_set=page_set)
-
- self.credentials = 'google'
+ url='https://www.google.com/calendar/',
+ page_set=page_set,
+ credentials='google')
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -109,30 +108,17 @@ class GoogleCalendarPage(Top25Page):
interaction.End()
-class GoogleImageSearchPage(Top25Page):
-
- """ Why: tough image case; top google properties """
-
- def __init__(self, page_set):
- super(GoogleImageSearchPage, self).__init__(
- url='https://www.google.com/search?q=cats&tbm=isch',
- page_set=page_set)
-
- self.credentials = 'google'
-
-
class GoogleDocPage(Top25Page):
""" Why: productivity, top google properties; Sample doc in the link """
def __init__(self, page_set):
super(GoogleDocPage, self).__init__(
- # pylint: disable=C0301
- url='https://docs.google.com/document/d/1X-IKNjtEnx-WW5JIKRLsyhz5sbsat3mfTpAPUSX3_s4/view',
- page_set=page_set,
- name='Docs (1 open document tab)')
-
- self.credentials = 'google'
+ # pylint: disable=C0301
+ url='https://docs.google.com/document/d/1X-IKNjtEnx-WW5JIKRLsyhz5sbsat3mfTpAPUSX3_s4/view',
+ page_set=page_set,
+ name='Docs (1 open document tab)',
+ credentials='google')
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -153,10 +139,9 @@ class GooglePlusPage(Top25Page):
def __init__(self, page_set):
super(GooglePlusPage, self).__init__(
- url='https://plus.google.com/110031535020051778989/posts',
- page_set=page_set)
-
- self.credentials = 'google'
+ url='https://plus.google.com/110031535020051778989/posts',
+ page_set=page_set,
+ credentials='google')
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -175,10 +160,8 @@ class YoutubePage(Top25Page):
def __init__(self, page_set):
super(YoutubePage, self).__init__(
- url='http://www.youtube.com',
- page_set=page_set)
-
- self.credentials = 'google'
+ url='http://www.youtube.com',
+ page_set=page_set, credentials='google')
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -192,9 +175,9 @@ class BlogspotPage(Top25Page):
def __init__(self, page_set):
super(BlogspotPage, self).__init__(
- url='http://googlewebmastercentral.blogspot.com/',
- page_set=page_set,
- name='Blogger')
+ url='http://googlewebmastercentral.blogspot.com/',
+ page_set=page_set,
+ name='Blogger')
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -207,10 +190,10 @@ class WordpressPage(Top25Page):
def __init__(self, page_set):
super(WordpressPage, self).__init__(
- # pylint: disable=C0301
- url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks-for-august-2012/',
- page_set=page_set,
- name='Wordpress')
+ # pylint: disable=C0301
+ url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks-for-august-2012/',
+ page_set=page_set,
+ name='Wordpress')
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -218,16 +201,16 @@ class WordpressPage(Top25Page):
# pylint: disable=C0301
'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sight/"]')
+
class FacebookPage(Top25Page):
""" Why: top social,Public profile """
def __init__(self, page_set):
super(FacebookPage, self).__init__(
- url='http://www.facebook.com/barackobama',
- page_set=page_set,
- name='Facebook')
- self.credentials = 'facebook'
+ url='http://www.facebook.com/barackobama',
+ page_set=page_set,
+ name='Facebook', credentials='facebook')
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -240,37 +223,15 @@ class FacebookPage(Top25Page):
interaction.End()
-class LinkedinPage(Top25Page):
-
- """ Why: #12 (Alexa global),Public profile """
-
- def __init__(self, page_set):
- super(LinkedinPage, self).__init__(
- url='http://www.linkedin.com/in/linustorvalds',
- page_set=page_set,
- name='LinkedIn')
-
-
-class WikipediaPage(Top25Page):
-
- """ Why: #6 (Alexa) most visited worldwide,Picked an interesting page """
-
- def __init__(self, page_set):
- super(WikipediaPage, self).__init__(
- url='http://en.wikipedia.org/wiki/Wikipedia',
- page_set=page_set,
- name='Wikipedia (1 tab)')
-
-
class TwitterPage(Top25Page):
""" Why: #8 (Alexa global),Picked an interesting page """
def __init__(self, page_set):
super(TwitterPage, self).__init__(
- url='https://twitter.com/katyperry',
- page_set=page_set,
- name='Twitter')
+ url='https://twitter.com/katyperry',
+ page_set=page_set,
+ name='Twitter')
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -289,9 +250,9 @@ class PinterestPage(Top25Page):
def __init__(self, page_set):
super(PinterestPage, self).__init__(
- url='http://pinterest.com',
- page_set=page_set,
- name='Pinterest')
+ url='http://pinterest.com',
+ page_set=page_set,
+ name='Pinterest')
def RunSmoothness(self, action_runner):
interaction = action_runner.BeginGestureInteraction(
@@ -306,9 +267,9 @@ class ESPNPage(Top25Page):
def __init__(self, page_set):
super(ESPNPage, self).__init__(
- url='http://espn.go.com',
- page_set=page_set,
- name='ESPN')
+ url='http://espn.go.com',
+ page_set=page_set,
+ name='ESPN')
def RunSmoothness(self, action_runner):
interaction = action_runner.BeginGestureInteraction(
@@ -317,26 +278,14 @@ class ESPNPage(Top25Page):
interaction.End()
-class WeatherDotComPage(Top25Page):
-
- """ Why: #7 (Alexa news); #27 total time spent,Picked interesting page """
-
- def __init__(self, page_set):
- super(WeatherDotComPage, self).__init__(
- # pylint: disable=C0301
- url='http://www.weather.com/weather/right-now/Mountain+View+CA+94043',
- page_set=page_set,
- name='Weather.com')
-
-
class YahooGamesPage(Top25Page):
""" Why: #1 games according to Alexa (with actual games in it) """
def __init__(self, page_set):
super(YahooGamesPage, self).__init__(
- url='http://games.yahoo.com',
- page_set=page_set)
+ url='http://games.yahoo.com',
+ page_set=page_set)
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
@@ -349,46 +298,61 @@ class Top25PageSet(page_set_module.PageSet):
def __init__(self):
super(Top25PageSet, self).__init__(
- user_agent_type='desktop',
- archive_data_file='data/top_25.json',
- bucket=page_set_module.PARTNER_BUCKET)
+ user_agent_type='desktop',
+ archive_data_file='data/top_25.json',
+ bucket=page_set_module.PARTNER_BUCKET)
self.AddPage(GoogleWebSearchPage(self))
self.AddPage(GmailPage(self))
self.AddPage(GoogleCalendarPage(self))
- self.AddPage(GoogleImageSearchPage(self))
+ # Why: tough image case; top google properties
+ self.AddPage(
+ Top25Page('https://www.google.com/search?q=cats&tbm=isch',
+ page_set=self, credentials='google'))
self.AddPage(GoogleDocPage(self))
self.AddPage(GooglePlusPage(self))
self.AddPage(YoutubePage(self))
self.AddPage(BlogspotPage(self))
self.AddPage(WordpressPage(self))
self.AddPage(FacebookPage(self))
- self.AddPage(LinkedinPage(self))
- self.AddPage(WikipediaPage(self))
+ # Why: #12 (Alexa global), Public profile.
+ self.AddPage(
+ Top25Page(
+ 'http://www.linkedin.com/in/linustorvalds', page_set=self,
+ name='LinkedIn'))
+ # Why: #6 (Alexa) most visited worldwide,Picked an interesting page
+ self.AddPage(
+ Top25Page(
+ 'http://en.wikipedia.org/wiki/Wikipedia', page_set=self,
+ name='Wikipedia (1 tab)'))
self.AddPage(TwitterPage(self))
self.AddPage(PinterestPage(self))
self.AddPage(ESPNPage(self))
- self.AddPage(WeatherDotComPage(self))
+ # Why: #7 (Alexa news); #27 total time spent, picked interesting page.
+ self.AddPage(Top25Page(
+ url='http://www.weather.com/weather/right-now/Mountain+View+CA+94043',
+ page_set=self,
+ name='Weather.com'))
self.AddPage(YahooGamesPage(self))
other_urls = [
- # Why: #1 news worldwide (Alexa global)
- 'http://news.yahoo.com',
- # Why: #2 news worldwide
- 'http://www.cnn.com',
- # Why: #1 world commerce website by visits; #3 commerce in the US by time
- # spent
- 'http://www.amazon.com',
- # Why: #1 commerce website by time spent by users in US
- 'http://www.ebay.com',
- # Why: #1 Alexa recreation
- 'http://booking.com',
- # Why: #1 Alexa reference
- 'http://answers.yahoo.com',
- # Why: #1 Alexa sports
- 'http://sports.yahoo.com/',
- # Why: top tech blog
- 'http://techcrunch.com'
+ # Why: #1 news worldwide (Alexa global)
+ 'http://news.yahoo.com',
+ # Why: #2 news worldwide
+ 'http://www.cnn.com',
+ # Why: #1 world commerce website by visits; #3 commerce in the US by
+ # time spent
+ 'http://www.amazon.com',
+ # Why: #1 commerce website by time spent by users in US
+ 'http://www.ebay.com',
+ # Why: #1 Alexa recreation
+ 'http://booking.com',
+ # Why: #1 Alexa reference
+ 'http://answers.yahoo.com',
+ # Why: #1 Alexa sports
+ 'http://sports.yahoo.com/',
+ # Why: top tech blog
+ 'http://techcrunch.com'
]
for url in other_urls:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698