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

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: 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..31992308bd977194d742c082fb0992915e293635
--- /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") {
wolenetz 2014/03/17 20:11:39 nit: prefer ' instead of " in js; here and below.
acolwell GONE FROM CHROMIUM 2014/03/17 20:28:27 Done.
+ assert_throws("TypeMismatchError",
+ function() { sourceBuffer.timestampOffset = value; },
wolenetz 2014/03/17 20:11:39 nit: indentation
acolwell GONE FROM CHROMIUM 2014/03/17 20:28:27 Done.
+ "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>
« no previous file with comments | « no previous file | Source/modules/mediasource/SourceBuffer.cpp » ('j') | Source/modules/mediasource/SourceBuffer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698