OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 from telemetry.page import page as page_module | 4 from telemetry.page import page as page_module |
5 from telemetry.page import page_set as page_set_module | 5 from telemetry.page import page_set as page_set_module |
6 | 6 |
7 from page_sets import top_pages | 7 from page_sets import top_pages |
| 8 from page_sets import repaint_helpers |
8 | 9 |
9 | 10 |
10 class TopRepaintPage(page_module.Page): | 11 class TopRepaintPage(page_module.Page): |
11 | 12 |
12 def __init__(self, url, page_set, name='', credentials=None): | 13 def __init__(self, url, page_set, mode, width, height, name='', |
| 14 credentials=None): |
13 super(TopRepaintPage, self).__init__( | 15 super(TopRepaintPage, self).__init__( |
14 url=url, page_set=page_set, name=name, | 16 url=url, page_set=page_set, name=name, |
15 credentials_path='data/credentials.json') | 17 credentials_path='data/credentials.json') |
16 self.user_agent_type = 'desktop' | 18 self.user_agent_type = 'desktop' |
17 self.archive_data_file = 'data/top_25_repaint.json' | 19 self.archive_data_file = 'data/top_25_repaint.json' |
18 self.credentials = credentials | 20 self.credentials = credentials |
| 21 self._mode = mode |
| 22 self._width = width |
| 23 self._height = height |
19 | 24 |
20 def RunPageInteractions(self, action_runner): | 25 def RunPageInteractions(self, action_runner): |
21 action_runner.RepaintContinuously(seconds=5) | 26 repaint_helpers.Repaint( |
| 27 action_runner, mode=self._mode, width=self._width, height=self._height) |
22 | 28 |
23 | 29 |
24 def _CreatePageClassWithRepaintInteractions(page_cls): | 30 def _CreatePageClassWithRepaintInteractions(page_cls, mode, width, height): |
25 class DerivedRepaintPage(page_cls): # pylint: disable=W0232 | 31 class DerivedRepaintPage(page_cls): # pylint: disable=W0232 |
26 | 32 |
27 def RunPageInteractions(self, action_runner): | 33 def RunPageInteractions(self, action_runner): |
28 action_runner.RepaintContinuously(seconds=5) | 34 repaint_helpers.Repaint( |
| 35 action_runner, mode=mode, width=width, height=height) |
| 36 |
29 return DerivedRepaintPage | 37 return DerivedRepaintPage |
30 | 38 |
31 | 39 |
32 class Top25RepaintPageSet(page_set_module.PageSet): | 40 class Top25RepaintPageSet(page_set_module.PageSet): |
33 | 41 |
34 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ | 42 """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ |
35 | 43 |
36 def __init__(self): | 44 def __init__(self, mode='viewport', width=None, height=None): |
37 super(Top25RepaintPageSet, self).__init__( | 45 super(Top25RepaintPageSet, self).__init__( |
38 user_agent_type='desktop', | 46 user_agent_type='desktop', |
39 archive_data_file='data/top_25_repaint.json', | 47 archive_data_file='data/top_25_repaint.json', |
40 bucket=page_set_module.PARTNER_BUCKET) | 48 bucket=page_set_module.PARTNER_BUCKET) |
41 | 49 |
42 top_page_classes = [ | 50 top_page_classes = [ |
43 top_pages.GoogleWebSearchPage, | 51 top_pages.GoogleWebSearchPage, |
44 top_pages.GoogleImageSearchPage, | 52 top_pages.GoogleImageSearchPage, |
45 top_pages.GmailPage, | 53 top_pages.GmailPage, |
46 top_pages.GoogleCalendarPage, | 54 top_pages.GoogleCalendarPage, |
47 top_pages.GoogleDocPage, | 55 top_pages.GoogleDocPage, |
48 top_pages.GooglePlusPage, | 56 top_pages.GooglePlusPage, |
49 top_pages.YoutubePage, | 57 top_pages.YoutubePage, |
50 top_pages.BlogspotPage, | 58 top_pages.BlogspotPage, |
51 top_pages.WordpressPage, | 59 top_pages.WordpressPage, |
52 top_pages.FacebookPage, | 60 top_pages.FacebookPage, |
53 top_pages.LinkedinPage, | 61 top_pages.LinkedinPage, |
54 top_pages.WikipediaPage, | 62 top_pages.WikipediaPage, |
55 top_pages.TwitterPage, | 63 top_pages.TwitterPage, |
56 top_pages.PinterestPage, | 64 top_pages.PinterestPage, |
57 top_pages.ESPNPage, | 65 top_pages.ESPNPage, |
58 top_pages.WeatherPage, | 66 top_pages.WeatherPage, |
59 top_pages.YahooGamesPage, | 67 top_pages.YahooGamesPage, |
60 ] | 68 ] |
61 | 69 |
62 for cl in top_page_classes: | 70 for cl in top_page_classes: |
63 self.AddUserStory(_CreatePageClassWithRepaintInteractions(cl)(self)) | 71 self.AddUserStory(_CreatePageClassWithRepaintInteractions( |
| 72 cl, mode=mode, width=width, height=height)(self)) |
64 | 73 |
65 other_urls = [ | 74 other_urls = [ |
66 # Why: #1 news worldwide (Alexa global) | 75 # Why: #1 news worldwide (Alexa global) |
67 'http://news.yahoo.com', | 76 'http://news.yahoo.com', |
68 # Why: #2 news worldwide | 77 # Why: #2 news worldwide |
69 'http://www.cnn.com', | 78 'http://www.cnn.com', |
70 # Why: #1 world commerce website by visits; #3 commerce in the US by | 79 # Why: #1 world commerce website by visits; #3 commerce in the US by |
71 # time spent | 80 # time spent |
72 'http://www.amazon.com', | 81 'http://www.amazon.com', |
73 # Why: #1 commerce website by time spent by users in US | 82 # Why: #1 commerce website by time spent by users in US |
74 'http://www.ebay.com', | 83 'http://www.ebay.com', |
75 # Why: #1 Alexa recreation | 84 # Why: #1 Alexa recreation |
76 'http://booking.com', | 85 'http://booking.com', |
77 # Why: #1 Alexa reference | 86 # Why: #1 Alexa reference |
78 'http://answers.yahoo.com', | 87 'http://answers.yahoo.com', |
79 # Why: #1 Alexa sports | 88 # Why: #1 Alexa sports |
80 'http://sports.yahoo.com/', | 89 'http://sports.yahoo.com/', |
81 # Why: top tech blog | 90 # Why: top tech blog |
82 'http://techcrunch.com' | 91 'http://techcrunch.com' |
83 ] | 92 ] |
84 | 93 |
85 for url in other_urls: | 94 for url in other_urls: |
86 self.AddUserStory(TopRepaintPage(url, self)) | 95 self.AddUserStory( |
| 96 TopRepaintPage(url, self, mode=mode, height=height, width=width)) |
OLD | NEW |