Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 from telemetry import benchmark | 6 from telemetry import benchmark |
| 7 from core import perf_benchmark | 7 from core import perf_benchmark |
| 8 from core import path_util | 8 from core import path_util |
| 9 from telemetry.timeline import tracing_category_filter | 9 from telemetry.timeline import tracing_category_filter |
| 10 from telemetry.web_perf import timeline_based_measurement | 10 from telemetry.web_perf import timeline_based_measurement |
| 11 | 11 |
| 12 from benchmarks.pagesets import media_router_pages | 12 from benchmarks.pagesets import media_router_perf_pages |
| 13 from benchmarks import media_router_measurements | 13 from benchmarks import media_router_measurements |
| 14 from benchmarks import media_router_timeline_metric | 14 from benchmarks import media_router_timeline_metric |
| 15 | 15 |
| 16 | 16 |
| 17 class _BaseCastBenchmark(perf_benchmark.PerfBenchmark): | 17 class _BaseCastBenchmark(perf_benchmark.PerfBenchmark): |
| 18 options = {'page_repeat': 6} | 18 options = {'page_repeat': 6} |
| 19 | 19 |
| 20 page_set = media_router_pages.MediaRouterPageSet | 20 page_set = media_router_perf_pages.MediaRouterDailogPageSet |
| 21 | 21 |
| 22 def SetExtraBrowserOptions(self, options): | 22 def SetExtraBrowserOptions(self, options): |
| 23 options.clear_sytem_cache_for_browser_and_profile_on_start = True | 23 options.clear_sytem_cache_for_browser_and_profile_on_start = True |
| 24 # This flag is required for chrome.runtime. | |
| 25 options.disable_component_extensions_with_background_pages = False | |
|
mark a. foltz
2016/04/04 20:25:06
Will running additional background pages affect te
Lei Lei
2016/04/13 00:22:42
Yes, I removed it. I just found this flag is not r
| |
| 26 # This flag is required to enable the communication between the page and | |
| 27 # the test extension. | |
| 28 options.disable_background_networking = False | |
| 29 | |
| 24 # TODO: find a better way to find extension location. | 30 # TODO: find a better way to find extension location. |
| 25 options.AppendExtraBrowserArgs([ | 31 options.AppendExtraBrowserArgs([ |
| 26 '--load-extension=' + os.path.join(path_util.GetChromiumSrcDir(), 'out', | 32 '--load-extension=' + ','.join([ |
| 27 'Release', 'mr_extension', 'release'), | 33 os.path.join(path_util.GetChromiumSrcDir(), 'out', |
| 34 'Release', 'mr_extension', 'release'), | |
| 35 os.path.join(path_util.GetChromiumSrcDir(), 'out', | |
| 36 'Release', 'media_router', 'test_extension')]), | |
| 28 '--whitelisted-extension-id=enhhojjnijigcajfphajepfemndkmdlo', | 37 '--whitelisted-extension-id=enhhojjnijigcajfphajepfemndkmdlo', |
| 29 '--media-router=1', | 38 '--media-router=1', |
| 30 '--enable-stats-collection-bindings' | 39 '--enable-stats-collection-bindings', |
| 40 '--show-component-extension-options', | |
| 41 '--enable-logging=stderr' | |
|
mark a. foltz
2016/04/04 20:25:06
Will logging affect the test performance?
Lei Lei
2016/04/13 00:22:42
Yes, I removed it.
| |
| 31 ]) | 42 ]) |
| 32 | 43 |
| 33 @classmethod | |
| 34 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
| 35 """Only drops the first result.""" | |
| 36 return not is_first_result | |
| 37 | 44 |
| 38 | 45 class TraceEventCastBenckmark(_BaseCastBenchmark): |
| 39 class TraceEventCaseBenckmark(_BaseCastBenchmark): | |
| 40 | 46 |
| 41 def CreateTimelineBasedMeasurementOptions(self): | 47 def CreateTimelineBasedMeasurementOptions(self): |
| 42 media_router_category = 'media_router' | 48 media_router_category = 'media_router' |
| 43 category_filter = tracing_category_filter.TracingCategoryFilter( | 49 category_filter = tracing_category_filter.TracingCategoryFilter( |
| 44 media_router_category) | 50 media_router_category) |
| 45 category_filter.AddIncludedCategory('blink.console') | 51 category_filter.AddIncludedCategory('blink.console') |
| 46 options = timeline_based_measurement.Options(category_filter) | 52 options = timeline_based_measurement.Options(category_filter) |
| 47 options.SetLegacyTimelineBasedMetrics([ | 53 options.SetLegacyTimelineBasedMetrics([ |
| 48 media_router_timeline_metric.MediaRouterMetric()]) | 54 media_router_timeline_metric.MediaRouterMetric()]) |
| 49 return options | 55 return options |
| 50 | 56 |
| 51 @classmethod | 57 @classmethod |
| 52 def Name(cls): | 58 def Name(cls): |
| 53 return 'media_router.dialog.latency.tracing' | 59 return 'media_router.dialog.latency.tracing' |
| 54 | 60 |
| 61 @classmethod | |
| 62 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
| 63 """Only drops the first result.""" | |
| 64 return not is_first_result | |
| 55 | 65 |
| 56 class HistogramCaseBenckmark(_BaseCastBenchmark): | 66 |
| 67 class HistogramCastBenckmark(_BaseCastBenchmark): | |
| 57 | 68 |
| 58 def CreatePageTest(self, options): | 69 def CreatePageTest(self, options): |
| 59 return media_router_measurements.MediaRouterPageTest() | 70 return media_router_measurements.MediaRouterDialogTest() |
| 60 | 71 |
| 61 @classmethod | 72 @classmethod |
| 62 def Name(cls): | 73 def Name(cls): |
| 63 return 'media_router.dialog.latency.histogram' | 74 return 'media_router.dialog.latency.histogram' |
| 64 | 75 |
| 76 @classmethod | |
| 77 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
| 78 """Only drops the first result.""" | |
| 79 return not is_first_result | |
| 65 | 80 |
| 81 | |
| 82 class CPUMemoryCastBenckmark(_BaseCastBenchmark): | |
| 83 options = {'page_repeat': 1} | |
| 84 | |
| 85 page_set = media_router_perf_pages.MediaRouterCPUMemoryPageSet | |
| 86 | |
| 87 def CreatePageTest(self, options): | |
| 88 return media_router_measurements.MediaRouterCPUMemoryTest() | |
| 89 | |
| 90 @classmethod | |
| 91 def Name(cls): | |
| 92 return 'media_router.cpu_memory' | |
| OLD | NEW |