OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 from page_sets.system_health import platforms | 5 from page_sets.system_health import platforms |
6 from page_sets.system_health import story_tags | 6 from page_sets.system_health import story_tags |
7 from page_sets.system_health import system_health_story | 7 from page_sets.system_health import system_health_story |
8 from page_sets.system_health.loading_stories import LoadGmailMobileStory | 8 from page_sets.system_health.loading_stories import LoadGmailMobileStory |
9 | 9 |
10 from telemetry import decorators | 10 from telemetry import decorators |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 def _DidLoadDocument(self, action_runner): | 52 def _DidLoadDocument(self, action_runner): |
53 # Dismiss the 'You have n free articles' message. | 53 # Dismiss the 'You have n free articles' message. |
54 action_runner.WaitForElement(selector='.growl-dismiss') | 54 action_runner.WaitForElement(selector='.growl-dismiss') |
55 action_runner.TapElement(selector='.growl-dismiss') | 55 action_runner.TapElement(selector='.growl-dismiss') |
56 | 56 |
57 # Tap the 'Show Full Article' button. | 57 # Tap the 'Show Full Article' button. |
58 action_runner.WaitForElement(selector='#additional-content button') | 58 action_runner.WaitForElement(selector='#additional-content button') |
59 action_runner.ScrollPageToElement(selector='#additional-content button') | 59 action_runner.ScrollPageToElement(selector='#additional-content button') |
60 # TapElement seems flaky here so use JavaScript instead. | 60 # TapElement seems flaky here so use JavaScript instead. |
61 action_runner.ExecuteJavaScript2( | 61 action_runner.ExecuteJavaScript( |
62 'document.querySelector("#additional-content button").click()') | 62 'document.querySelector("#additional-content button").click()') |
63 | 63 |
64 # Scroll to video, start it and then wait for a few seconds. | 64 # Scroll to video, start it and then wait for a few seconds. |
65 action_runner.WaitForElement(selector='.nytd-player-poster') | 65 action_runner.WaitForElement(selector='.nytd-player-poster') |
66 action_runner.ScrollPageToElement(selector='.nytd-player-poster') | 66 action_runner.ScrollPageToElement(selector='.nytd-player-poster') |
67 # For some reason on some devices (e.g. Nexus7) we don't scroll all the way | 67 # For some reason on some devices (e.g. Nexus7) we don't scroll all the way |
68 # to the element. I think this might be caused by the page reflowing (due to | 68 # to the element. I think this might be caused by the page reflowing (due to |
69 # vidoes loading) during the scroll. To be sure we get to the element | 69 # vidoes loading) during the scroll. To be sure we get to the element |
70 # wait a moment and then try to scroll again. | 70 # wait a moment and then try to scroll again. |
71 action_runner.Wait(1) | 71 action_runner.Wait(1) |
72 action_runner.ScrollPageToElement(selector='.nytd-player-poster') | 72 action_runner.ScrollPageToElement(selector='.nytd-player-poster') |
73 action_runner.TapElement(selector='.nytd-player-poster') | 73 action_runner.TapElement(selector='.nytd-player-poster') |
74 action_runner.Wait(_WAIT_FOR_VIDEO_SECONDS) | 74 action_runner.Wait(_WAIT_FOR_VIDEO_SECONDS) |
75 | 75 |
76 | 76 |
77 class BackgroundImgurMobileStory(_BackgroundStory): | 77 class BackgroundImgurMobileStory(_BackgroundStory): |
78 NAME = 'background:media:imgur' | 78 NAME = 'background:media:imgur' |
79 URL = 'http://imgur.com/gallery/hUita' | 79 URL = 'http://imgur.com/gallery/hUita' |
80 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 80 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
81 | 81 |
82 | 82 |
83 @decorators.Disabled('android') # crbug.com/676336 | 83 @decorators.Disabled('android') # crbug.com/676336 |
84 class BackgroundGmailMobileStory(LoadGmailMobileStory): | 84 class BackgroundGmailMobileStory(LoadGmailMobileStory): |
85 NAME = 'background:tools:gmail' | 85 NAME = 'background:tools:gmail' |
86 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 86 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
87 | 87 |
88 def _Measure(self, action_runner): | 88 def _Measure(self, action_runner): |
89 action_runner.tab.browser.Background() | 89 action_runner.tab.browser.Background() |
90 super(BackgroundGmailMobileStory, self)._Measure(action_runner) | 90 super(BackgroundGmailMobileStory, self)._Measure(action_runner) |
OLD | NEW |