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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/media/media-source/mediasource-timestamp-offset.html
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-timestamp-offset.html b/LayoutTests/http/tests/media/media-source/mediasource-timestamp-offset.html
new file mode 100644
index 0000000000000000000000000000000000000000..7a52c62134d68ffaf5b7e3226ffc678c4791a299
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-source/mediasource-timestamp-offset.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="/w3c/resources/testharness.js"></script>
+ <script src="/w3c/resources/testharnessreport.js"></script>
+ <script src="mediasource-util.js"></script>
+ <link rel='stylesheet' href='/w3c/resources/testharness.css'>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ function simpleTimestampOffsetTest(value, expected, description)
+ {
+ mediasource_test(function(test, mediaElement, mediaSource)
+ {
+ var segmentInfo = MediaSourceUtil.SEGMENT_INFO;
+ var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.type);
+
+ if (expected == 'TypeMismatchError') {
+ assert_throws('TypeMismatchError',
+ function() { sourceBuffer.timestampOffset = value; },
+ 'setting timestampOffset to ' + description + ' throws an exception.');
+ } else {
+ sourceBuffer.timestampOffset = value;
+ assert_equals(sourceBuffer.timestampOffset, expected);
+ }
+
+ test.done();
+ }, 'Test setting SourceBuffer.timestampOffset to ' + description + '.');
+ }
+
+ simpleTimestampOffsetTest(10.5, 10.5, 'a positive number');
+ simpleTimestampOffsetTest(-10.4, -10.4, 'a negative number');
+ simpleTimestampOffsetTest(0, 0, 'zero');
+ simpleTimestampOffsetTest(Number.POSITIVE_INFINITY, 'TypeMismatchError', 'positive infinity');
+ simpleTimestampOffsetTest(Number.NEGATIVE_INFINITY, 'TypeMismatchError', 'negative infinity');
+ simpleTimestampOffsetTest(Number.NaN, 'TypeMismatchError', 'NaN');
+ simpleTimestampOffsetTest(undefined, 'TypeMismatchError', 'undefined');
+ simpleTimestampOffsetTest(null, 0, 'null');
+ simpleTimestampOffsetTest(false, 0, 'false');
+ simpleTimestampOffsetTest(true, 1, 'true');
+ simpleTimestampOffsetTest('10.5', 10.5, 'a number string');
+ simpleTimestampOffsetTest('', 0, 'an empty string');
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698