diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/media-source/mediasource-duration-boundaryconditions.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/media-source/mediasource-duration-boundaryconditions.html')
-rw-r--r-- | testing/web-platform/tests/media-source/mediasource-duration-boundaryconditions.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/testing/web-platform/tests/media-source/mediasource-duration-boundaryconditions.html b/testing/web-platform/tests/media-source/mediasource-duration-boundaryconditions.html new file mode 100644 index 000000000..b95e495cb --- /dev/null +++ b/testing/web-platform/tests/media-source/mediasource-duration-boundaryconditions.html @@ -0,0 +1,63 @@ +<!DOCTYPE html> +<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). --> +<html> + <head> + <title>MediaSource.duration boundary condition test cases.</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="mediasource-util.js"></script> + </head> + <body> + <div id="log"></div> + <script> + function DurationBoundaryConditionTest(testDurationValue, expectedError, description) + { + return mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) + { + // Append initialization segment. + test.expectEvent(sourceBuffer, "updateend", "sourceBuffer"); + test.expectEvent(mediaElement, "loadedmetadata", "mediaElement"); + sourceBuffer.appendBuffer(MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init)); + test.waitForExpectedEvents(function() + { + if (expectedError) { + assert_throws(expectedError, + function() { mediaSource.duration = testDurationValue; }, + "mediaSource.duration assignment throws an exception for " + testDurationValue); + test.done(); + return; + } + + mediaSource.duration = testDurationValue; + + assert_equals(mediaSource.duration, testDurationValue, "mediaSource.duration"); + assert_equals(mediaElement.duration, testDurationValue, "mediaElement.duration"); + + test.expectEvent(mediaElement, "durationchange", "mediaElement"); + test.waitForExpectedEvents(function() + { + assert_equals(mediaSource.duration, testDurationValue, "mediaSource.duration"); + assert_equals(mediaElement.duration, testDurationValue, "mediaElement.duration"); + test.done(); + }); + }); + + }, description); + } + + DurationBoundaryConditionTest(Math.pow(2, 31) - 1, null, "Set duration to 2^31 - 1"); + DurationBoundaryConditionTest(1, null, "Set duration to 1"); + DurationBoundaryConditionTest(Number.MAX_VALUE, null, "Set duration to Number.MAX_VALUE"); + DurationBoundaryConditionTest(Number.MIN_VALUE, null, "Set duration to Number.MIN_VALUE"); + DurationBoundaryConditionTest(Number.MAX_VALUE - 1, null, "Set duration to Number.MAX_VALUE - 1"); + DurationBoundaryConditionTest(Number.MIN_VALUE - 1, new TypeError(), "Set duration to Number.MIN_VALUE - 1"); + DurationBoundaryConditionTest(Number.POSITIVE_INFINITY, null, "Set duration to Number.POSITIVE_INFINITY"); + DurationBoundaryConditionTest(Number.NEGATIVE_INFINITY, new TypeError(), "Set duration to Number.NEGATIVE_INFINITY"); + DurationBoundaryConditionTest(-1 * Number.MAX_VALUE, new TypeError(), "Set duration to lowest value."); + DurationBoundaryConditionTest(-101.9, new TypeError(), "Set duration to a negative double."); + DurationBoundaryConditionTest(101.9, null, "Set duration to a positive double."); + DurationBoundaryConditionTest(0, null, "Set duration to zero"); + DurationBoundaryConditionTest(NaN, new TypeError(), "Set duration to NaN"); + </script> + </body> +</html> |