| 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 | |
| 6 from page_sets.system_health import system_health_story | 5 from page_sets.system_health import system_health_story |
| 7 | 6 |
| 7 from telemetry import decorators |
| 8 | 8 |
| 9 |
| 10 @decorators.Disabled('win') # http://crbug.com/642463 |
| 9 class SearchGoogleStory(system_health_story.SystemHealthStory): | 11 class SearchGoogleStory(system_health_story.SystemHealthStory): |
| 10 NAME = 'search:portal:google' | 12 NAME = 'search:portal:google' |
| 11 URL = 'https://www.google.co.uk/' | 13 URL = 'https://www.google.co.uk/' |
| 12 # Tap simulation doesn't fully work on Windows. http://crbug.com/634343 | |
| 13 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | |
| 14 | 14 |
| 15 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]' | 15 _SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]' |
| 16 _RESULT_SELECTOR = '.r > a[href*="wikipedia"]' | 16 _RESULT_SELECTOR = '.r > a[href*="wikipedia"]' |
| 17 | 17 |
| 18 def _DidLoadDocument(self, action_runner): | 18 def _DidLoadDocument(self, action_runner): |
| 19 # Click on the search box. | 19 # Click on the search box. |
| 20 action_runner.Wait(1) | 20 action_runner.Wait(1) |
| 21 action_runner.WaitForElement(selector=self._SEARCH_BOX_SELECTOR) | 21 action_runner.WaitForElement(selector=self._SEARCH_BOX_SELECTOR) |
| 22 action_runner.TapElement(selector=self._SEARCH_BOX_SELECTOR) | 22 action_runner.TapElement(selector=self._SEARCH_BOX_SELECTOR) |
| 23 | 23 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 })()''' % self._RESULT_SELECTOR) | 39 })()''' % self._RESULT_SELECTOR) |
| 40 while action_runner.EvaluateJavaScript(result_visible_expression): | 40 while action_runner.EvaluateJavaScript(result_visible_expression): |
| 41 action_runner.RepeatableBrowserDrivenScroll(y_scroll_distance_ratio=0.75, | 41 action_runner.RepeatableBrowserDrivenScroll(y_scroll_distance_ratio=0.75, |
| 42 prevent_fling=False) | 42 prevent_fling=False) |
| 43 action_runner.Wait(0.2) | 43 action_runner.Wait(0.2) |
| 44 | 44 |
| 45 # Click on the Wikipedia result. | 45 # Click on the Wikipedia result. |
| 46 action_runner.Wait(1) | 46 action_runner.Wait(1) |
| 47 action_runner.TapElement(selector=self._RESULT_SELECTOR) | 47 action_runner.TapElement(selector=self._RESULT_SELECTOR) |
| 48 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | 48 action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
| OLD | NEW |