Index: LayoutTests/fast/mediarecorder/MediaRecorder-basic-video.html |
diff --git a/LayoutTests/fast/mediarecorder/MediaRecorder-basic-video.html b/LayoutTests/fast/mediarecorder/MediaRecorder-basic-video.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ec585ba8c367ff68328e9b70c1236627cb2d75ce |
--- /dev/null |
+++ b/LayoutTests/fast/mediarecorder/MediaRecorder-basic-video.html |
@@ -0,0 +1,52 @@ |
+<script src="../../resources/js-test.js"></script> |
mlamouri (slow - plz ping)
2015/08/13 13:31:47
Could you use testharness so we can share the test
mcasas
2015/08/13 18:42:16
Done.
|
+<script> |
+description("This Test checks the video-only MediaRecorder API."); |
+ |
+var stream; |
+var recorder; |
+ |
+window.jsTestIsAsync = true; |
+ |
+function onError() { |
+ testFailed('Error callback called.'); |
+ finishJSTest(); |
+} |
+ |
+function recorderOnStart() { |
+ testPassed('Recording started.'); |
+} |
+ |
+function recorderOnDataAvailable(event) { |
+ testPassed('Recorded data received, size: ' + event.data.size); |
+ shouldBeGreaterThan('event.data.size', '0'); |
+ |
+ // TODO(mcasas): Let the test record for a while. |
+ // TODO(mcasas): Consider storing the recorded data and playing it back. |
+ |
+ testPassed('Some data recorded.'); |
+ finishJSTest(); |
+} |
+ |
+function recorderOnStop() { |
+ testFailed('Recording stopped.'); |
+ recorder = null |
+ finishJSTest() |
+} |
+ |
+function gotStream(s) { |
+ stream = s; |
+ testPassed('Stream generated.'); |
+ shouldBe('stream.getAudioTracks().length', '0'); |
+ shouldBe('stream.getVideoTracks().length', '1'); |
+ |
+ shouldNotThrow("recorder = new MediaRecorder(stream);"); |
+ if (!recorder) |
+ finishJSTest(); |
+ shouldNotThrow("recorder.onstart = recorderOnStart;"); |
+ shouldNotThrow("recorder.ondataavailable = recorderOnDataAvailable;"); |
+ shouldNotThrow("recorder.onstop = recorderOnStop;"); |
+ shouldNotThrow("recorder.start();"); |
+} |
+ |
+shouldNotThrow("navigator.webkitGetUserMedia({video:true}, gotStream, onError);"); |
+</script> |