Change next_proto member type.
[chromium-blink-merge.git] / tools / perf / measurements / webrtc.py
blobfeb6f827555b1b3d7e73a228aa92a4c8b13f42c3
1 # Copyright 2014 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.
5 from metrics import cpu
6 from metrics import media
7 from metrics import memory
8 from metrics import power
9 from metrics import webrtc_stats
10 from telemetry.page import page_test
13 class WebRTC(page_test.PageTest):
14 """Gathers WebRTC-related metrics on a page set."""
16 def __init__(self):
17 super(WebRTC, self).__init__('RunPageInteractions')
18 self._cpu_metric = None
19 self._media_metric = None
20 self._memory_metric = None
21 self._power_metric = None
22 self._webrtc_stats_metric = None
24 def WillStartBrowser(self, platform):
25 self._power_metric = power.PowerMetric(platform)
27 def DidStartBrowser(self, browser):
28 self._cpu_metric = cpu.CpuMetric(browser)
29 self._memory_metric = memory.MemoryMetric(browser)
30 self._webrtc_stats_metric = webrtc_stats.WebRtcStatisticsMetric()
32 def DidNavigateToPage(self, page, tab):
33 self._cpu_metric.Start(page, tab)
34 self._media_metric = media.MediaMetric(tab)
35 self._media_metric.Start(page, tab)
36 self._memory_metric.Start(page, tab)
37 self._power_metric.Start(page, tab)
38 self._webrtc_stats_metric.Start(page, tab)
40 def CustomizeBrowserOptions(self, options):
41 memory.MemoryMetric.CustomizeBrowserOptions(options)
42 options.AppendExtraBrowserArgs('--use-fake-device-for-media-stream')
43 options.AppendExtraBrowserArgs('--use-fake-ui-for-media-stream')
44 power.PowerMetric.CustomizeBrowserOptions(options)
46 def ValidateAndMeasurePage(self, page, tab, results):
47 """Measure the page's performance."""
48 self._cpu_metric.Stop(page, tab)
49 self._cpu_metric.AddResults(tab, results)
51 # Add all media metrics except bytes (those aren't hooked up for WebRTC
52 # video tags).
53 exclude_metrics = ['decoded_video_bytes', 'decoded_audio_bytes']
54 self._media_metric.Stop(page, tab)
55 self._media_metric.AddResults(tab, results, exclude_metrics=exclude_metrics)
57 self._memory_metric.Stop(page, tab)
58 self._memory_metric.AddResults(tab, results)
60 self._power_metric.Stop(page, tab)
61 self._power_metric.AddResults(tab, results)
63 self._webrtc_stats_metric.Stop(page, tab)
64 self._webrtc_stats_metric.AddResults(tab, results)