| 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. Set to None |
| 72 # because we cannot access DEFAULT_WEB_CONTENTS_TIMEOUT from this file. |
| 73 COMPLETE_STATE_WAIT_TIMEOUT = None |
| 71 | 74 |
| 72 def _DidLoadDocument(self, action_runner): | 75 def _DidLoadDocument(self, action_runner): |
| 73 for i in xrange(self.ITEMS_TO_VISIT): | 76 for i in xrange(self.ITEMS_TO_VISIT): |
| 74 self._NavigateToItem(action_runner, i) | 77 self._NavigateToItem(action_runner, i) |
| 75 self._ReadNextArticle(action_runner) | 78 self._ReadNextArticle(action_runner) |
| 76 self._NavigateBack(action_runner) | 79 self._NavigateBack(action_runner) |
| 77 self._ScrollMainPage(action_runner) | 80 self._ScrollMainPage(action_runner) |
| 78 | 81 |
| 79 def _ReadNextArticle(self, action_runner): | 82 def _ReadNextArticle(self, action_runner): |
| 80 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | 83 if self.COMPLETE_STATE_WAIT_TIMEOUT is not None: |
| 84 action_runner.tab.WaitForDocumentReadyStateToBeComplete( |
| 85 timeout=self.COMPLETE_STATE_WAIT_TIMEOUT) |
| 86 else: |
| 87 action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
| 81 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0) | 88 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0) |
| 82 action_runner.RepeatableBrowserDrivenScroll( | 89 action_runner.RepeatableBrowserDrivenScroll( |
| 83 repeat_count=self.ITEM_SCROLL_REPEAT) | 90 repeat_count=self.ITEM_SCROLL_REPEAT) |
| 84 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0) | 91 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS/2.0) |
| 85 | 92 |
| 86 def _ScrollMainPage(self, action_runner): | 93 def _ScrollMainPage(self, action_runner): |
| 87 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | 94 action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
| 88 action_runner.RepeatableBrowserDrivenScroll( | 95 action_runner.RepeatableBrowserDrivenScroll( |
| 89 repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) | 96 repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) |
| 90 | 97 |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 class BrowseTOIMobileStory(_ArticleBrowsingStory): | 570 class BrowseTOIMobileStory(_ArticleBrowsingStory): |
| 564 NAME = 'browse:news:toi' | 571 NAME = 'browse:news:toi' |
| 565 URL = 'http://m.timesofindia.com' | 572 URL = 'http://m.timesofindia.com' |
| 566 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 573 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 567 TAGS = [story_tags.EMERGING_MARKET] | 574 TAGS = [story_tags.EMERGING_MARKET] |
| 568 | 575 |
| 569 ITEMS_TO_VISIT = 4 | 576 ITEMS_TO_VISIT = 4 |
| 570 ITEM_SELECTOR = '.dummy-img' | 577 ITEM_SELECTOR = '.dummy-img' |
| 571 | 578 |
| 572 | 579 |
| 573 @decorators.Disabled('android') # crbug.com/713036. | |
| 574 class BrowseGloboMobileStory(_ArticleBrowsingStory): | 580 class BrowseGloboMobileStory(_ArticleBrowsingStory): |
| 575 NAME = 'browse:news:globo' | 581 NAME = 'browse:news:globo' |
| 576 URL = 'http://www.globo.com' | 582 URL = 'http://www.globo.com' |
| 577 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 583 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 578 TAGS = [story_tags.EMERGING_MARKET] | 584 TAGS = [story_tags.EMERGING_MARKET] |
| 579 | 585 |
| 580 ITEMS_TO_VISIT = 4 | 586 ITEMS_TO_VISIT = 4 |
| 581 ITEM_SELECTOR = '.hui-premium__title' | 587 ITEM_SELECTOR = '.hui-premium__title' |
| 588 COMPLETE_STATE_WAIT_TIMEOUT = 150 |
| 582 | 589 |
| 583 | 590 |
| 584 class BrowseCricBuzzMobileStory(_ArticleBrowsingStory): | 591 class BrowseCricBuzzMobileStory(_ArticleBrowsingStory): |
| 585 NAME = 'browse:news:cricbuzz' | 592 NAME = 'browse:news:cricbuzz' |
| 586 URL = 'http://m.cricbuzz.com' | 593 URL = 'http://m.cricbuzz.com' |
| 587 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 594 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 588 TAGS = [story_tags.EMERGING_MARKET] | 595 TAGS = [story_tags.EMERGING_MARKET] |
| 589 | 596 |
| 590 ITEMS_TO_VISIT = 3 | 597 ITEMS_TO_VISIT = 3 |
| 591 ITEM_SELECTOR = '.list-content' | 598 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 | 780 # 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 | 781 # 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 | 782 # well. After recording reset it back to the original value to have a more |
| 776 # realistic scroll. | 783 # realistic scroll. |
| 777 action_runner.RepeatableBrowserDrivenScroll( | 784 action_runner.RepeatableBrowserDrivenScroll( |
| 778 x_scroll_distance_ratio = 0.0, y_scroll_distance_ratio = 1, | 785 x_scroll_distance_ratio = 0.0, y_scroll_distance_ratio = 1, |
| 779 repeat_count=3, speed=400, timeout=120) | 786 repeat_count=3, speed=400, timeout=120) |
| 780 action_runner.RepeatableBrowserDrivenScroll( | 787 action_runner.RepeatableBrowserDrivenScroll( |
| 781 x_scroll_distance_ratio = 1, y_scroll_distance_ratio = 0, | 788 x_scroll_distance_ratio = 1, y_scroll_distance_ratio = 0, |
| 782 repeat_count=3, speed=500, timeout=120) | 789 repeat_count=3, speed=500, timeout=120) |
| OLD | NEW |