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..21346358e8a3cb99f0544d4c4ea175cd9b3f91a0 |
--- /dev/null |
+++ b/LayoutTests/fast/mediarecorder/MediaRecorder-basic-video.html |
@@ -0,0 +1,65 @@ |
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
+<html> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+</head> |
+<body> |
+<p id="description"></p> |
+<div id="console"></div> |
+<script> |
+description("This Test checks the video-only MediaRecorder API."); |
+ |
+var stream; |
+var recorder; |
+ |
+function onError() { |
+ testFailed('Error callback called.'); |
+ finishJSTest(); |
+} |
+ |
+function recorderOnStart() |
+{ |
tommi (sloooow) - chröme
2015/08/11 08:46:50
nit: consistent {
mcasas
2015/08/12 06:47:50
Done.
|
+ 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);"); |
+ |
+window.jsTestIsAsync = true; |
+window.successfullyParsed = true; |
+</script> |
+</body> |
+</html> |