Commit 21b10a9c authored by skyostil's avatar skyostil Committed by Commit bot

perf: Add a power benchmark for pages with heavy ads

BUG=487937
CQ_EXTRA_TRYBOTS=tryserver.chromium.perf:linux_perf_bisect;tryserver.chromium.perf:mac_10_10_perf_bisect;tryserver.chromium.perf:win_perf_bisect;tryserver.chromium.perf:android_nexus5_perf_bisect

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

Cr-Commit-Position: refs/heads/master@{#374812}
parent 878a6845
......@@ -38,6 +38,20 @@ class PowerTypical10Mobile(perf_benchmark.PerfBenchmark):
return 'power.typical_10_mobile'
@benchmark.Enabled('android')
class PowerToughAdCases(perf_benchmark.PerfBenchmark):
"""Android power test with tough ad pages."""
test = power.Power
page_set = page_sets.ToughAdCasesPageSet
def SetExtraBrowserOptions(self, options):
options.full_performance_mode = False
@classmethod
def Name(cls):
return 'power.tough_ad_cases'
@benchmark.Enabled('android')
@benchmark.Disabled('all')
class PowerTypical10MobileReload(perf_benchmark.PerfBenchmark):
......
......@@ -471,7 +471,7 @@ class SmoothnessToughTextureUploadCases(_Smoothness):
class SmoothnessToughAdCases(_Smoothness):
"""Measures rendering statistics while displaying advertisements."""
page_set = page_sets.ToughAdCasesPageSet
page_set = page_sets.SyntheticToughAdCasesPageSet
@classmethod
def Name(cls):
......@@ -510,7 +510,7 @@ class SmoothnessBidirectionallyScrollingToughAdCases(_Smoothness):
class SmoothnessToughWebGLAdCases(_Smoothness):
"""Measures rendering statistics while scrolling advertisements."""
page_set = page_sets.ToughWebglAdCasesPageSet
page_set = page_sets.SyntheticToughWebglAdCasesPageSet
@classmethod
def Name(cls):
......
......@@ -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__(
......
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