| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="/w3c/resources/testharness.js"></script> | 4 <script src="/w3c/resources/testharness.js"></script> |
| 5 <script src="/w3c/resources/testharnessreport.js"></script> | 5 <script src="/w3c/resources/testharnessreport.js"></script> |
| 6 <script src="mediasource-util.js"></script> | 6 <script src="mediasource-util.js"></script> |
| 7 <script src="/media/resources/media-source/webm/segment-info.js"></scrip
t> | 7 <script src="/media/resources/media-source/webm/segment-info.js"></scrip
t> |
| 8 | 8 |
| 9 <link rel='stylesheet' href='/w3c/resources/testharness.css'> | 9 <link rel='stylesheet' href='/w3c/resources/testharness.css'> |
| 10 </head> | 10 </head> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Append init segment. | 95 // Append init segment. |
| 96 test.expectEvent(sourceBuffer, 'updateend', 'Init segment append e
nded.'); | 96 test.expectEvent(sourceBuffer, 'updateend', 'Init segment append e
nded.'); |
| 97 sourceBuffer.appendBuffer(initSegment); | 97 sourceBuffer.appendBuffer(initSegment); |
| 98 | 98 |
| 99 test.waitForExpectedEvents(function() | 99 test.waitForExpectedEvents(function() |
| 100 { | 100 { |
| 101 assert_false(sourceBuffer.updating, 'updating attribute is fal
se'); | 101 assert_false(sourceBuffer.updating, 'updating attribute is fal
se'); |
| 102 assert_equals(sourceBuffer.mode, 'segments'); | 102 assert_equals(sourceBuffer.mode, 'segments'); |
| 103 sourceBuffer.mode = 'segments'; // No exception should occur. | 103 sourceBuffer.mode = 'segments'; // No exception should occur. |
| 104 assert_equals(sourceBuffer.timestampOffset, 0.0); | 104 assert_equals(sourceBuffer.timestampOffset, 0.0); |
| 105 sourceBuffer.timestampOffset = 10.0; // No exception should o
ccur. | 105 sourceBuffer.timestampOffset = 10.123456789; // No exception
should occur. |
| 106 assert_equals(sourceBuffer.timestampOffset, 10.123456789); //
Super-precise offsets should round-trip. |
| 106 | 107 |
| 107 // Append first part of media segment. | 108 // Append first part of media segment. |
| 108 test.expectEvent(sourceBuffer, 'updateend', 'Partial media seg
ment append ended.'); | 109 test.expectEvent(sourceBuffer, 'updateend', 'Partial media seg
ment append ended.'); |
| 109 sourceBuffer.appendBuffer(partialMediaSegment); | 110 sourceBuffer.appendBuffer(partialMediaSegment); |
| 110 }); | 111 }); |
| 111 | 112 |
| 112 test.waitForExpectedEvents(function() | 113 test.waitForExpectedEvents(function() |
| 113 { | 114 { |
| 114 assert_false(sourceBuffer.updating, 'updating attribute is fal
se'); | 115 assert_false(sourceBuffer.updating, 'updating attribute is fal
se'); |
| 115 assert_equals(sourceBuffer.mode, 'segments'); | 116 assert_equals(sourceBuffer.mode, 'segments'); |
| 116 assert_throws('InvalidStateError', | 117 assert_throws('InvalidStateError', |
| 117 function() { sourceBuffer.mode = 'segments'; }, | 118 function() { sourceBuffer.mode = 'segments'; }, |
| 118 'Setting valid sourceBuffer.mode while still parsing media
segment threw InvalidStateError.'); | 119 'Setting valid sourceBuffer.mode while still parsing media
segment threw InvalidStateError.'); |
| 119 assert_equals(sourceBuffer.timestampOffset, 10.0); | 120 assert_equals(sourceBuffer.timestampOffset, 10.123456789); |
| 120 assert_throws('InvalidStateError', | 121 assert_throws('InvalidStateError', |
| 121 function() { sourceBuffer.timestampOffset = 20.0; }, | 122 function() { sourceBuffer.timestampOffset = 20.0; }, |
| 122 'Setting valid sourceBuffer.timestampOffset while still pa
rsing media segment threw InvalidStateError.'); | 123 'Setting valid sourceBuffer.timestampOffset while still pa
rsing media segment threw InvalidStateError.'); |
| 123 | 124 |
| 124 // Append remainder of media segment. | 125 // Append remainder of media segment. |
| 125 test.expectEvent(sourceBuffer, 'updateend', 'Append ended of r
emainder of media segment.'); | 126 test.expectEvent(sourceBuffer, 'updateend', 'Append ended of r
emainder of media segment.'); |
| 126 sourceBuffer.appendBuffer(mediaSegmentRemainder); | 127 sourceBuffer.appendBuffer(mediaSegmentRemainder); |
| 127 }); | 128 }); |
| 128 | 129 |
| 129 test.waitForExpectedEvents(function() | 130 test.waitForExpectedEvents(function() |
| 130 { | 131 { |
| 131 assert_false(sourceBuffer.updating, 'updating attribute is fal
se'); | 132 assert_false(sourceBuffer.updating, 'updating attribute is fal
se'); |
| 132 assert_equals(sourceBuffer.mode, 'segments'); | 133 assert_equals(sourceBuffer.mode, 'segments'); |
| 133 sourceBuffer.mode = 'segments'; // No exception should occur. | 134 sourceBuffer.mode = 'segments'; // No exception should occur. |
| 134 assert_equals(sourceBuffer.timestampOffset, 10.0); | 135 assert_equals(sourceBuffer.timestampOffset, 10.123456789); |
| 135 sourceBuffer.timestampOffset = 20.0; // No exception should o
ccur. | 136 sourceBuffer.timestampOffset = 20.0; // No exception should o
ccur. |
| 136 test.done(); | 137 test.done(); |
| 137 }); | 138 }); |
| 138 }, 'Test setting SourceBuffer.mode and SourceBuffer.timestampOffset wh
ile parsing media segment.'); | 139 }, 'Test setting SourceBuffer.mode and SourceBuffer.timestampOffset wh
ile parsing media segment.'); |
| 139 | 140 |
| 140 // FIXME: Once 'sequence' mode implemented, add verification. See http
://crbug.com/249422. | 141 // FIXME: Once 'sequence' mode implemented, add verification. See http
://crbug.com/249422. |
| 141 </script> | 142 </script> |
| 142 </body> | 143 </body> |
| 143 </html> | 144 </html> |
| OLD | NEW |