Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-events-and-exceptions.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-events-and-exceptions.html b/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-events-and-exceptions.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d68c27e96428b97755470aafbb6ad1f840a8bf9c |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-events-and-exceptions.html |
| @@ -0,0 +1,69 @@ |
| +<!DOCTYPE html> |
|
Justin Novosad
2015/12/03 15:44:37
missing -expected.txt
|
| +<script src=../../resources/testharness.js></script> |
| +<script src=../../resources/testharnessreport.js></script> |
| +<script> |
| + |
| +var test = async_test('exercises the potential exceptions on ' + |
| + 'CanvasCaptureMediaStream and possible events on MediaStream element.'); |
| + |
| +onStreamActive = test.step_func(function() { |
|
Justin Novosad
2015/12/03 15:44:37
The assertion implementation in testharness.js lea
|
| + assert_equals(stream.active, true); |
| + assert_equals(stream.getVideoTracks().length, 1); |
| + assert_equals(stream.getVideoTracks()[0].readyState, 'live'); |
| + assert_equals(stream.getAudioTracks().length, 0); |
| +}); |
| + |
| +onStreamEnded = test.step_func(function() { |
| + assert_equals(stream.ended, true); |
| +}); |
| + |
| +onStreamRemoveTrack = test.step_func(function() { |
| + assert_equals(stream.getVideoTracks().length, 0); |
| + assert_equals(stream.getAudioTracks().length, 0); |
| +}); |
| + |
| +removeTrack = test.step_func(function(stream) { |
| + stream.removeTrack(stream.getVideoTracks()[0]); |
| +}); |
| + |
| +onTrackStarted = test.step_func(function() { |
| + assert_equals(track.readyState, 'live'); |
| + assert_equals(track.enabled, true); |
| + assert_equals(track.muted, false); |
| +}); |
| + |
| +onTrackEnded = test.step_func(function() { |
| + assert_equals(track.readyState, 'ended'); |
| +}); |
| + |
| +gotStream = test.step_func(function(stream) { |
| + stream.onactive = onStreamActive; |
| + stream.onended = onStreamEnded; |
| + |
| + track = stream.getVideoTracks()[0]; |
| + track.onstarted = onTrackStarted; |
| + track.onended = onTrackEnded; |
| + |
| + var video = document.createElement('video'); |
| + try { |
| + video.src = window.URL.createObjectURL(stream);; |
| + } catch(e) { |
| + assert_unreached('Exception plugging stream to <video>: ' + e); |
| + } |
| + video.play(); |
| + |
| + removeTrack(stream); |
| + test.done(); |
|
Justin Novosad
2015/12/03 15:44:37
Maybe I am misunderstanding how this test works, b
esprehn
2015/12/03 18:47:34
Yeah are you sure this is right?
|
| +}); |
| + |
| +var canvas = document.createElement('canvas'); |
| +var stream; |
| +var track; |
| +try { |
| + stream = canvas.captureStream(); |
| +} catch (e) { |
| + assert_unreached('Exception calling captureStream(): ' + e); |
| +} |
| +gotStream(stream); |
| + |
| +</script> |