Index: third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-ended.html |
diff --git a/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-capture.html b/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-ended.html |
similarity index 56% |
copy from third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-capture.html |
copy to third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-ended.html |
index 420e3959309daaa64ecc43883bf7c8f59c4d7032..bf49be230338aec88176fe2a4a3d6ec6486b556f 100644 |
--- a/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-capture.html |
+++ b/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-ended.html |
@@ -3,28 +3,25 @@ |
<script src=../../resources/testharnessreport.js></script> |
<script> |
-// Run captureStream() on different videos, and assert data is flowing. |
+// Run captureStream() on different videos, and assert the mediastream is |
+// ended when the source HTMLMediaElement finishes |
var makeAsyncTest = function(filename) { |
async_test(function(test) { |
var video = document.createElement('video'); |
video.src = "../../http/tests/media/resources/media-source/webm/" + filename; |
video.onerror = this.unreached_func("<video> error"); |
+ video.play(); |
- video.onloadedmetadata = this.step_func(function() { |
- var stream = video.captureStream(); |
- var recorder = new MediaRecorder(stream); |
- recorder.ondataavailable = test.step_func_done(function(event) { |
- assert_true(event.data.size > 0, 'Recorded data size should be > 0'); |
- }); |
- |
- recorder.start(0); |
- video.play(); |
+ var stream = video.captureStream(); |
+ stream.onremovetrack = this.step_func_done(function() { |
+ assert_true(video.ended, 'video must be ended'); |
+ assert_equals(stream.getTracks().length, 0, 'stream must have no tracks'); |
+ assert_false(stream.active, 'stream must be inactive'); |
}); |
- video.load(); |
- }), "<video>.captureStream() and assert data flows."; |
+ }), "<video>.captureStream() and assert data flows."; |
}; |
generate_tests(makeAsyncTest, [ |