Commit 9448d563 authored by hpayer's avatar hpayer Committed by Commit bot

Add repeat_delay_ms and repeat_count as configurable parameters to the infinit...

Add repeat_delay_ms and repeat_count as configurable parameters to the infinit scrolling benchmarks.

Twitter gets stuck most of the time when we scroll continuously. Non-continuous scrolling fixes the issue.

BUG=

Review URL: https://codereview.chromium.org/1471233002

Cr-Commit-Position: refs/heads/master@{#361348}
parent 7226c82f
...@@ -13,14 +13,15 @@ STARTUP_SCRIPT = ''' ...@@ -13,14 +13,15 @@ STARTUP_SCRIPT = '''
window.Worker = undefined; window.Worker = undefined;
window.performance = undefined;''' window.performance = undefined;'''
def _ScrollAction(action_runner, scroll_amount): def _ScrollAction(action_runner, scroll_amount, delay, repeat):
action_runner.Wait(TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS) action_runner.Wait(TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS)
with action_runner.CreateInteraction('Begin'): with action_runner.CreateInteraction('Begin'):
action_runner.tab.browser.DumpMemory() action_runner.tab.browser.DumpMemory()
with action_runner.CreateInteraction('Scrolling'): with action_runner.CreateInteraction('Scrolling'):
action_runner.RepeatableBrowserDrivenScroll( action_runner.RepeatableBrowserDrivenScroll(
y_scroll_distance_ratio=scroll_amount, y_scroll_distance_ratio=scroll_amount,
repeat_count=0) repeat_delay_ms=delay,
repeat_count=repeat)
with action_runner.CreateInteraction('End'): with action_runner.CreateInteraction('End'):
action_runner.tab.browser.DumpMemory() action_runner.tab.browser.DumpMemory()
...@@ -34,11 +35,12 @@ def _CreateInfiniteScrollPageClass(base_page_cls): ...@@ -34,11 +35,12 @@ def _CreateInfiniteScrollPageClass(base_page_cls):
class DerivedSmoothPage(base_page_cls): # pylint: disable=no-init class DerivedSmoothPage(base_page_cls): # pylint: disable=no-init
def RunPageInteractions(self, action_runner): def RunPageInteractions(self, action_runner):
_WaitAction(action_runner) _WaitAction(action_runner)
_ScrollAction(action_runner, self.scroll_amount) _ScrollAction(action_runner, self.scroll_amount, self.delay, self.repeat)
return DerivedSmoothPage return DerivedSmoothPage
class InfiniteScrollPage(page_module.Page): class InfiniteScrollPage(page_module.Page):
def __init__(self, url, page_set, name, scroll_amount, credentials=None): def __init__(self, url, page_set, name, scroll_amount, delay, repeat,
credentials=None):
super(InfiniteScrollPage, self).__init__( super(InfiniteScrollPage, self).__init__(
url=url, page_set=page_set, name=name, url=url, page_set=page_set, name=name,
shared_page_state_class=shared_page_state.SharedPageState, shared_page_state_class=shared_page_state.SharedPageState,
...@@ -46,6 +48,8 @@ class InfiniteScrollPage(page_module.Page): ...@@ -46,6 +48,8 @@ class InfiniteScrollPage(page_module.Page):
self.credentials = credentials self.credentials = credentials
self.script_to_evaluate_on_commit = STARTUP_SCRIPT self.script_to_evaluate_on_commit = STARTUP_SCRIPT
self.scroll_amount = scroll_amount self.scroll_amount = scroll_amount
self.delay = delay
self.repeat = repeat
class InfiniteScrollPageSet(story.StorySet): class InfiniteScrollPageSet(story.StorySet):
""" Top pages that can be scrolled for many pages. """ """ Top pages that can be scrolled for many pages. """
...@@ -57,14 +61,15 @@ class InfiniteScrollPageSet(story.StorySet): ...@@ -57,14 +61,15 @@ class InfiniteScrollPageSet(story.StorySet):
# continiously throught the test without hitting the end of the page. # continiously throught the test without hitting the end of the page.
SCROLL_FAR = 30 SCROLL_FAR = 30
SCROLL_NEAR = 13 SCROLL_NEAR = 13
SCROLL_PAGE = 1
pages = [ pages = [
('https://www.facebook.com/shakira', 'facebook', SCROLL_FAR), ('https://www.facebook.com/shakira', 'facebook', SCROLL_FAR, 0, 0),
('https://twitter.com/taylorswift13', 'twitter', SCROLL_FAR), ('https://twitter.com/taylorswift13', 'twitter', SCROLL_PAGE, 10, 30),
('http://espn.go.com/', 'espn', SCROLL_NEAR), ('http://espn.go.com/', 'espn', SCROLL_NEAR, 0, 0),
('https://www.yahoo.com', 'yahoo', SCROLL_NEAR), ('https://www.yahoo.com', 'yahoo', SCROLL_NEAR, 0, 0),
('http://techcrunch.tumblr.com/', 'tumblr', SCROLL_FAR), ('http://techcrunch.tumblr.com/', 'tumblr', SCROLL_FAR, 0, 0),
('https://www.flickr.com/explore', 'flickr', SCROLL_FAR) ('https://www.flickr.com/explore', 'flickr', SCROLL_FAR, 0, 0)
] ]
for (url, name, scroll_amount) in pages: for (url, name, scroll_amount, delay, repeat) in pages:
page_class = _CreateInfiniteScrollPageClass(InfiniteScrollPage) page_class = _CreateInfiniteScrollPageClass(InfiniteScrollPage)
self.AddStory(page_class(url, self, name, scroll_amount)) self.AddStory(page_class(url, self, name, scroll_amount, delay, repeat))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment