Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # encoding: utf-8 | 1 # encoding: utf-8 |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 from page_sets.system_health import platforms | 6 from page_sets.system_health import platforms |
| 7 from page_sets.system_health import story_tags | 7 from page_sets.system_health import story_tags |
| 8 from page_sets.system_health import system_health_story | 8 from page_sets.system_health import system_health_story |
| 9 | 9 |
| 10 from page_sets.login_helpers import pinterest_login | 10 from page_sets.login_helpers import pinterest_login |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 4. Open and scroll the second article. | 61 4. Open and scroll the second article. |
| 62 5. Go back to the main page and scroll it. | 62 5. Go back to the main page and scroll it. |
| 63 6. etc. | 63 6. etc. |
| 64 """ | 64 """ |
| 65 | 65 |
| 66 ITEM_READ_TIME_IN_SECONDS = 3 | 66 ITEM_READ_TIME_IN_SECONDS = 3 |
| 67 ITEM_SCROLL_REPEAT = 2 | 67 ITEM_SCROLL_REPEAT = 2 |
| 68 ITEMS_TO_VISIT = 4 | 68 ITEMS_TO_VISIT = 4 |
| 69 MAIN_PAGE_SCROLL_REPEAT = 0 | 69 MAIN_PAGE_SCROLL_REPEAT = 0 |
| 70 ABSTRACT_STORY = True | 70 ABSTRACT_STORY = True |
| 71 # Some devices take long to load news webpages crbug.com/713036. | |
| 72 COMPLETE_STATE_WAIT_TIMEOUT = None | |
|
nednguyen
2017/04/20 20:43:43
why not just default this to 90s (https://cs.chrom
ssid
2017/04/20 22:29:24
I cannot import catapult/telemetry/telemetry/inter
| |
| 71 | 73 |
| 72 def _DidLoadDocument(self, action_runner): | 74 def _DidLoadDocument(self, action_runner): |
| 73 for i in xrange(self.ITEMS_TO_VISIT): | 75 for i in xrange(self.ITEMS_TO_VISIT): |
| 74 self._NavigateToItem(action_runner, i) | 76 self._NavigateToItem(action_runner, i) |
| 75 self._ReadNextArticle(action_runner) | 77 self._ReadNextArticle(action_runner) |
| 76 self._NavigateBack(action_runner) | 78 self._NavigateBack(action_runner) |
| 77 self._ScrollMainPage(action_runner) | 79 self._ScrollMainPage(action_runner) |
| 78 | 80 |
| 79 def _ReadNextArticle(self, action_runner): | 81 def _ReadNextArticle(self, action_runner): |
| 80 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | 82 if self.COMPLETE_STATE_WAIT_TIMEOUT is not None: |
| 83 action_runner.tab.WaitForDocumentReadyStateToBeComplete( | |
| 84 timeout=self.COMPLETE_STATE_WAIT_TIMEOUT) | |
| 85 else: | |
| 86 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | |
| 81 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0) | 87 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0) |
| 82 action_runner.RepeatableBrowserDrivenScroll( | 88 action_runner.RepeatableBrowserDrivenScroll( |
| 83 repeat_count=self.ITEM_SCROLL_REPEAT) | 89 repeat_count=self.ITEM_SCROLL_REPEAT) |
| 84 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0) | 90 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0) |
| 85 | 91 |
| 86 def _ScrollMainPage(self, action_runner): | 92 def _ScrollMainPage(self, action_runner): |
| 87 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | 93 action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
| 88 action_runner.RepeatableBrowserDrivenScroll( | 94 action_runner.RepeatableBrowserDrivenScroll( |
| 89 repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) | 95 repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) |
| 90 | 96 |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 563 class BrowseTOIMobileStory(_ArticleBrowsingStory): | 569 class BrowseTOIMobileStory(_ArticleBrowsingStory): |
| 564 NAME = 'browse:news:toi' | 570 NAME = 'browse:news:toi' |
| 565 URL = 'http://m.timesofindia.com' | 571 URL = 'http://m.timesofindia.com' |
| 566 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 572 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 567 TAGS = [story_tags.EMERGING_MARKET] | 573 TAGS = [story_tags.EMERGING_MARKET] |
| 568 | 574 |
| 569 ITEMS_TO_VISIT = 4 | 575 ITEMS_TO_VISIT = 4 |
| 570 ITEM_SELECTOR = '.dummy-img' | 576 ITEM_SELECTOR = '.dummy-img' |
| 571 | 577 |
| 572 | 578 |
| 573 @decorators.Disabled('android') # crbug.com/713036. | |
| 574 class BrowseGloboMobileStory(_ArticleBrowsingStory): | 579 class BrowseGloboMobileStory(_ArticleBrowsingStory): |
| 575 NAME = 'browse:news:globo' | 580 NAME = 'browse:news:globo' |
| 576 URL = 'http://www.globo.com' | 581 URL = 'http://www.globo.com' |
| 577 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 582 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 578 TAGS = [story_tags.EMERGING_MARKET] | 583 TAGS = [story_tags.EMERGING_MARKET] |
| 579 | 584 |
| 580 ITEMS_TO_VISIT = 4 | 585 ITEMS_TO_VISIT = 4 |
| 581 ITEM_SELECTOR = '.hui-premium__title' | 586 ITEM_SELECTOR = '.hui-premium__title' |
| 587 COMPLETE_STATE_WAIT_TIMEOUT = 150 | |
| 582 | 588 |
| 583 | 589 |
| 584 class BrowseCricBuzzMobileStory(_ArticleBrowsingStory): | 590 class BrowseCricBuzzMobileStory(_ArticleBrowsingStory): |
| 585 NAME = 'browse:news:cricbuzz' | 591 NAME = 'browse:news:cricbuzz' |
| 586 URL = 'http://m.cricbuzz.com' | 592 URL = 'http://m.cricbuzz.com' |
| 587 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 593 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 588 TAGS = [story_tags.EMERGING_MARKET] | 594 TAGS = [story_tags.EMERGING_MARKET] |
| 589 | 595 |
| 590 ITEMS_TO_VISIT = 3 | 596 ITEMS_TO_VISIT = 3 |
| 591 ITEM_SELECTOR = '.list-content' | 597 ITEM_SELECTOR = '.list-content' |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 # Reduce the speed (the current wpr is recorded with speed set to 50) when | 779 # Reduce the speed (the current wpr is recorded with speed set to 50) when |
| 774 # recording the wpr. If we scroll too fast, the data will not be recorded | 780 # recording the wpr. If we scroll too fast, the data will not be recorded |
| 775 # well. After recording reset it back to the original value to have a more | 781 # well. After recording reset it back to the original value to have a more |
| 776 # realistic scroll. | 782 # realistic scroll. |
| 777 action_runner.RepeatableBrowserDrivenScroll( | 783 action_runner.RepeatableBrowserDrivenScroll( |
| 778 x_scroll_distance_ratio = 0.0, y_scroll_distance_ratio = 1, | 784 x_scroll_distance_ratio = 0.0, y_scroll_distance_ratio = 1, |
| 779 repeat_count=3, speed=400, timeout=120) | 785 repeat_count=3, speed=400, timeout=120) |
| 780 action_runner.RepeatableBrowserDrivenScroll( | 786 action_runner.RepeatableBrowserDrivenScroll( |
| 781 x_scroll_distance_ratio = 1, y_scroll_distance_ratio = 0, | 787 x_scroll_distance_ratio = 1, y_scroll_distance_ratio = 0, |
| 782 repeat_count=3, speed=500, timeout=120) | 788 repeat_count=3, speed=500, timeout=120) |
| OLD | NEW |