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

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

Issue 1663053006: perf: Add a power benchmark for pages with heavy ads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unbreak cnn URL. Created 4 years, 10 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
« no previous file with comments | « tools/perf/benchmarks/smoothness.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26d77452d69eb88b7d163ba198b56ecbb101cf41..e561715087681bf369812944101077378fe83d85 100644
--- a/tools/perf/page_sets/tough_ad_cases.py
+++ b/tools/perf/page_sets/tough_ad_cases.py
@@ -33,12 +33,13 @@ class SwiffyPage(page_module.Page):
action_runner.Wait(10)
-class ScrollingPage(page_module.Page):
+class AdPage(page_module.Page):
def __init__(self, url, page_set, make_javascript_deterministic=True,
y_scroll_distance_multiplier=0.5, bidirectional_scroll=False,
+ scroll=False,
wait_for_interactive_or_better=False):
- super(ScrollingPage, self).__init__(
+ super(AdPage, self).__init__(
url=url,
page_set=page_set,
make_javascript_deterministic=make_javascript_deterministic,
@@ -46,6 +47,7 @@ class ScrollingPage(page_module.Page):
repeatable_synthesize_scroll_gesture_shared_state.\
RepeatableSynthesizeScrollGestureSharedState))
self._y_scroll_distance_multiplier = y_scroll_distance_multiplier
+ self._scroll = scroll
self._bidirectional_scroll = bidirectional_scroll
self._wait_for_interactive_or_better = wait_for_interactive_or_better
@@ -77,7 +79,10 @@ class ScrollingPage(page_module.Page):
'!document.body.addEventListener("touchstart", function() {})')
def RunPageInteractions(self, action_runner):
- if self._bidirectional_scroll:
+ if not self._scroll:
+ with action_runner.CreateInteraction('ToughAd'):
+ action_runner.Wait(30)
+ elif self._bidirectional_scroll:
action_runner.RepeatableBrowserDrivenScroll(
y_scroll_distance_ratio=self._y_scroll_distance_multiplier,
repeat_count=4)
@@ -90,29 +95,30 @@ class ScrollingPage(page_module.Page):
repeat_count=9)
-class ScrollingForbesPage(ScrollingPage):
+class ForbesAdPage(AdPage):
- def __init__(self, url, page_set, bidirectional_scroll=False):
+ def __init__(self, url, page_set, scroll=False, bidirectional_scroll=False):
# forbes.com uses a strange dynamic transform on the body element,
# which occasionally causes us to try scrolling from outside the
# screen. Start at the very top of the viewport to avoid this.
- super(ScrollingForbesPage, self).__init__(
+ super(ForbesAdPage, self).__init__(
url=url, page_set=page_set, make_javascript_deterministic=False,
+ scroll=scroll,
bidirectional_scroll=bidirectional_scroll,
wait_for_interactive_or_better=True)
def RunNavigateSteps(self, action_runner):
- super(ScrollingForbesPage, self).RunNavigateSteps(action_runner)
+ super(ForbesAdPage, self).RunNavigateSteps(action_runner)
# Wait until the interstitial banner goes away.
action_runner.WaitForJavaScriptCondition(
'window.location.pathname.indexOf("welcome") == -1')
-class ToughAdCasesPageSet(story.StorySet):
+class SyntheticToughAdCasesPageSet(story.StorySet):
"""Pages for measuring rendering performance with advertising content."""
def __init__(self):
- super(ToughAdCasesPageSet, self).__init__(
+ super(SyntheticToughAdCasesPageSet, self).__init__(
archive_data_file='data/tough_ad_cases.json',
cloud_storage_bucket=story.INTERNAL_BUCKET)
@@ -138,11 +144,11 @@ class ToughAdCasesPageSet(story.StorySet):
self.AddStory(SwiffyPage(url, self))
-class ToughWebglAdCasesPageSet(story.StorySet):
+class SyntheticToughWebglAdCasesPageSet(story.StorySet):
"""Pages for measuring rendering performance with WebGL ad content."""
def __init__(self):
- super(ToughWebglAdCasesPageSet, self).__init__(
+ super(SyntheticToughWebglAdCasesPageSet, self).__init__(
archive_data_file='data/tough_ad_cases.json',
cloud_storage_bucket=story.INTERNAL_BUCKET)
@@ -168,56 +174,65 @@ class ToughWebglAdCasesPageSet(story.StorySet):
self.AddStory(SwiffyPage(url, self))
-class ScrollingToughAdCasesPageSet(story.StorySet):
- """Pages for measuring scrolling performance with advertising content."""
+class ToughAdCasesPageSet(story.StorySet):
+ """Pages for measuring performance with advertising content."""
- def __init__(self, bidirectional_scroll=False):
- super(ScrollingToughAdCasesPageSet, self).__init__(
+ def __init__(self, scroll=False, bidirectional_scroll=False):
+ super(ToughAdCasesPageSet, self).__init__(
archive_data_file='data/tough_ad_cases.json',
cloud_storage_bucket=story.INTERNAL_BUCKET)
- self.AddStory(ScrollingPage('file://tough_ad_cases/'
+ self.AddStory(AdPage('file://tough_ad_cases/'
'swiffy_collection.html', self, make_javascript_deterministic=False,
- y_scroll_distance_multiplier=0.25,
+ y_scroll_distance_multiplier=0.25, scroll=scroll,
bidirectional_scroll=bidirectional_scroll))
- self.AddStory(ScrollingPage('file://tough_ad_cases/'
+ self.AddStory(AdPage('file://tough_ad_cases/'
'swiffy_webgl_collection.html',
- self, make_javascript_deterministic=False,
+ self, make_javascript_deterministic=False, scroll=scroll,
bidirectional_scroll=bidirectional_scroll))
- self.AddStory(ScrollingPage('http://www.latimes.com', self,
- bidirectional_scroll=bidirectional_scroll,
+ self.AddStory(AdPage('http://www.latimes.com', self,
+ bidirectional_scroll=bidirectional_scroll, scroll=scroll,
wait_for_interactive_or_better=True))
- self.AddStory(ScrollingForbesPage('http://www.forbes.com/sites/parmyolson/'
- '2015/07/29/jana-mobile-data-facebook-internet-org/', self,
- bidirectional_scroll=bidirectional_scroll))
- self.AddStory(ScrollingPage('http://androidcentral.com', self,
+ self.AddStory(ForbesAdPage('http://www.forbes.com/sites/parmyolson/'
+ '2015/07/29/jana-mobile-data-facebook-internet-org/',
+ self, scroll=scroll, bidirectional_scroll=bidirectional_scroll))
+ self.AddStory(AdPage('http://androidcentral.com', self, scroll=scroll,
bidirectional_scroll=bidirectional_scroll,
wait_for_interactive_or_better=True))
- self.AddStory(ScrollingPage('http://mashable.com', self,
+ self.AddStory(AdPage('http://mashable.com', self, scroll=scroll,
y_scroll_distance_multiplier=0.25,
bidirectional_scroll=bidirectional_scroll))
- self.AddStory(ScrollingPage('http://www.androidauthority.com/'
+ self.AddStory(AdPage('http://www.androidauthority.com/'
'reduce-data-use-turn-on-data-compression-in-chrome-630064/', self,
- bidirectional_scroll=bidirectional_scroll))
- self.AddStory(ScrollingPage('http://www.cnn.com/2015/01/09/politics/'
- 'nebraska-keystone-pipeline/index.html', self,
- bidirectional_scroll=bidirectional_scroll))
+ scroll=scroll, bidirectional_scroll=bidirectional_scroll))
+ self.AddStory(AdPage(('http://www.cnn.com/2015/01/09/politics/'
+ 'nebraska-keystone-pipeline/index.html'),
+ self, scroll=scroll,
+ bidirectional_scroll=bidirectional_scroll))
# Disabled: crbug.com/520509
- #self.AddStory(ScrollingPage('http://time.com/3977891/'
- # 'donald-trump-debate-republican/', self,
+ #self.AddStory(AdPage('http://time.com/3977891/'
+ # 'donald-trump-debate-republican/', self, scroll=scroll,
# bidirectional_scroll=bidirectional_scroll))
- self.AddStory(ScrollingPage('http://www.theguardian.com/uk', self,
+ self.AddStory(AdPage('http://www.theguardian.com/uk', self, scroll=scroll,
bidirectional_scroll=bidirectional_scroll))
- self.AddStory(ScrollingPage('http://m.tmz.com', self,
+ self.AddStory(AdPage('http://m.tmz.com', self, scroll=scroll,
y_scroll_distance_multiplier=0.25,
bidirectional_scroll=bidirectional_scroll))
- self.AddStory(ScrollingPage('http://androidpolice.com', self,
+ self.AddStory(AdPage('http://androidpolice.com', self, scroll=scroll,
bidirectional_scroll=bidirectional_scroll,
wait_for_interactive_or_better=True))
-class BidirectionallyScrollingToughAdCasesPageSet(ScrollingToughAdCasesPageSet):
- """Same as ScrollingAdCasesPageSet except we scroll in two directions."""
+class ScrollingToughAdCasesPageSet(ToughAdCasesPageSet):
+ """Pages for measuring scrolling performance with advertising content."""
+
+ def __init__(self):
+ super(ScrollingToughAdCasesPageSet, self).__init__(
+ scroll=True)
+
+
+class BidirectionallyScrollingToughAdCasesPageSet(ToughAdCasesPageSet):
+ """Same as ScrollingToughAdCasesPageSet except we scroll in two directions."""
def __init__(self):
super(BidirectionallyScrollingToughAdCasesPageSet, self).__init__(
« no previous file with comments | « tools/perf/benchmarks/smoothness.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698