Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: tools/perf/metrics/webrtc_stats_unittest.py

Issue 2522183002: Add encode time to WebRTC telemetry tests, remove some noisy metrics. (Closed)
Patch Set: Fixed unit test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/perf/metrics/webrtc_stats.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 unittest 5 import unittest
6 6
7 from telemetry.testing import simple_mock 7 from telemetry.testing import simple_mock
8 8
9 from metrics import webrtc_stats 9 from metrics import webrtc_stats
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 page.url = simple_mock.MockObject() 122 page.url = simple_mock.MockObject()
123 results = FakeResults(page) 123 results = FakeResults(page)
124 stats_metric.AddResults(tab, results) 124 stats_metric.AddResults(tab, results)
125 return results 125 return results
126 126
127 def testExtractsValuesAsTimeSeries(self): 127 def testExtractsValuesAsTimeSeries(self):
128 results = self._RunMetricOnJson(SAMPLE_JSON) 128 results = self._RunMetricOnJson(SAMPLE_JSON)
129 129
130 self.assertTrue(results.received_values, 130 self.assertTrue(results.received_values,
131 'Expected values for googDecodeMs and others, got none.') 131 'Expected values for googDecodeMs and others, got none.')
132 132 self.assertEqual(results.received_values[1].name,
133 # This also ensures we're clever enough to tell video packetsSent from audio 133 'peer_connection_0_audio_goog_rtt')
134 # packetsSent. 134 self.assertEqual(results.received_values[1].values,
135 self.assertEqual(results.received_values[3].values, 135 [20.0, 17.0])
136 [4.0, 16.0]) 136 self.assertEqual(results.received_values[7].name,
137 self.assertEqual(results.received_values[5].values, 137 'peer_connection_1_video_goog_rtt')
138 [1.0, 8.0]) 138 self.assertEqual(results.received_values[7].values,
139 [100.0, 101.0])
139 140
140 def testExtractsInterestingMetricsOnly(self): 141 def testExtractsInterestingMetricsOnly(self):
141 results = self._RunMetricOnJson(SAMPLE_JSON) 142 results = self._RunMetricOnJson(SAMPLE_JSON)
142 143
143 self.assertTrue(len(results.received_values) > 0) 144 self.assertTrue(len(results.received_values) > 0)
144 self.assertIn('peer_connection_0', results.received_values[0].name, 145 self.assertIn('peer_connection_0', results.received_values[0].name,
145 'The result should be a ListOfScalarValues instance with ' 146 'The result should be a ListOfScalarValues instance with '
146 'a name <peer connection id>_<statistic>.') 147 'a name <peer connection id>_<statistic>.')
147 all_names = [value.name for value in results.received_values] 148 all_names = [value.name for value in results.received_values]
148 self.assertIn('peer_connection_0_video_packets_sent', all_names) 149 self.assertIn('peer_connection_0_audio_goog_rtt', all_names)
149 self.assertNotIn('peer_connection_1_video_packets_sent', all_names, 150 self.assertNotIn('peer_connection_1_audio_goog_rtt', all_names,
150 'Peer connection 1 does not have a video packets sent in ' 151 'Peer connection 1 does not have a goog-rtt in '
151 'the JSON above, unlike peer connection 0 which does.') 152 'the JSON above, unlike peer connection 0 which does.')
152 self.assertIn('peer_connection_0_video_goog_rtt', all_names) 153 self.assertIn('peer_connection_0_video_goog_rtt', all_names)
153 self.assertIn('peer_connection_1_video_goog_rtt', all_names) 154 self.assertIn('peer_connection_1_video_goog_rtt', all_names)
154 # The audio_audio is intentional since the code distinguishes audio reports 155 # The audio_audio is intentional since the code distinguishes audio reports
155 # from video reports (even though audio_input_level is quite obvious). 156 # from video reports (even though audio_input_level is quite obvious).
156 self.assertNotIn('peer_connection_0_audio_audio_input_level', all_names, 157 self.assertNotIn('peer_connection_0_audio_audio_input_level', all_names,
157 'Input level is in the JSON for both connections but ' 158 'Input level is in the JSON for both connections but '
158 'should not be reported since it is not interesting.') 159 'should not be reported since it is not interesting.')
159 self.assertNotIn('peer_connection_1_audio_audio_input_level', all_names) 160 self.assertNotIn('peer_connection_1_audio_audio_input_level', all_names)
160 161
161 def testReturnsIfJsonIsEmpty(self): 162 def testReturnsIfJsonIsEmpty(self):
162 results = self._RunMetricOnJson('[]') 163 results = self._RunMetricOnJson('[]')
163 self.assertFalse(results.received_values) 164 self.assertFalse(results.received_values)
OLDNEW
« no previous file with comments | « tools/perf/metrics/webrtc_stats.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698