forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG=574888 Review-Url: https://codereview.chromium.org/1984473002 Cr-Commit-Position: refs/heads/master@{#396642}
- Loading branch information
1 parent
c70d006
commit 21bd980
Showing
5 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2016 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
from core import perf_benchmark | ||
from telemetry.web_perf import timeline_based_measurement | ||
import page_sets | ||
|
||
|
||
class _BattOrBenchmark(perf_benchmark.PerfBenchmark): | ||
|
||
def CreateTimelineBasedMeasurementOptions(self): | ||
options = timeline_based_measurement.Options() | ||
options.config.enable_battor_trace = True | ||
# TODO(rnephew): Enable chrome trace when clock syncs work well with it. | ||
options.config.enable_chrome_trace = False | ||
options.SetTimelineBasedMetric('powerMetric') | ||
return options | ||
|
||
@classmethod | ||
def ShouldDisable(cls, possible_browser): | ||
# Only run if BattOr is detected. | ||
if not possible_browser.platform.HasBattOrConnected(): | ||
return True | ||
|
||
# Galaxy S5s have problems with running system health metrics. | ||
# http://crbug.com/600463 | ||
galaxy_s5_type_name = 'SM-G900H' | ||
return possible_browser.platform.GetDeviceTypeName() == galaxy_s5_type_name | ||
|
||
@classmethod | ||
def ShouldTearDownStateAfterEachStoryRun(cls): | ||
return True | ||
|
||
|
||
class BattOrPowerMobileSites(_BattOrBenchmark): | ||
page_set = page_sets.power_cases.PowerCasesPageSet | ||
|
||
@classmethod | ||
def Name(cls): | ||
return 'BattOr.BattOrCases' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.", | ||
"archives": { | ||
"power_cases_001.wpr": [ | ||
"https://www.youtube.com/watch?v=3KANI2dpXLw?autoplay=1", | ||
"https://webkit.org/blog-files/3d-transforms/poster-circle.html", | ||
"about:blank" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ad0c9942a0e37e060df21677fd581d020ab5adc8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6eb34ee3e0fe12965951c44bb468cf60a5d0bacd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2016 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
from telemetry.page import page as page_module | ||
from telemetry.page import shared_page_state | ||
from telemetry import story | ||
|
||
|
||
URL_LIST = [ | ||
'https://webkit.org/blog-files/3d-transforms/poster-circle.html', | ||
# Does not autoplay on Android devices. | ||
'https://www.youtube.com/watch?v=3KANI2dpXLw?autoplay=1', | ||
'about:blank' | ||
] | ||
|
||
|
||
class PowerCasesPage(page_module.Page): | ||
|
||
def __init__(self, url, page_set, name=''): | ||
super(PowerCasesPage, self).__init__( | ||
url=url, page_set=page_set, name=name, | ||
credentials_path = 'data/credentials.json', | ||
shared_page_state_class=shared_page_state.SharedDesktopPageState) | ||
self.archive_data_file = 'data/power_cases.json' | ||
|
||
def RunPageInteractions(self, action_runner): | ||
action_runner.Wait(30) | ||
|
||
|
||
class PowerCasesPageSet(story.StorySet): | ||
"""Power hungry pages, used for power testing.""" | ||
|
||
def __init__(self): | ||
super(PowerCasesPageSet, self).__init__( | ||
archive_data_file='data/power_cases.json', | ||
cloud_storage_bucket=story.PARTNER_BUCKET) | ||
|
||
for url in URL_LIST: | ||
self.AddStory(PowerCasesPage(url, self)) |