Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Unified Diff: tools/perf/page_sets/infinite_scroll_cases.py

Issue 1471233002: Add repeat_delay_ms and repeat_count as configurable parameters to the infinit scrolling benchmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/infinite_scroll_cases.py
diff --git a/tools/perf/page_sets/infinite_scroll_cases.py b/tools/perf/page_sets/infinite_scroll_cases.py
index 4781d25a2c77fb66a1a5938c1486e0e04ab991c0..993e555022d00a6e3378c15d94e6257546e12e17 100644
--- a/tools/perf/page_sets/infinite_scroll_cases.py
+++ b/tools/perf/page_sets/infinite_scroll_cases.py
@@ -13,14 +13,15 @@ STARTUP_SCRIPT = '''
window.Worker = 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)
with action_runner.CreateInteraction('Begin'):
action_runner.tab.browser.DumpMemory()
with action_runner.CreateInteraction('Scrolling'):
action_runner.RepeatableBrowserDrivenScroll(
y_scroll_distance_ratio=scroll_amount,
- repeat_count=0)
+ repeat_delay_ms=delay,
+ repeat_count=repeat)
with action_runner.CreateInteraction('End'):
action_runner.tab.browser.DumpMemory()
@@ -34,11 +35,12 @@ def _CreateInfiniteScrollPageClass(base_page_cls):
class DerivedSmoothPage(base_page_cls): # pylint: disable=no-init
def RunPageInteractions(self, action_runner):
_WaitAction(action_runner)
- _ScrollAction(action_runner, self.scroll_amount)
+ _ScrollAction(action_runner, self.scroll_amount, self.delay, self.repeat)
return DerivedSmoothPage
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__(
url=url, page_set=page_set, name=name,
shared_page_state_class=shared_page_state.SharedPageState,
@@ -46,6 +48,8 @@ class InfiniteScrollPage(page_module.Page):
self.credentials = credentials
self.script_to_evaluate_on_commit = STARTUP_SCRIPT
self.scroll_amount = scroll_amount
+ self.delay = delay
+ self.repeat = repeat
class InfiniteScrollPageSet(story.StorySet):
""" Top pages that can be scrolled for many pages. """
@@ -57,14 +61,15 @@ class InfiniteScrollPageSet(story.StorySet):
# continiously throught the test without hitting the end of the page.
SCROLL_FAR = 30
SCROLL_NEAR = 13
+ SCROLL_PAGE = 1
pages = [
- ('https://www.facebook.com/shakira', 'facebook', SCROLL_FAR),
- ('https://twitter.com/taylorswift13', 'twitter', SCROLL_FAR),
- ('http://espn.go.com/', 'espn', SCROLL_NEAR),
- ('https://www.yahoo.com', 'yahoo', SCROLL_NEAR),
- ('http://techcrunch.tumblr.com/', 'tumblr', SCROLL_FAR),
- ('https://www.flickr.com/explore', 'flickr', SCROLL_FAR)
+ ('https://www.facebook.com/shakira', 'facebook', SCROLL_FAR, 0, 0),
+ ('https://twitter.com/taylorswift13', 'twitter', SCROLL_PAGE, 10, 30),
+ ('http://espn.go.com/', 'espn', SCROLL_NEAR, 0, 0),
+ ('https://www.yahoo.com', 'yahoo', SCROLL_NEAR, 0, 0),
+ ('http://techcrunch.tumblr.com/', 'tumblr', SCROLL_FAR, 0, 0),
+ ('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)
- self.AddStory(page_class(url, self, name, scroll_amount))
+ self.AddStory(page_class(url, self, name, scroll_amount, delay, repeat))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698