Chromium Code Reviews| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 assert_equals(mediaSource.readyState, 'open', 'MediaSource rea dyState is \'open\''); | 72 assert_equals(mediaSource.readyState, 'open', 'MediaSource rea dyState is \'open\''); |
| 73 }); | 73 }); |
| 74 | 74 |
| 75 test.waitForExpectedEvents(function() | 75 test.waitForExpectedEvents(function() |
| 76 { | 76 { |
| 77 assert_equals(mediaSource.readyState, 'open', 'MediaSource rea dyState is \'open\''); | 77 assert_equals(mediaSource.readyState, 'open', 'MediaSource rea dyState is \'open\''); |
| 78 test.done(); | 78 test.done(); |
| 79 }); | 79 }); |
| 80 }, 'Test setting SourceBuffer.mode triggers parent MediaSource \'ended \' to \'open\' transition.'); | 80 }, 'Test setting SourceBuffer.mode triggers parent MediaSource \'ended \' to \'open\' transition.'); |
| 81 | 81 |
| 82 // FIXME: Once enough Chromium implementation lands, add tests for at least confirming exception if append | 82 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) |
| 83 // state is PARSING_MEDIA_SEGMENT (per 3.1 setting mode steps 6-7). Se e http://crbug.com/249422. | 83 { |
| 84 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, se gmentInfo.init); | |
| 85 var fullMediaSegment = MediaSourceUtil.extractSegmentData(mediaDat a, segmentInfo.media[0]); | |
| 86 var truncateAt = Math.floor(segmentInfo.media[0].size * 0.95); // e.g. first 11238 bytes of 11830 | |
|
acolwell GONE FROM CHROMIUM
2014/01/14 18:20:27
nit: Change the comment to something like 95% of t
wolenetz
2014/01/14 19:30:44
Done.
| |
| 87 var partialMediaSegment = fullMediaSegment.subarray(0, truncateAt) ; | |
| 88 var mediaSegmentRemainder = fullMediaSegment.subarray(truncateAt); | |
| 89 | |
| 90 // Append init segment. | |
| 91 test.expectEvent(sourceBuffer, 'updateend', 'Init segment append e nded.'); | |
| 92 sourceBuffer.appendBuffer(initSegment); | |
| 93 | |
| 94 test.waitForExpectedEvents(function() | |
| 95 { | |
| 96 assert_false(sourceBuffer.updating, 'updating attribute is fal se'); | |
| 97 assert_true(sourceBuffer.mode == 'segments'); | |
|
acolwell GONE FROM CHROMIUM
2014/01/14 18:20:27
nit: use assert_equals here and in similar checks
wolenetz
2014/01/14 19:30:44
Done.
| |
| 98 sourceBuffer.mode = 'segments'; // No exception should occur. | |
| 99 | |
| 100 // Append first part of media segment. | |
| 101 test.expectEvent(sourceBuffer, 'updateend', 'Partial media seg ment append ended.'); | |
| 102 sourceBuffer.appendBuffer(partialMediaSegment); | |
| 103 }); | |
| 104 | |
| 105 test.waitForExpectedEvents(function() | |
| 106 { | |
| 107 assert_false(sourceBuffer.updating, 'updating attribute is fal se'); | |
| 108 assert_true(sourceBuffer.mode == 'segments'); | |
| 109 assert_throws('InvalidStateError', | |
| 110 function() { sourceBuffer.mode = 'segments'; }, | |
| 111 'Setting valid sourceBuffer.mode while still parsing media segment threw InvalidStateError.'); | |
| 112 test.done(); | |
|
acolwell GONE FROM CHROMIUM
2014/01/14 18:20:27
nit: remove since it doesn't appear the test is ac
wolenetz
2014/01/14 19:30:44
Oh wow! This was a test debugging item I forgot to
| |
| 113 | |
| 114 // Append remainder of media segment. | |
| 115 test.expectEvent(sourceBuffer, 'updateend', 'Append ended of r emainder of media segment.'); | |
| 116 sourceBuffer.appendBuffer(mediaSegmentRemainder); | |
| 117 }); | |
| 118 | |
| 119 test.waitForExpectedEvents(function() | |
| 120 { | |
| 121 assert_false(sourceBuffer.updating, 'updating attribute is fal se'); | |
| 122 assert_true(sourceBuffer.mode == 'segments'); | |
| 123 sourceBuffer.mode = 'segments'; // No exception should occur. | |
| 124 test.done(); | |
| 125 }); | |
| 126 }, 'Test setting SourceBuffer.mode while parsing media segment.'); | |
| 127 | |
| 128 // FIXME: Once 'sequence' mode implemented, add verification. See http ://crbug.com/249422. | |
| 84 </script> | 129 </script> |
| 85 </body> | 130 </body> |
| 86 </html> | 131 </html> |
| OLD | NEW |