OLD | NEW |
1 # Copyright 2015 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 | 4 |
5 import logging | 5 import logging |
6 | 6 |
7 from telemetry.page import page as page_module | 7 from telemetry.page import page as page_module |
8 from telemetry.page import shared_page_state | 8 from telemetry.page import shared_page_state |
9 from telemetry import story | 9 from telemetry import story |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 COMMENT_LINK_SELECTOR = '.show_comments_link' | 40 COMMENT_LINK_SELECTOR = '.show_comments_link' |
41 | 41 |
42 def __init__(self, page_set): | 42 def __init__(self, page_set): |
43 super(TheVergePage, self).__init__( | 43 super(TheVergePage, self).__init__( |
44 'http://www.theverge.com/2015/8/11/9133883/taylor-swift-spotify-discover
-weekly-what-is-going-on', | 44 'http://www.theverge.com/2015/8/11/9133883/taylor-swift-spotify-discover
-weekly-what-is-going-on', |
45 page_set=page_set, | 45 page_set=page_set, |
46 name='TheVerge') | 46 name='TheVerge') |
47 | 47 |
48 def RunPageInteractions(self, action_runner): | 48 def RunPageInteractions(self, action_runner): |
49 action_runner.WaitForElement(selector=TheVergePage.COMMENT_LINK_SELECTOR) | 49 action_runner.WaitForElement(selector=TheVergePage.COMMENT_LINK_SELECTOR) |
50 action_runner.ExecuteJavaScript2( | 50 action_runner.ExecuteJavaScript( |
51 'window.location.hash = "comments"') | 51 'window.location.hash = "comments"') |
52 action_runner.TapElement( | 52 action_runner.TapElement( |
53 selector=TheVergePage.COMMENT_LINK_SELECTOR) | 53 selector=TheVergePage.COMMENT_LINK_SELECTOR) |
54 action_runner.WaitForJavaScriptCondition2( | 54 action_runner.WaitForJavaScriptCondition( |
55 'window.Chorus.Comments.collection.length > 0') | 55 'window.Chorus.Comments.collection.length > 0') |
56 super(TheVergePage, self).RunPageInteractions(action_runner) | 56 super(TheVergePage, self).RunPageInteractions(action_runner) |
57 | 57 |
58 | 58 |
59 class FacebookPage(BlinkMemoryMobilePage): | 59 class FacebookPage(BlinkMemoryMobilePage): |
60 def __init__(self, page_set): | 60 def __init__(self, page_set): |
61 super(FacebookPage, self).__init__( | 61 super(FacebookPage, self).__init__( |
62 'https://facebook.com/barackobama', | 62 'https://facebook.com/barackobama', |
63 page_set=page_set, | 63 page_set=page_set, |
64 name='Facebook') | 64 name='Facebook') |
65 | 65 |
66 def RunNavigateSteps(self, action_runner): | 66 def RunNavigateSteps(self, action_runner): |
67 super(FacebookPage, self).RunNavigateSteps(action_runner) | 67 super(FacebookPage, self).RunNavigateSteps(action_runner) |
68 action_runner.WaitForJavaScriptCondition2( | 68 action_runner.WaitForJavaScriptCondition( |
69 'document.getElementById("u_0_c") !== null &&' | 69 'document.getElementById("u_0_c") !== null &&' |
70 'document.body.scrollHeight > window.innerHeight') | 70 'document.body.scrollHeight > window.innerHeight') |
71 | 71 |
72 | 72 |
73 class GmailPage(BlinkMemoryMobilePage): | 73 class GmailPage(BlinkMemoryMobilePage): |
74 def __init__(self, page_set): | 74 def __init__(self, page_set): |
75 super(GmailPage, self).__init__( | 75 super(GmailPage, self).__init__( |
76 'https://mail.google.com/mail/', | 76 'https://mail.google.com/mail/', |
77 page_set=page_set, | 77 page_set=page_set, |
78 name='Gmail') | 78 name='Gmail') |
79 | 79 |
80 def RunNavigateSteps(self, action_runner): | 80 def RunNavigateSteps(self, action_runner): |
81 google_login.LoginGoogleAccount(action_runner, 'google', | 81 google_login.LoginGoogleAccount(action_runner, 'google', |
82 self.credentials_path) | 82 self.credentials_path) |
83 super(GmailPage, self).RunNavigateSteps(action_runner) | 83 super(GmailPage, self).RunNavigateSteps(action_runner) |
84 action_runner.WaitForElement(selector='#apploadingdiv') | 84 action_runner.WaitForElement(selector='#apploadingdiv') |
85 action_runner.WaitForJavaScriptCondition2( | 85 action_runner.WaitForJavaScriptCondition( |
86 'document.querySelector("#apploadingdiv").style.opacity == "0"') | 86 'document.querySelector("#apploadingdiv").style.opacity == "0"') |
87 | 87 |
88 | 88 |
89 class BlinkMemoryMobilePageSet(story.StorySet): | 89 class BlinkMemoryMobilePageSet(story.StorySet): |
90 """Key mobile sites for Blink memory reduction.""" | 90 """Key mobile sites for Blink memory reduction.""" |
91 | 91 |
92 def __init__(self): | 92 def __init__(self): |
93 super(BlinkMemoryMobilePageSet, self).__init__( | 93 super(BlinkMemoryMobilePageSet, self).__init__( |
94 archive_data_file='data/blink_memory_mobile.json', | 94 archive_data_file='data/blink_memory_mobile.json', |
95 cloud_storage_bucket=story.PARTNER_BUCKET) | 95 cloud_storage_bucket=story.PARTNER_BUCKET) |
(...skipping 29 matching lines...) Expand all Loading... |
125 # Why: Key products. | 125 # Why: Key products. |
126 self.AddStory(GmailPage(page_set=self)) | 126 self.AddStory(GmailPage(page_set=self)) |
127 self.AddStory(BlinkMemoryMobilePage( | 127 self.AddStory(BlinkMemoryMobilePage( |
128 'http://googlewebmastercentral.blogspot.com/2015/04/rolling-out-mobile-f
riendly-update.html?m=1', | 128 'http://googlewebmastercentral.blogspot.com/2015/04/rolling-out-mobile-f
riendly-update.html?m=1', |
129 page_set=self, | 129 page_set=self, |
130 name='Blogger')) | 130 name='Blogger')) |
131 self.AddStory(BlinkMemoryMobilePage( | 131 self.AddStory(BlinkMemoryMobilePage( |
132 'https://plus.google.com/app/basic/110031535020051778989/posts?source=ap
ppromo', | 132 'https://plus.google.com/app/basic/110031535020051778989/posts?source=ap
ppromo', |
133 page_set=self, | 133 page_set=self, |
134 name='GooglePlus')) | 134 name='GooglePlus')) |
OLD | NEW |