Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / media / media-source / mediasource-duration-boundaryconditions.html
blob8dbec0bc07c2f33c0029fac425ca2f901113c8f9
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 DurationBoundaryConditionTest(testDurationValue, expectedError, description)
14 return mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
16 // Append initialization segment.
17 test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
18 test.expectEvent(mediaElement, 'loadedmetadata', 'mediaElement');
19 sourceBuffer.appendBuffer(MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init));
20 test.waitForExpectedEvents(function()
22 if (expectedError) {
23 assert_throws(expectedError,
24 function() { mediaSource.duration = testDurationValue; },
25 "mediaSource.duration assignment throws an exception for " + testDurationValue);
26 test.done();
27 return;
30 mediaSource.duration = testDurationValue;
32 assert_equals(mediaSource.duration, testDurationValue, "mediaSource.duration");
33 assert_equals(mediaElement.duration, testDurationValue, "mediaElement.duration");
35 test.expectEvent(mediaElement, 'durationchange', 'mediaElement');
36 test.waitForExpectedEvents(function()
38 assert_equals(mediaSource.duration, testDurationValue, "mediaSource.duration");
39 assert_equals(mediaElement.duration, testDurationValue, "mediaElement.duration");
40 test.done();
41 });
42 });
44 }, description);
47 DurationBoundaryConditionTest(Math.pow(2, 31) - 1, null, "Set duration to 2^31 - 1");
48 DurationBoundaryConditionTest(1, null, "Set duration to 1");
49 DurationBoundaryConditionTest(Number.MAX_VALUE, null, "Set duration to Number.MAX_VALUE");
50 DurationBoundaryConditionTest(Number.MIN_VALUE, null, "Set duration to Number.MIN_VALUE");
51 DurationBoundaryConditionTest(Number.MAX_VALUE - 1, null, "Set duration to Number.MAX_VALUE - 1");
52 DurationBoundaryConditionTest(Number.MIN_VALUE - 1, "InvalidAccessError", "Set duration to Number.MIN_VALUE - 1");
53 DurationBoundaryConditionTest(Number.POSITIVE_INFINITY, null, "Set duration to Number.POSITIVE_INFINITY");
54 DurationBoundaryConditionTest(Number.NEGATIVE_INFINITY, "InvalidAccessError", "Set duration to Number.NEGATIVE_INFINITY");
55 DurationBoundaryConditionTest(-1 * Number.MAX_VALUE, "InvalidAccessError", "Set duration to lowest value.");
56 DurationBoundaryConditionTest(-101.9, "InvalidAccessError", "Set duration to a negative double.");
57 DurationBoundaryConditionTest(101.9, null, "Set duration to a positive double.");
58 DurationBoundaryConditionTest(0, null, "Set duration to zero");
59 DurationBoundaryConditionTest(NaN, "InvalidAccessError", "Set duration to NaN");
60 </script>
61 </body>
62 </html>