| 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 from telemetry.page import page as page_module | 4 from telemetry.page import page as page_module |
| 5 from telemetry.page import shared_page_state | 5 from telemetry.page import shared_page_state |
| 6 from telemetry import story | 6 from telemetry import story |
| 7 | 7 |
| 8 TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS = 5 | 8 TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS = 5 |
| 9 SCROLL_TIMEOUT_IN_SECONDS = 120 | 9 SCROLL_TIMEOUT_IN_SECONDS = 120 |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 action_runner.RepeatableBrowserDrivenScroll( | 40 action_runner.RepeatableBrowserDrivenScroll( |
| 41 y_scroll_distance_ratio=scroll_amount, | 41 y_scroll_distance_ratio=scroll_amount, |
| 42 repeat_delay_ms=delay, | 42 repeat_delay_ms=delay, |
| 43 repeat_count=repeat, | 43 repeat_count=repeat, |
| 44 timeout=SCROLL_TIMEOUT_IN_SECONDS) | 44 timeout=SCROLL_TIMEOUT_IN_SECONDS) |
| 45 with action_runner.CreateInteraction('End'): | 45 with action_runner.CreateInteraction('End'): |
| 46 action_runner.tab.browser.DumpMemory() | 46 action_runner.tab.browser.DumpMemory() |
| 47 | 47 |
| 48 def _WaitAction(self, action_runner): | 48 def _WaitAction(self, action_runner): |
| 49 with action_runner.CreateInteraction('Load'): | 49 with action_runner.CreateInteraction('Load'): |
| 50 action_runner.WaitForJavaScriptCondition2( | 50 action_runner.WaitForJavaScriptCondition( |
| 51 'document.body != null && ' | 51 'document.body != null && ' |
| 52 'document.body.scrollHeight > window.innerHeight && ' | 52 'document.body.scrollHeight > window.innerHeight && ' |
| 53 '!document.body.addEventListener("touchstart", function() {})') | 53 '!document.body.addEventListener("touchstart", function() {})') |
| 54 with action_runner.CreateInteraction('Wait'): | 54 with action_runner.CreateInteraction('Wait'): |
| 55 action_runner.Wait(TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS) | 55 action_runner.Wait(TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS) |
| 56 with action_runner.CreateInteraction('GC'): | 56 with action_runner.CreateInteraction('GC'): |
| 57 action_runner.ForceGarbageCollection() | 57 action_runner.ForceGarbageCollection() |
| 58 | 58 |
| 59 | 59 |
| 60 class InfiniteScrollPageSet(story.StorySet): | 60 class InfiniteScrollPageSet(story.StorySet): |
| (...skipping 10 matching lines...) Expand all Loading... |
| 71 ('https://www.facebook.com/shakira', 'facebook', SCROLL_FAR, 0, 0), | 71 ('https://www.facebook.com/shakira', 'facebook', SCROLL_FAR, 0, 0), |
| 72 ('https://twitter.com/taylorswift13', 'twitter', SCROLL_PAGE, 10, 30), | 72 ('https://twitter.com/taylorswift13', 'twitter', SCROLL_PAGE, 10, 30), |
| 73 ('http://techcrunch.tumblr.com/', 'tumblr', SCROLL_FAR, 0, 0), | 73 ('http://techcrunch.tumblr.com/', 'tumblr', SCROLL_FAR, 0, 0), |
| 74 ('https://www.flickr.com/explore', 'flickr', SCROLL_FAR, 0, 0), | 74 ('https://www.flickr.com/explore', 'flickr', SCROLL_FAR, 0, 0), |
| 75 ('https://meta.discourse.org/t/the-official-discourse-tags-plugin-discou
rse-tagging/26482', | 75 ('https://meta.discourse.org/t/the-official-discourse-tags-plugin-discou
rse-tagging/26482', |
| 76 'discourse', SCROLL_PAGE, 10, 30) | 76 'discourse', SCROLL_PAGE, 10, 30) |
| 77 ] | 77 ] |
| 78 for (url, name, scroll_amount, delay, repeat) in pages: | 78 for (url, name, scroll_amount, delay, repeat) in pages: |
| 79 self.AddStory( | 79 self.AddStory( |
| 80 InfiniteScrollPage(url, self, name, scroll_amount, delay, repeat)) | 80 InfiniteScrollPage(url, self, name, scroll_amount, delay, repeat)) |
| OLD | NEW |