Chromium Code Reviews| Index: tracing/tracing/metrics/webrtc/webrtc_rendering_timeline_test.html |
| diff --git a/tracing/tracing/metrics/webrtc/webrtc_rendering_timeline_test.html b/tracing/tracing/metrics/webrtc/webrtc_rendering_timeline_test.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..88a04c76f40e5e56b823845334390be8171d8835 |
| --- /dev/null |
| +++ b/tracing/tracing/metrics/webrtc/webrtc_rendering_timeline_test.html |
| @@ -0,0 +1,264 @@ |
| +<!DOCTYPE html> |
|
ehmaldonado_chromium
2017/02/22 16:45:45
Please ignore for now.
|
| +<!-- |
| +Copyright 2016 The Chromium Authors. All rights reserved. |
| +Use of this source code is governed by a BSD-style license that can be |
| +found in the LICENSE file. |
| +--> |
| + |
| +<link rel="import" href="/tracing/core/test_utils.html"> |
| +<link rel="import" href="/tracing/metrics/v8/runtime_stats_metric.html"> |
| +<link rel="import" href="/tracing/value/histogram.html"> |
| +<link rel="import" href="/tracing/value/histogram_set.html"> |
| + |
| +<script> |
| +'use strict'; |
| + |
| +tr.b.unittest.testSuite(function() { |
| + const WEB_MEDIA_PLAYER_MS_EVENT = 'WebMediaPlayerMS::UpdateCurrentFrame'; |
|
benjhayden
2017/02/22 21:38:53
You can export these constants from the metric.
|
| + const IDEAL_RENDER_INSTANT = 'Ideal Render Instant'; |
| + const ACTUAL_RENDER_BEGIN = 'Actual Render Begin'; |
| + const ACTUAL_RENDER_END = 'Actual Render End'; |
| + const SERIAL = 'Serial'; |
| + |
| + const FAKE_EVENTS = [ |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780195583, |
| + ACTUAL_RENDER_END: 1663780212249, |
| + IDEAL_RENDER_INSTANT: 1663780179998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780212249, |
| + ACTUAL_RENDER_END: 1663780228915, |
| + IDEAL_RENDER_INSTANT: 1663780179998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780228915, |
| + ACTUAL_RENDER_END: 1663780245581, |
| + IDEAL_RENDER_INSTANT: 1663780197998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780245581, |
| + ACTUAL_RENDER_END: 1663780262247, |
| + IDEAL_RENDER_INSTANT: 1663780215998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780262247, |
| + ACTUAL_RENDER_END: 1663780278913, |
| + IDEAL_RENDER_INSTANT: 1663780215998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780278913, |
| + ACTUAL_RENDER_END: 1663780295579, |
| + IDEAL_RENDER_INSTANT: 1663780254998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780295579, |
| + ACTUAL_RENDER_END: 1663780312245, |
| + IDEAL_RENDER_INSTANT: 1663780254998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780312245, |
| + ACTUAL_RENDER_END: 1663780328911, |
| + IDEAL_RENDER_INSTANT: 1663780254998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780328911, |
| + ACTUAL_RENDER_END: 1663780345577, |
| + IDEAL_RENDER_INSTANT: 1663780310998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780345577, |
| + ACTUAL_RENDER_END: 1663780362243, |
| + IDEAL_RENDER_INSTANT: 1663780310998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780362243, |
| + ACTUAL_RENDER_END: 1663780378909, |
| + IDEAL_RENDER_INSTANT: 1663780310998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780378909, |
| + ACTUAL_RENDER_END: 1663780395575, |
| + IDEAL_RENDER_INSTANT: 1663780361998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780395575, |
| + ACTUAL_RENDER_END: 1663780412241, |
| + IDEAL_RENDER_INSTANT: 1663780361998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780412241, |
| + ACTUAL_RENDER_END: 1663780428907, |
| + IDEAL_RENDER_INSTANT: 1663780361998, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780428907, |
| + ACTUAL_RENDER_END: 1663780445573, |
| + IDEAL_RENDER_INSTANT: 1663780412998, |
| + SERIAL: 0, |
| + }, |
| + } |
| + ]; |
| + |
| + const CORRUPT_EVENTS = [ |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780195583, |
| + ACTUAL_RENDER_END: 1663780212249, |
| + IDEAL_RENDER_INSTANT: 0, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780212249, |
| + ACTUAL_RENDER_END: 1663780228915, |
| + IDEAL_RENDER_INSTANT: 0, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780228915, |
| + ACTUAL_RENDER_END: 1663780245581, |
| + IDEAL_RENDER_INSTANT: 0, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + { |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 1663780245581, |
| + ACTUAL_RENDER_END: 1663780262247, |
| + IDEAL_RENDER_INSTANT: 0, |
| + SERIAL: 0, |
| + }, |
| + }, |
| + ]; |
| + |
| + test('testIsValidEvent', function() { |
| + // Valid event |
| + assert(isValidEvent({ |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + IDEAL_RENDER_INSTANT: 0, |
| + ACTUAL_RENDER_BEGIN: 0, |
| + ACTUAL_RENDER_END: 0, |
| + SERIAL: 0, |
| + } |
| + })); |
| + // Not a WebMediaPlayerMS event. |
| + assert(!isValidEvent({ |
| + title: 'Not a valid event', |
| + args: { |
| + IDEAL_RENDER_INSTANT: 0, |
| + ACTUAL_RENDER_BEGIN: 0, |
| + ACTUAL_RENDER_END: 0, |
| + SERIAL: 0, |
| + } |
| + })); |
| + // Missing ideal render instant |
| + assert(!isValidEvent({ |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 0, |
| + ACTUAL_RENDER_END: 0, |
| + SERIAL: 0, |
| + } |
| + })); |
| + // Missing actual render begin |
| + assert(!isValidEvent({ |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + IDEAL_RENDER_INSTANT: 0, |
| + ACTUAL_RENDER_END: 0, |
| + SERIAL: 0, |
| + } |
| + })); |
| + // Missing actual render end. |
| + assert(!isValidEvent({ |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + IDEAL_RENDER_INSTANT: 0, |
| + ACTUAL_RENDER_BEGIN: 0, |
| + SERIAL: 0, |
| + } |
| + })); |
| + // Missing serial. |
| + assert(!isValidEvent({ |
| + title: WEB_MEDIA_PLAYER_MS_EVENT, |
| + args: { |
| + ACTUAL_RENDER_BEGIN: 0, |
| + ACTUAL_RENDER_BEGIN: 0, |
| + ACTUAL_RENDER_END: 0, |
| + } |
| + })); |
| + }); |
| + |
| + test('getCadence', function() { |
| + const expectedCadence = [2, 1, 2, 3, 3, 3, 1]; |
| + // IGNORE |
| + }); |
| +}); |
| +</script> |