| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 key_mobile_sites_pages | 7 from page_sets import key_mobile_sites_pages |
| 8 | 8 |
| 9 | 9 |
| 10 def _RepaintContinously(action_runner): | 10 class KeyMobileSitesCyclerPage(page_module.Page): |
| 11 action_runner.RepaintContinuously(seconds=5) | |
| 12 | 11 |
| 13 | 12 def __init__(self, url, page_set, name='', labels=None, |
| 14 def _CreatePageClassWithRepaintInteractions(page_cls): | 13 action_on_load_complete=False): |
| 15 class DerivedRepaintPage(page_cls): # pylint: disable=W0232 | 14 super(KeyMobileSitesCyclerPage, self).__init__( |
| 16 | |
| 17 def RunPageInteractions(self, action_runner): | |
| 18 _RepaintContinously(action_runner) | |
| 19 return DerivedRepaintPage | |
| 20 | |
| 21 | |
| 22 class KeyMobileSitesRepaintPage(page_module.Page): | |
| 23 | |
| 24 def __init__(self, url, page_set, name='', labels=None): | |
| 25 super(KeyMobileSitesRepaintPage, self).__init__( | |
| 26 url=url, page_set=page_set, name=name, | 15 url=url, page_set=page_set, name=name, |
| 27 credentials_path='data/credentials.json', labels=labels) | 16 credentials_path='data/credentials.json', labels=labels) |
| 28 self.user_agent_type = 'mobile' | 17 self.user_agent_type = 'mobile' |
| 29 self.archive_data_file = 'data/key_mobile_sites_repaint.json' | 18 self.archive_data_file = 'data/key_mobile_sites.json' |
| 30 | 19 self.action_on_load_complete = action_on_load_complete |
| 31 def RunPageInteractions(self, action_runner): | |
| 32 _RepaintContinously(action_runner) | |
| 33 | 20 |
| 34 | 21 |
| 35 class KeyMobileSitesRepaintPageSet(page_set_module.PageSet): | 22 class KeyMobileSitesCyclerPageSet(page_set_module.PageSet): |
| 36 | 23 |
| 37 """ Key mobile sites with repaint interactions. """ | 24 """ Key mobile sites with smooth interactions. """ |
| 38 | 25 |
| 39 def __init__(self): | 26 def __init__(self): |
| 40 super(KeyMobileSitesRepaintPageSet, self).__init__( | 27 super(KeyMobileSitesCyclerPageSet, self).__init__( |
| 41 user_agent_type='mobile', | 28 user_agent_type='mobile', |
| 42 archive_data_file='data/key_mobile_sites_repaint.json', | 29 archive_data_file='data/key_mobile_sites_cycler.json', |
| 43 bucket=page_set_module.PARTNER_BUCKET) | 30 bucket=page_set_module.PARTNER_BUCKET) |
| 44 | 31 |
| 45 | 32 |
| 46 # Add pages with predefined classes that contain custom navigation logic. | 33 # Add pages with predefined classes that contain custom navigation logic. |
| 47 predefined_page_classes = [ | 34 predefined_page_classes = [ |
| 48 key_mobile_sites_pages.CapitolVolkswagenPage, | 35 key_mobile_sites_pages.CapitolVolkswagenPage, |
| 49 key_mobile_sites_pages.TheVergeArticlePage, | 36 key_mobile_sites_pages.TheVergeArticlePage, |
| 50 key_mobile_sites_pages.CnnArticlePage, | 37 key_mobile_sites_pages.CnnArticlePage, |
| 51 key_mobile_sites_pages.FacebookPage, | 38 key_mobile_sites_pages.FacebookPage, |
| 52 key_mobile_sites_pages.YoutubeMobilePage, | 39 key_mobile_sites_pages.YoutubeMobilePage, |
| 53 key_mobile_sites_pages.LinkedInPage, | 40 key_mobile_sites_pages.LinkedInPage, |
| 54 key_mobile_sites_pages.YahooAnswersPage, | 41 key_mobile_sites_pages.YahooAnswersPage, |
| 55 key_mobile_sites_pages.GmailPage, | |
| 56 key_mobile_sites_pages.GoogleNewsMobilePage, | 42 key_mobile_sites_pages.GoogleNewsMobilePage, |
| 57 key_mobile_sites_pages.GoogleNewsMobile2Page, | 43 key_mobile_sites_pages.GoogleNewsMobile2Page, |
| 58 key_mobile_sites_pages.AmazonNicolasCagePage, | 44 key_mobile_sites_pages.AmazonNicolasCagePage, |
| 59 # Page behaves non-deterministically, replaced with test version for now. | |
| 60 # key_mobile_sites_pages.GroupClonedPage, | |
| 61 | |
| 62 # mean_input_event_latency cannot be tracked correctly for | |
| 63 # GroupClonedListImagesPage. See crbug.com/409086. | |
| 64 # key_mobile_sites_pages.GroupClonedListImagesPage, | |
| 65 ] | 45 ] |
| 66 for page_class in predefined_page_classes: | 46 for page_class in predefined_page_classes: |
| 67 self.AddUserStory( | 47 self.AddUserStory(page_class(self)) |
| 68 _CreatePageClassWithRepaintInteractions(page_class)(self)) | 48 |
| 49 # Add pages with custom page interaction logic. |
| 50 |
| 51 # Page behaves non-deterministically, replaced with test version for now. |
| 52 # self.AddUserStory(GroupClonedPage(self)) |
| 53 # mean_input_event_latency cannot be tracked correctly for |
| 54 # GroupClonedListImagesPage. |
| 55 # See crbug.com/409086. |
| 56 # self.AddUserStory(GroupClonedListImagesPage(self)) |
| 69 | 57 |
| 70 # Add pages with custom labels. | 58 # Add pages with custom labels. |
| 71 | 59 |
| 72 # Why: Top news site. | 60 # Why: Top news site. |
| 73 self.AddUserStory(KeyMobileSitesRepaintPage( | 61 self.AddUserStory(KeyMobileSitesCyclerPage( |
| 74 url='http://nytimes.com/', page_set=self, labels=['fastpath'])) | 62 url='http://nytimes.com/', page_set=self, labels=['fastpath'])) |
| 75 | 63 |
| 76 # Why: Image-heavy site. | 64 # Why: Image-heavy site. |
| 77 self.AddUserStory(KeyMobileSitesRepaintPage( | 65 self.AddUserStory(KeyMobileSitesCyclerPage( |
| 78 url='http://cuteoverload.com', page_set=self, labels=['fastpath'])) | 66 url='http://cuteoverload.com', page_set=self, labels=['fastpath'])) |
| 79 | 67 |
| 80 # Why: #11 (Alexa global), google property; some blogger layouts | 68 # Why: #11 (Alexa global), google property; some blogger layouts |
| 81 # have infinite scroll but more interesting. | 69 # have infinite scroll but more interesting. |
| 82 self.AddUserStory(KeyMobileSitesRepaintPage( | 70 self.AddUserStory(KeyMobileSitesCyclerPage( |
| 83 url='http://googlewebmastercentral.blogspot.com/', | 71 url='http://googlewebmastercentral.blogspot.com/', |
| 84 page_set=self, name='Blogger')) | 72 page_set=self, name='Blogger')) |
| 85 | 73 |
| 86 # Why: #18 (Alexa global), Picked an interesting post """ | 74 # Why: #18 (Alexa global), Picked an interesting post """ |
| 87 self.AddUserStory(KeyMobileSitesRepaintPage( | 75 self.AddUserStory(KeyMobileSitesCyclerPage( |
| 88 # pylint: disable=line-too-long | 76 # pylint: disable=line-too-long |
| 89 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', | 77 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', |
| 90 page_set=self, | 78 page_set=self, |
| 91 name='Wordpress')) | 79 name='Wordpress')) |
| 92 | 80 |
| 93 # Why: #6 (Alexa) most visited worldwide, picked an interesting page | 81 # Why: #6 (Alexa) most visited worldwide, picked an interesting page |
| 94 self.AddUserStory(KeyMobileSitesRepaintPage( | 82 self.AddUserStory(KeyMobileSitesCyclerPage( |
| 95 url='http://en.wikipedia.org/wiki/Wikipedia', | 83 url='http://en.wikipedia.org/wiki/Wikipedia', |
| 96 page_set=self, | 84 page_set=self, |
| 97 name='Wikipedia (1 tab)')) | 85 name='Wikipedia (1 tab)')) |
| 98 | 86 |
| 87 # Why: Wikipedia page with a delayed scroll start |
| 88 self.AddUserStory(KeyMobileSitesCyclerPage( |
| 89 url='http://en.wikipedia.org/wiki/Wikipedia', |
| 90 page_set=self, |
| 91 name='Wikipedia (1 tab) - delayed scroll start', |
| 92 action_on_load_complete=True)) |
| 99 | 93 |
| 100 # Why: #8 (Alexa global), picked an interesting page | 94 # Why: #8 (Alexa global), picked an interesting page |
| 101 # Forbidden (Rate Limit Exceeded) | 95 # Forbidden (Rate Limit Exceeded) |
| 102 # self.AddUserStory(KeyMobileSitesRepaintPage( | 96 # self.AddUserStory(KeyMobileSitesCyclerPage( |
| 103 # url='http://twitter.com/katyperry', page_set=self, name='Twitter')) | 97 # url='http://twitter.com/katyperry', page_set=self, name='Twitter')) |
| 104 | 98 |
| 105 # Why: #37 (Alexa global) """ | 99 # Why: #37 (Alexa global) """ |
| 106 self.AddUserStory(KeyMobileSitesRepaintPage( | 100 self.AddUserStory(KeyMobileSitesCyclerPage( |
| 107 url='http://pinterest.com', | 101 url='http://pinterest.com', |
| 108 page_set=self, | 102 page_set=self, |
| 109 name='Pinterest')) | 103 name='Pinterest')) |
| 110 | 104 |
| 111 # Why: #1 sports. | 105 # Why: #1 sports. |
| 112 # Fails often; crbug.com/249722' | 106 # Fails often; crbug.com/249722' |
| 113 # self.AddUserStory(KeyMobileSitesRepaintPage( | 107 # self.AddUserStory(KeyMobileSitesCyclerPage( |
| 114 # url='http://espn.go.com', page_set=self, name='ESPN')) | 108 # url='http://espn.go.com', page_set=self, name='ESPN')) |
| 115 # Why: crbug.com/231413 | 109 # Why: crbug.com/231413 |
| 116 # Doesn't scroll; crbug.com/249736 | 110 # Doesn't scroll; crbug.com/249736 |
| 117 # self.AddUserStory(KeyMobileSitesRepaintPage( | 111 # self.AddUserStory(KeyMobileSitesCyclerPage( |
| 118 # url='http://forecast.io', page_set=self)) | 112 # url='http://forecast.io', page_set=self)) |
| 119 # Why: crbug.com/169827 | 113 # Why: crbug.com/169827 |
| 120 self.AddUserStory(KeyMobileSitesRepaintPage( | 114 self.AddUserStory(KeyMobileSitesCyclerPage( |
| 121 url='http://slashdot.org/', page_set=self, labels=['fastpath'])) | 115 url='http://slashdot.org/', page_set=self, labels=['fastpath'])) |
| 122 | 116 |
| 123 # Why: #5 Alexa news """ | 117 # Why: #5 Alexa news """ |
| 124 | 118 |
| 125 self.AddUserStory(KeyMobileSitesRepaintPage( | 119 self.AddUserStory(KeyMobileSitesCyclerPage( |
| 126 url='http://www.reddit.com/r/programming/comments/1g96ve', | 120 url='http://www.reddit.com/r/programming/comments/1g96ve', |
| 127 page_set=self, labels=['fastpath'])) | 121 page_set=self, labels=['fastpath'])) |
| 128 | 122 |
| 129 # Why: Problematic use of fixed position elements """ | 123 # Why: Problematic use of fixed position elements """ |
| 130 self.AddUserStory(KeyMobileSitesRepaintPage( | 124 self.AddUserStory(KeyMobileSitesCyclerPage( |
| 131 url='http://www.boingboing.net', page_set=self, labels=['fastpath'])) | 125 url='http://www.boingboing.net', page_set=self, labels=['fastpath'])) |
| 132 | 126 |
| 133 # Add simple pages with no custom navigation logic or labels. | 127 # Add simple pages with no custom navigation logic or labels. |
| 134 urls_list = [ | 128 urls_list = [ |
| 135 # Why: Social; top Google property; Public profile; infinite scrolls. | 129 # Why: Social; top Google property; Public profile; infinite scrolls. |
| 136 # pylint: disable=line-too-long | 130 # pylint: disable=line-too-long |
| 137 'https://plus.google.com/app/basic/110031535020051778989/posts?source=appp
romo', | 131 'https://plus.google.com/app/basic/110031535020051778989/posts?source=appp
romo', |
| 138 # Why: crbug.com/242544 | 132 # Why: crbug.com/242544 |
| 139 ('http://www.androidpolice.com/2012/10/03/rumor-evidence-mounts-that-an-' | 133 ('http://www.androidpolice.com/2012/10/03/rumor-evidence-mounts-that-an-' |
| 140 'lg-optimus-g-nexus-is-coming-along-with-a-nexus-phone-certification-' | 134 'lg-optimus-g-nexus-is-coming-along-with-a-nexus-phone-certification-' |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 # Why: Top search engine | 169 # Why: Top search engine |
| 176 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' | 170 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' |
| 177 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), | 171 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), |
| 178 # Why: Top search engine | 172 # Why: Top search engine |
| 179 'http://www.bing.com/search?q=sloths', | 173 'http://www.bing.com/search?q=sloths', |
| 180 # Why: Good example of poor initial scrolling | 174 # Why: Good example of poor initial scrolling |
| 181 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' | 175 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' |
| 182 ] | 176 ] |
| 183 | 177 |
| 184 for url in urls_list: | 178 for url in urls_list: |
| 185 self.AddUserStory(KeyMobileSitesRepaintPage(url, self)) | 179 self.AddUserStory(KeyMobileSitesCyclerPage(url, self)) |
| OLD | NEW |