| 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 from page_sets import mobile_facebook_page | 4 from page_sets import mobile_facebook_page |
| 5 from telemetry.page import page as page_module | 5 from telemetry.page import page as page_module |
| 6 from telemetry.page import shared_page_state | 6 from telemetry.page import shared_page_state |
| 7 from telemetry import story | 7 from telemetry import story |
| 8 | 8 |
| 9 TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS = 5 | 9 TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS = 5 |
| 10 SCROLL_TIMEOUT_IN_SECONDS = 120 | 10 SCROLL_TIMEOUT_IN_SECONDS = 120 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 action_runner.RepeatableBrowserDrivenScroll( | 22 action_runner.RepeatableBrowserDrivenScroll( |
| 23 y_scroll_distance_ratio=scroll_amount, | 23 y_scroll_distance_ratio=scroll_amount, |
| 24 repeat_delay_ms=delay, | 24 repeat_delay_ms=delay, |
| 25 repeat_count=repeat, | 25 repeat_count=repeat, |
| 26 timeout=SCROLL_TIMEOUT_IN_SECONDS) | 26 timeout=SCROLL_TIMEOUT_IN_SECONDS) |
| 27 with action_runner.CreateInteraction('End'): | 27 with action_runner.CreateInteraction('End'): |
| 28 action_runner.tab.browser.DumpMemory() | 28 action_runner.tab.browser.DumpMemory() |
| 29 | 29 |
| 30 def _WaitAction(action_runner): | 30 def _WaitAction(action_runner): |
| 31 with action_runner.CreateInteraction('Load'): | 31 with action_runner.CreateInteraction('Load'): |
| 32 action_runner.WaitForJavaScriptCondition2( | 32 action_runner.WaitForJavaScriptCondition( |
| 33 'document.body != null && ' | 33 'document.body != null && ' |
| 34 'document.body.scrollHeight > window.innerHeight && ' | 34 'document.body.scrollHeight > window.innerHeight && ' |
| 35 '!document.body.addEventListener("touchstart", function() {})') | 35 '!document.body.addEventListener("touchstart", function() {})') |
| 36 with action_runner.CreateInteraction('Wait'): | 36 with action_runner.CreateInteraction('Wait'): |
| 37 action_runner.Wait(TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS) | 37 action_runner.Wait(TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS) |
| 38 with action_runner.CreateInteraction('GC'): | 38 with action_runner.CreateInteraction('GC'): |
| 39 action_runner.ForceGarbageCollection() | 39 action_runner.ForceGarbageCollection() |
| 40 | 40 |
| 41 class MobileInfiniteScrollPage(page_module.Page): | 41 class MobileInfiniteScrollPage(page_module.Page): |
| 42 def __init__(self, url, page_set, name, scroll_amount, delay, repeat, | 42 def __init__(self, url, page_set, name, scroll_amount, delay, repeat, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 ('https://www.flickr.com/explore', 'flickr', SCROLL_FAR, 0, 0), | 89 ('https://www.flickr.com/explore', 'flickr', SCROLL_FAR, 0, 0), |
| 90 ('https://meta.discourse.org/t/the-official-discourse-tags-plugin-discou
rse-tagging/26482', | 90 ('https://meta.discourse.org/t/the-official-discourse-tags-plugin-discou
rse-tagging/26482', |
| 91 'discourse', SCROLL_PAGE, 10, 30) | 91 'discourse', SCROLL_PAGE, 10, 30) |
| 92 ] | 92 ] |
| 93 self.AddStory( | 93 self.AddStory( |
| 94 MobileInfiniteScrollFacebookPage(pages[0][0], self, pages[0][1], | 94 MobileInfiniteScrollFacebookPage(pages[0][0], self, pages[0][1], |
| 95 pages[0][2], pages[0][3], pages[0][4])) | 95 pages[0][2], pages[0][3], pages[0][4])) |
| 96 for (url, name, scroll_amount, delay, repeat) in pages[1:]: | 96 for (url, name, scroll_amount, delay, repeat) in pages[1:]: |
| 97 self.AddStory( | 97 self.AddStory( |
| 98 MobileInfiniteScrollPage(url, self, name, scroll_amount, delay, repeat)) | 98 MobileInfiniteScrollPage(url, self, name, scroll_amount, delay, repeat)) |
| OLD | NEW |