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

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

Issue 1291513004: smoothness.scrolling_tough_ad_cases to use browser driven scrolls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Special handling of TMZ page Created 5 years, 4 months 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
Index: tools/perf/page_sets/tough_ad_cases.py
diff --git a/tools/perf/page_sets/tough_ad_cases.py b/tools/perf/page_sets/tough_ad_cases.py
index 75ba6e53ca0f40e8eba5222a21bcf764801c299c..b7a242d4201413064b7d3723f4938c370e2f707a 100644
--- a/tools/perf/page_sets/tough_ad_cases.py
+++ b/tools/perf/page_sets/tough_ad_cases.py
@@ -2,8 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from page_sets import repeatable_synthesize_scroll_gesture_shared_state
+
from telemetry.core import exceptions
from telemetry.page import page as page_module
+from telemetry.web_perf import timeline_interaction_record
from telemetry import story
@@ -36,9 +39,16 @@ class ScrollingPage(page_module.Page):
def __init__(self, url, page_set, top_start_ratio=.5,
make_javascript_deterministic=True):
- super(ScrollingPage, self).__init__(url=url, page_set=page_set,
- make_javascript_deterministic=make_javascript_deterministic)
+ super(ScrollingPage, self).__init__(
+ url=url,
+ page_set=page_set,
+ make_javascript_deterministic=make_javascript_deterministic,
+ shared_page_state_class=(
+ repeatable_synthesize_scroll_gesture_shared_state.\
+ RepeatableSynthesizeScrollGestureSharedState))
self._top_start_ratio = top_start_ratio
+ self._scroll_multiplier = 2
Sami 2015/08/18 15:06:46 Could you make this a named parameter?
alex clarke (OOO till 29th) 2015/08/19 11:42:20 Done.
+ print "ScrollingPage"
Sami 2015/08/18 15:06:46 Probably want to leave these out :)
alex clarke (OOO till 29th) 2015/08/19 11:42:20 Done.
def RunNavigateSteps(self, action_runner):
# Rewrite file urls to point to the replay server instead.
@@ -59,13 +69,28 @@ class ScrollingPage(page_module.Page):
action_runner.WaitForJavaScriptCondition('document.body !== null')
def RunPageInteractions(self, action_runner):
- for _ in range(10):
- with action_runner.CreateGestureInteraction('ScrollAction',
- repeatable=True):
- action_runner.ScrollPage(distance=500,
- top_start_ratio=self._top_start_ratio)
- action_runner.Wait(.25)
-
+ # Get the dimensions of the screen.
Sami 2015/08/18 15:06:46 This is another round trip through the main thread
alex clarke (OOO till 29th) 2015/08/19 11:42:20 Done.
+ js_result = action_runner.EvaluateJavaScript(
+ 'window.screen.availWidth + "," + window.screen.availHeight')
+ screensize = [int(n) for n in js_result.split(',')]
+ quarter_screen_height = screensize[1] / 4
+
+ # Set up a browser driven repeating scroll. The delay between the scrolls
+ # should be unaffected by render thread responsivness (or lack there of).
+ flags = [timeline_interaction_record.REPEATABLE]
Sami 2015/08/18 15:06:46 Could you make this into a new Action instance (wi
alex clarke (OOO till 29th) 2015/08/19 11:42:20 Seems like a lot of boilerplate, I'm not sure I'm
Sami 2015/08/19 11:54:46 The idea was that we could use this in all page se
+ scroll_params = {
+ 'x': screensize[0] / 2,
+ 'y': 3 * quarter_screen_height,
+ 'xDistance': 0,
+ 'yDistance': -quarter_screen_height * self._scroll_multiplier,
+ 'preventFling': True,
+ 'repeatCount': 9,
+ 'repeatDelayMs': 250,
+ 'interactionMarkerName':
+ timeline_interaction_record.GetJavaScriptMarker(
+ 'Gesture_ScrollAction', flags),
+ }
+ action_runner.tab.SynthesizeScrollGesture(scroll_params)
Sami 2015/08/18 15:06:46 Two blank lines here please.
alex clarke (OOO till 29th) 2015/08/19 11:42:20 Done.
class ScrollingForbesPage(ScrollingPage):
@@ -86,6 +111,23 @@ class ScrollingForbesPage(ScrollingPage):
action_runner.WaitForJavaScriptCondition('document.body !== null')
+class ScrollingTmzPage(ScrollingPage):
+
+ def __init__(self, url, page_set):
+ # The TMZ page can take a while to be scrollable.
+ super(ScrollingTmzPage, self).__init__(
+ url=url, page_set=page_set, top_start_ratio=0,
+ make_javascript_deterministic=False)
+ # The TMZ page is shorter than the others.
+ self._scroll_multiplier = 1
+
+ def RunNavigateSteps(self, action_runner):
+ super(ScrollingTmzPage, self).RunNavigateSteps(action_runner)
+ # Wait for the page to be scrollable.
+ action_runner.WaitForJavaScriptCondition(
+ 'document.body.scrollHeight > window.screen.height')
+
+
class ToughAdCasesPageSet(story.StorySet):
"""Pages for measuring rendering performance with advertising content."""
@@ -138,6 +180,6 @@ class ScrollingToughAdCasesPageSet(story.StorySet):
self.AddStory(ScrollingPage('http://time.com/3977891/'
'donald-trump-debate-republican/', self))
self.AddStory(ScrollingPage('http://www.theguardian.com/uk', self))
- self.AddStory(ScrollingPage('http://m.tmz.com', self))
+ self.AddStory(ScrollingTmzPage('http://m.tmz.com', self))
self.AddStory(ScrollingPage('http://androidpolice.com', self,
top_start_ratio=0))

Powered by Google App Engine
This is Rietveld 408576698