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

Side by Side Diff: LayoutTests/http/tests/media/media-source/mediasource-timestamp-offset.html

Issue 202423002: Fix SourceBuffer.timestampOffset setter behavior for invalid values. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add expectation file since it appears the trybots need it. Created 6 years, 9 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/w3c/resources/testharness.js"></script>
5 <script src="/w3c/resources/testharnessreport.js"></script>
6 <script src="mediasource-util.js"></script>
7 <link rel='stylesheet' href='/w3c/resources/testharness.css'>
8 </head>
9 <body>
10 <div id="log"></div>
11 <script>
12 function simpleTimestampOffsetTest(value, expected, description)
13 {
14 mediasource_test(function(test, mediaElement, mediaSource)
15 {
16 var segmentInfo = MediaSourceUtil.SEGMENT_INFO;
17 var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.typ e);
18
19 if (expected == 'TypeMismatchError') {
20 assert_throws('TypeMismatchError',
21 function() { sourceBuffer.timestampOffset = value; },
22 'setting timestampOffset to ' + description + ' throws an exception.');
23 } else {
24 sourceBuffer.timestampOffset = value;
25 assert_equals(sourceBuffer.timestampOffset, expected);
26 }
27
28 test.done();
29 }, 'Test setting SourceBuffer.timestampOffset to ' + description + '.');
30 }
31
32 simpleTimestampOffsetTest(10.5, 10.5, 'a positive number');
33 simpleTimestampOffsetTest(-10.4, -10.4, 'a negative number');
34 simpleTimestampOffsetTest(0, 0, 'zero');
35 simpleTimestampOffsetTest(Number.POSITIVE_INFINITY, 'TypeMismatchError ', 'positive infinity');
36 simpleTimestampOffsetTest(Number.NEGATIVE_INFINITY, 'TypeMismatchError ', 'negative infinity');
37 simpleTimestampOffsetTest(Number.NaN, 'TypeMismatchError', 'NaN');
38 simpleTimestampOffsetTest(undefined, 'TypeMismatchError', 'undefined') ;
39 simpleTimestampOffsetTest(null, 0, 'null');
40 simpleTimestampOffsetTest(false, 0, 'false');
41 simpleTimestampOffsetTest(true, 1, 'true');
42 simpleTimestampOffsetTest('10.5', 10.5, 'a number string');
43 simpleTimestampOffsetTest('', 0, 'an empty string');
44 </script>
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698