Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <!-- | |
| 3 Copyright 2016 The Chromium Authors. All rights reserved. | |
| 4 Use of this source code is governed by a BSD-style license that can be | |
| 5 found in the LICENSE file. | |
| 6 --> | |
| 7 | |
| 8 <link rel="import" href="/tracing/core/test_utils.html"> | |
| 9 <link rel="import" href="/tracing/extras/importer/trace_event_importer.html"> | |
| 10 <link rel="import" href="/tracing/metrics/webrtc/webrtc_rendering_metric.html"> | |
| 11 <link rel="import" href="/tracing/model/slice_group.html"> | |
| 12 <link rel="import" href="/tracing/value/histogram.html"> | |
| 13 <link rel="import" href="/tracing/value/histogram_set.html"> | |
| 14 | |
| 15 <script> | |
| 16 'use strict'; | |
| 17 | |
| 18 tr.b.unittest.testSuite(function() { | |
| 19 const FAKE_EVENTS = [ | |
| 20 [1663780195583, 1663780212249], | |
| 21 [1663780212249, 1663780228915], | |
| 22 [1663780228915, 1663780245581], | |
| 23 [1663780245581, 1663780262247], | |
| 24 [1663780262247, 1663780278913], | |
| 25 [1663780278913, 1663780295579], | |
| 26 [1663780295579, 1663780312245], | |
| 27 [1663780312245, 1663780328911], | |
| 28 [1663780328911, 1663780345577], | |
| 29 [1663780345577, 1663780362243], | |
| 30 [1663780362243, 1663780378909], | |
| 31 [1663780378909, 1663780395575], | |
| 32 [1663780395575, 1663780412241], | |
| 33 [1663780412241, 1663780428907], | |
| 34 [1663780428907, 1663780445573], | |
| 35 ].map(eventFromPair); | |
| 36 | |
| 37 function eventFromPair(pair) { | |
| 38 return { | |
| 39 title: 'WebMediaPlayerMS::UpdateCurrentFrame', | |
| 40 args: { | |
| 41 'Ideal Render Instant': pair[0], | |
| 42 'Actual Render Begin': pair[1], | |
| 43 'Actual Render End': 0, | |
| 44 'Serial': 0, | |
| 45 } | |
| 46 }; | |
| 47 } | |
| 48 | |
| 49 function runWebrtcRenderingMetric() { | |
| 50 let values = new tr.v.HistogramSet(); | |
| 51 let model = tr.c.TestUtils.newModelWithEvents([FAKE_EVENTS]); | |
|
ehmaldonado_chromium
2017/02/24 19:09:48
When I try to test this, I get this error. Am I do
benjhayden
2017/02/24 22:43:37
This works for me:
let model = tr.c.TestUtils.
ehmaldonado_chromium
2017/02/24 23:06:17
After fixing those errors, it doesn't seem to be p
benjhayden
2017/02/24 23:44:40
It would be best if the test used a real Model in
ehmaldonado_chromium
2017/02/24 23:54:33
Yes, of course. This is just for testing while I g
| |
| 52 tr.metrics.webrtc.webrtcRenderingMetric(values, model); | |
| 53 return values; | |
| 54 } | |
| 55 | |
| 56 test('driftTime', function() { | |
| 57 const expectedDriftTime = [15585, 30917, 29583, 23915, 17913, 16911, 15909]; | |
| 58 let values = runWebrtcRenderingMetric(); | |
| 59 let driftTime = values.getHistogramNamed('WebRTCRendering_drift_time'); | |
| 60 assert.closeTo(driftTime.running.sum, | |
| 61 tr.b.Statistics.sum(expectedDriftTime)); | |
| 62 assert.closeTo(driftTime.average, tr.b.Statistics.mean(expectedDriftTime)); | |
| 63 assert.closeTo(driftTime.variance, | |
| 64 tr.b.Statistics.variance(expectedDriftTime)); | |
| 65 }); | |
| 66 | |
| 67 test('percentBadlyOutOfSync', function() { | |
| 68 let values = runWebrtcRenderingMetric(); | |
| 69 let prcentBadlyOutOfSync = | |
| 70 values.getHistogramNamed('WebRTCRendering_percent_badly_out_of_sync'); | |
| 71 }); | |
| 72 }); | |
| 73 </script> | |
| OLD | NEW |