OLD | NEW |
1 // Extract & return the resolution string from a filename, if any. | 1 // Extract & return the resolution string from a filename, if any. |
2 function resolutionFromFilename(filename) | 2 function resolutionFromFilename(filename) |
3 { | 3 { |
4 resolution = filename.replace(/^.*[^0-9]([0-9]+x[0-9]+)[^0-9].*$/, "$1"); | 4 resolution = filename.replace(/^.*[^0-9]([0-9]+x[0-9]+)[^0-9].*$/, "$1"); |
5 if (resolution != filename) { | 5 if (resolution != filename) { |
6 return resolution; | 6 return resolution; |
7 } | 7 } |
8 return ""; | 8 return ""; |
9 } | 9 } |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 { | 57 { |
58 // Add the second buffer starting at 1.5 second. | 58 // Add the second buffer starting at 1.5 second. |
59 sourceBuffer.timestampOffset = 1.5; | 59 sourceBuffer.timestampOffset = 1.5; |
60 appendBuffer(test, sourceBuffer, dataB); | 60 appendBuffer(test, sourceBuffer, dataB); |
61 ++expectedResizeEventCount; | 61 ++expectedResizeEventCount; |
62 }); | 62 }); |
63 | 63 |
64 test.waitForExpectedEvents(function() | 64 test.waitForExpectedEvents(function() |
65 { | 65 { |
66 // Truncate the presentation to a duration of 2 seconds. | 66 // Truncate the presentation to a duration of 2 seconds. |
67 assert_false(sourceBuffer.updating, "sourceBuffer.updating")
; | 67 // First, explicitly remove the media beyond 2 seconds. |
| 68 assert_false(sourceBuffer.updating, "sourceBuffer.updating b
efore range removal"); |
| 69 sourceBuffer.remove(2, mediaSource.duration); |
68 | 70 |
69 mediaSource.duration = 2; | 71 assert_true(sourceBuffer.updating, "sourceBuffer.updating du
ring range removal"); |
70 | |
71 assert_true(sourceBuffer.updating, "sourceBuffer.updating"); | |
72 test.expectEvent(sourceBuffer, "updatestart"); | 72 test.expectEvent(sourceBuffer, "updatestart"); |
73 test.expectEvent(sourceBuffer, "update"); | 73 test.expectEvent(sourceBuffer, "update"); |
74 test.expectEvent(sourceBuffer, "updateend"); | 74 test.expectEvent(sourceBuffer, "updateend"); |
75 }); | 75 }); |
76 | 76 |
77 test.waitForExpectedEvents(function() | 77 test.waitForExpectedEvents(function() |
78 { | 78 { |
| 79 // Complete the truncation of presentation to 2 second |
| 80 // duration. |
| 81 assert_false(sourceBuffer.updating, "sourceBuffer.updating p
rior to duration reduction"); |
| 82 mediaSource.duration = 2; |
| 83 assert_false(sourceBuffer.updating, "sourceBuffer.updating s
ynchronously after duration reduction"); |
| 84 |
| 85 test.expectEvent(mediaElement, "durationchange"); |
| 86 }); |
| 87 |
| 88 test.waitForExpectedEvents(function() |
| 89 { |
79 mediaSource.endOfStream(); | 90 mediaSource.endOfStream(); |
80 | 91 |
81 if (expectResizeEvents) { | 92 if (expectResizeEvents) { |
82 for (var i = 0; i < expectedResizeEventCount; ++i) { | 93 for (var i = 0; i < expectedResizeEventCount; ++i) { |
83 test.expectEvent(mediaElement, "resize"); | 94 test.expectEvent(mediaElement, "resize"); |
84 } | 95 } |
85 } | 96 } |
86 test.expectEvent(mediaElement, "ended"); | 97 test.expectEvent(mediaElement, "ended"); |
87 mediaElement.play(); | 98 mediaElement.play(); |
88 }); | 99 }); |
89 | 100 |
90 test.waitForExpectedEvents(function() { | 101 test.waitForExpectedEvents(function() { |
91 // TODO(wolenetz): Remove this hacky console warning once | 102 // TODO(wolenetz): Remove this hacky console warning once |
92 // desktop and android expectations match. It allows a | 103 // desktop and android expectations match. It allows a |
93 // passing platform-specific expectation to override a | 104 // passing platform-specific expectation to override a |
94 // failing non-platform-specific expectation. | 105 // failing non-platform-specific expectation. |
95 console.warn('Ignore this warning. See https://crbug.com/568
704#c2'); | 106 console.warn('Ignore this warning. See https://crbug.com/568
704#c2'); |
96 | 107 |
97 test.done(); | 108 test.done(); |
98 }); | 109 }); |
99 }); | 110 }); |
100 }); | 111 }); |
101 }, description, { timeout: 10000 } ); | 112 }, description, { timeout: 10000 } ); |
102 }; | 113 }; |
OLD | NEW |