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> |