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 |
|
mark a. foltz
2016/04/18 23:48:11
typo in MediaRouterDialogPageSet
Lei Lei
2016/04/19 21:56:02
Done.
| |
| 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 to enable the communication between the page and | |
| 25 # the test extension. | |
| 26 options.disable_background_networking = False | |
| 27 | |
| 24 # TODO: find a better way to find extension location. | 28 # TODO: find a better way to find extension location. |
| 25 options.AppendExtraBrowserArgs([ | 29 options.AppendExtraBrowserArgs([ |
| 26 '--load-extension=' + os.path.join(path_util.GetChromiumSrcDir(), 'out', | 30 '--load-extension=' + ','.join([ |
| 27 'Release', 'mr_extension', 'release'), | 31 os.path.join(path_util.GetChromiumSrcDir(), 'out', |
| 32 'Release', 'mr_extension', 'release'), | |
| 33 os.path.join(path_util.GetChromiumSrcDir(), 'out', | |
| 34 'Release', 'media_router', 'test_extension')]), | |
| 28 '--whitelisted-extension-id=enhhojjnijigcajfphajepfemndkmdlo', | 35 '--whitelisted-extension-id=enhhojjnijigcajfphajepfemndkmdlo', |
| 29 '--media-router=1', | 36 '--media-router=1', |
| 30 '--enable-stats-collection-bindings' | 37 '--enable-stats-collection-bindings' |
| 31 ]) | 38 ]) |
| 32 | 39 |
| 33 @classmethod | |
| 34 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
| 35 """Only drops the first result.""" | |
| 36 return not is_first_result | |
| 37 | 40 |
| 38 | 41 class TraceEventCastBenckmark(_BaseCastBenchmark): |
| 39 class TraceEventCaseBenckmark(_BaseCastBenchmark): | |
| 40 | 42 |
| 41 def CreateTimelineBasedMeasurementOptions(self): | 43 def CreateTimelineBasedMeasurementOptions(self): |
| 42 media_router_category = 'media_router' | 44 media_router_category = 'media_router' |
| 43 category_filter = tracing_category_filter.TracingCategoryFilter( | 45 category_filter = tracing_category_filter.TracingCategoryFilter( |
| 44 media_router_category) | 46 media_router_category) |
| 45 category_filter.AddIncludedCategory('blink.console') | 47 category_filter.AddIncludedCategory('blink.console') |
| 46 options = timeline_based_measurement.Options(category_filter) | 48 options = timeline_based_measurement.Options(category_filter) |
| 47 options.SetLegacyTimelineBasedMetrics([ | 49 options.SetLegacyTimelineBasedMetrics([ |
| 48 media_router_timeline_metric.MediaRouterMetric()]) | 50 media_router_timeline_metric.MediaRouterMetric()]) |
| 49 return options | 51 return options |
| 50 | 52 |
| 51 @classmethod | 53 @classmethod |
| 52 def Name(cls): | 54 def Name(cls): |
| 53 return 'media_router.dialog.latency.tracing' | 55 return 'media_router.dialog.latency.tracing' |
| 54 | 56 |
| 57 @classmethod | |
| 58 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
| 59 """Only drops the first result.""" | |
| 60 return not is_first_result | |
| 55 | 61 |
| 56 class HistogramCaseBenckmark(_BaseCastBenchmark): | 62 |
| 63 class HistogramCastBenckmark(_BaseCastBenchmark): | |
| 57 | 64 |
| 58 def CreatePageTest(self, options): | 65 def CreatePageTest(self, options): |
| 59 return media_router_measurements.MediaRouterPageTest() | 66 return media_router_measurements.MediaRouterDialogTest() |
| 60 | 67 |
| 61 @classmethod | 68 @classmethod |
| 62 def Name(cls): | 69 def Name(cls): |
| 63 return 'media_router.dialog.latency.histogram' | 70 return 'media_router.dialog.latency.histogram' |
| 64 | 71 |
| 72 @classmethod | |
| 73 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
| 74 """Only drops the first result.""" | |
| 75 return not is_first_result | |
| 65 | 76 |
| 77 | |
| 78 class CPUMemoryCastBenckmark(_BaseCastBenchmark): | |
| 79 options = {'page_repeat': 1} | |
| 80 | |
| 81 page_set = media_router_perf_pages.MediaRouterCPUMemoryPageSet | |
| 82 | |
| 83 def CreatePageTest(self, options): | |
| 84 return media_router_measurements.MediaRouterCPUMemoryTest() | |
| 85 | |
| 86 @classmethod | |
| 87 def Name(cls): | |
| 88 return 'media_router.cpu_memory' | |
| OLD | NEW |