Commit 45907441 authored by Jean-denis Muys's avatar Jean-denis Muys Committed by Commit Bot

Added a Chrome Custom Tab start up benchmark to startup.mobile benchmark

The new story is named cct:no_warmup:bbc

Bug: 760498

Change-Id: I11a1d2e0b9b4a9dbfb4c4f31f039c4ca3bbe75c6
Reviewed-on: https://chromium-review.googlesource.com/c/1301914
Commit-Queue: Jean-Denis Muys <jdmuys@chromium.org>
Reviewed-by: default avatarJuan Antonio Navarro Pérez <perezju@chromium.org>
Reviewed-by: default avatarEgor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607592}
parent e9241ea5
......@@ -46,6 +46,10 @@ from devil.android.sdk import intent # pylint: disable=import-error
# in expectations.config to avoid failures on Android versions below M. This
# override is also used on internal bots. See: http://crbug.com/894744 and
# http://crbug.com/849907.
_NUMBER_OF_ITERATIONS = 10
_MAX_BATTERY_TEMP = 32
class _MobileStartupSharedState(story_module.SharedState):
def __init__(self, test, finder_options, story_set):
......@@ -85,13 +89,27 @@ class _MobileStartupSharedState(story_module.SharedState):
if flush_caches:
self.platform.FlushDnsCache()
self._possible_browser.FlushOsPageCaches()
self.platform.WaitForBatteryTemperature(32)
self.platform.WaitForBatteryTemperature(_MAX_BATTERY_TEMP)
self.platform.StartActivity(
intent.Intent(package=self._possible_browser.settings.package,
activity=self._possible_browser.settings.activity,
action=None, data=url),
blocking=True)
def LaunchCCT(self, url):
self.platform.FlushDnsCache()
self._possible_browser.FlushOsPageCaches()
self.platform.WaitForBatteryTemperature(_MAX_BATTERY_TEMP)
# Note: The presence of the extra.SESSION extra defines a CCT intent.
cct_extras = {'android.support.customtabs.extra.SESSION': None}
self.platform.StartActivity(
intent.Intent(package=self._possible_browser.settings.package,
activity=self._possible_browser.settings.activity,
action=None, data=url, extras=cct_extras),
blocking=True)
@contextlib.contextmanager
def FindBrowser(self):
"""Find and manage the lifetime of a browser.
......@@ -138,7 +156,7 @@ class _MobileStartupSharedState(story_module.SharedState):
def _DriveMobileStartupWithIntent(state, flush_caches):
for _ in xrange(10):
for _ in xrange(_NUMBER_OF_ITERATIONS):
# TODO(pasko): Find a way to fail the benchmark when WPR is set up
# incorrectly and error pages get loaded.
state.LaunchBrowser('http://bbc.co.uk', flush_caches)
......@@ -165,6 +183,19 @@ class _MobileStartupWithIntentStoryWarm(story_module.Story):
_DriveMobileStartupWithIntent(state, flush_caches=False)
class _MobileStartupWithCctIntentStory(story_module.Story):
def __init__(self):
super(_MobileStartupWithCctIntentStory, self).__init__(
_MobileStartupSharedState, name='cct:coldish:bbc')
def Run(self, state):
for _ in xrange(_NUMBER_OF_ITERATIONS):
state.LaunchCCT('http://bbc.co.uk')
with state.FindBrowser() as browser:
action_runner = browser.foreground_tab.action_runner
action_runner.tab.WaitForDocumentReadyStateToBeComplete()
class _MobileStartupStorySet(story_module.StorySet):
def __init__(self):
super(_MobileStartupStorySet, self).__init__(
......@@ -172,6 +203,7 @@ class _MobileStartupStorySet(story_module.StorySet):
cloud_storage_bucket=story_module.PARTNER_BUCKET)
self.AddStory(_MobileStartupWithIntentStory())
self.AddStory(_MobileStartupWithIntentStoryWarm())
self.AddStory(_MobileStartupWithCctIntentStory())
@benchmark.Info(emails=['pasko@chromium.org',
......
......@@ -217,8 +217,9 @@ crbug.com/865400 [ Nexus_5X ] rasterize_and_record_micro.top_25/file://static_to
crbug.com/875878 [ Nexus6_Webview ] rasterize_and_record_micro.top_25/file://static_top_25/yahoogames.html [ Skip ]
# Benchmark: startup.mobile
crbug.com/894744 [ Android ] startup.mobile/intent:coldish:bbc [ Skip ]
crbug.com/894744 [ Android ] startup.mobile/intent:warm:bbc [ Skip ]
# crbug.com/894744 [ Android ] startup.mobile/intent:coldish:bbc [ Skip ]
# crbug.com/894744 [ Android ] startup.mobile/intent:warm:bbc [ Skip ]
# crbug.com/894744 [ Android ] startup.mobile/cct:coldish:bbc [ Skip ]
# Benchmark: system_health.common_desktop
crbug.com/773084 [ Mac ] system_health.common_desktop/browse:tools:maps [ Skip ]
......
......@@ -6,6 +6,9 @@
"intent:warm:bbc": {
"DEFAULT": "startup_pages_000.wprgo"
},
"cct:coldish:bbc": {
"DEFAULT": "startup_pages_000.wprgo"
},
"http://bbc.co.uk": {
"DEFAULT": "startup_pages_000.wprgo"
},
......@@ -13,6 +16,6 @@
"DEFAULT": "startup_pages_000.wprgo"
}
},
"description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.",
"description": "Describes the Web Page Replay archives for a story set. Normally record_wpr is used to produce this file. Since record_wpr does not work for startup.mobile benchmarks, we allow adding new stories to this file by hand.",
"platform_specific": true
}
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