Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import os | |
| 6 import sys | |
| 7 | |
| 8 from core import path_util | |
| 9 from core import perf_benchmark | |
| 10 from telemetry.web_perf import timeline_based_measurement | |
| 11 import page_sets | |
| 12 | |
| 13 | |
| 14 BATTOR_PATH = os.path.join( | |
|
rnephew (Reviews Here)
2016/05/17 18:54:16
Is there a better place to add this to the python
nednguyen
2016/05/18 02:15:18
Here is ok. Ideally, the tools/perf should follow
| |
| 15 path_util.GetTelemetryDir(), '..', 'common', 'battor', 'battor') | |
| 16 sys.path.insert(1, BATTOR_PATH) | |
| 17 import battor_wrapper | |
| 18 | |
| 19 class _BattOrBenchmark(perf_benchmark.PerfBenchmark): | |
| 20 | |
| 21 def CreateTimelineBasedMeasurementOptions(self): | |
| 22 options = timeline_based_measurement.Options() | |
| 23 options.config.enable_battor_trace = True | |
| 24 # TODO(rnephew): Enable chrome trace when clock syncs work well with it. | |
| 25 options.config.enable_chrome_trace = False | |
| 26 options.SetTimelineBasedMetric('SystemHealthMetrics') | |
| 27 return options | |
| 28 | |
| 29 @classmethod | |
| 30 def ShouldDisable(cls, browser): | |
| 31 # Only run if BattOr is detected. | |
| 32 test_platform = browser.platform.GetOSName() | |
| 33 # pylint: disable=protected-access | |
| 34 device = (browser.platform._platform_backend.device | |
|
nednguyen
2016/05/18 02:15:17
Accessing _platform_backend here violates the priv
nednguyen
2016/05/18 02:17:07
err, sorry. Let's name it platform.HasBattorConnec
rnephew (Reviews Here)
2016/05/19 16:50:03
Done. Needs https://codereview.chromium.org/199763
| |
| 35 if test_platform == 'android' else None) | |
| 36 if not battor_wrapper.IsBattOrConnected(test_platform, | |
| 37 android_device=device): | |
| 38 return True | |
| 39 | |
| 40 # Galaxy S5s have problems with running system health metrics. | |
| 41 # http://crbug.com/600463 | |
| 42 galaxy_s5_type_name = 'SM-G900H' | |
| 43 return browser.platform.GetDeviceTypeName() == galaxy_s5_type_name | |
| 44 | |
| 45 @classmethod | |
| 46 def ShouldTearDownStateAfterEachStoryRun(cls): | |
| 47 return True | |
| 48 | |
| 49 | |
| 50 class BattOrPowerMobileSites(_BattOrBenchmark): | |
| 51 page_set = page_sets.power_cases.PowerCasesPageSet | |
| 52 | |
| 53 @classmethod | |
| 54 def Name(cls): | |
| 55 return 'BattOr.BattOrCases' | |
| 56 | |
| OLD | NEW |