[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / tools / perf / page_sets / top_25_repaint.py
blobd8991be8d0b43b3327b0561e0e0449799b3dd170
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 from telemetry.page import page as page_module
5 from telemetry.page import shared_page_state
6 from telemetry import story
8 from page_sets import repaint_helpers
9 from page_sets import top_pages
12 class TopRepaintPage(page_module.Page):
14 def __init__(self, url, page_set, mode, width, height, name='',
15 credentials=None):
16 super(TopRepaintPage, self).__init__(
17 url=url, page_set=page_set, name=name,
18 credentials_path='data/credentials.json',
19 shared_page_state_class=shared_page_state.SharedDesktopPageState)
20 self.archive_data_file = 'data/top_25_repaint.json'
21 self.credentials = credentials
22 self._mode = mode
23 self._width = width
24 self._height = height
26 def RunPageInteractions(self, action_runner):
27 repaint_helpers.Repaint(
28 action_runner, mode=self._mode, width=self._width, height=self._height)
31 def _CreatePageClassWithRepaintInteractions(page_cls, mode, width, height):
32 class DerivedRepaintPage(page_cls): # pylint: disable=W0232
34 def RunPageInteractions(self, action_runner):
35 repaint_helpers.Repaint(
36 action_runner, mode=mode, width=width, height=height)
38 return DerivedRepaintPage
41 class Top25RepaintPageSet(story.StorySet):
43 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """
45 def __init__(self, mode='viewport', width=None, height=None):
46 super(Top25RepaintPageSet, self).__init__(
47 archive_data_file='data/top_25_repaint.json',
48 cloud_storage_bucket=story.PARTNER_BUCKET)
50 top_page_classes = [
51 top_pages.GoogleWebSearchPage,
52 top_pages.GoogleImageSearchPage,
53 top_pages.GmailPage,
54 top_pages.GoogleCalendarPage,
55 top_pages.GoogleDocPage,
56 top_pages.GooglePlusPage,
57 top_pages.YoutubePage,
58 top_pages.BlogspotPage,
59 top_pages.WordpressPage,
60 top_pages.FacebookPage,
61 top_pages.LinkedinPage,
62 top_pages.WikipediaPage,
63 top_pages.TwitterPage,
64 top_pages.PinterestPage,
65 top_pages.ESPNPage,
66 top_pages.WeatherPage,
67 top_pages.YahooGamesPage,
70 for cl in top_page_classes:
71 self.AddStory(_CreatePageClassWithRepaintInteractions(
72 cl, mode=mode, width=width, height=height)
73 (self, shared_page_state.SharedDesktopPageState))
75 other_urls = [
76 # Why: #1 news worldwide (Alexa global)
77 'http://news.yahoo.com',
78 # Why: #2 news worldwide
79 'http://www.cnn.com',
80 # Why: #1 world commerce website by visits; #3 commerce in the US by
81 # time spent
82 'http://www.amazon.com',
83 # Why: #1 commerce website by time spent by users in US
84 'http://www.ebay.com',
85 # Why: #1 Alexa recreation
86 'http://booking.com',
87 # Why: #1 Alexa reference
88 'http://answers.yahoo.com',
89 # Why: #1 Alexa sports
90 'http://sports.yahoo.com/',
91 # Why: top tech blog
92 'http://techcrunch.com'
95 for url in other_urls:
96 self.AddStory(
97 TopRepaintPage(url, self, mode=mode, height=height, width=width))