summaryrefslogtreecommitdiffstats
path: root/b2g/chrome/content/test/mochitest/test_recordingStatus_multiple_requests.html
diff options
context:
space:
mode:
Diffstat (limited to 'b2g/chrome/content/test/mochitest/test_recordingStatus_multiple_requests.html')
-rw-r--r--b2g/chrome/content/test/mochitest/test_recordingStatus_multiple_requests.html108
1 files changed, 108 insertions, 0 deletions
diff --git a/b2g/chrome/content/test/mochitest/test_recordingStatus_multiple_requests.html b/b2g/chrome/content/test/mochitest/test_recordingStatus_multiple_requests.html
new file mode 100644
index 000000000..7d31a94f8
--- /dev/null
+++ b/b2g/chrome/content/test/mochitest/test_recordingStatus_multiple_requests.html
@@ -0,0 +1,108 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Recording Status with multiple gUM requests</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript;version=1.7" src="RecordingStatusHelper.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+
+<pre id="test">
+<script class="testbody" type="text/javascript;version=1.7">
+'use strict';
+
+SimpleTest.waitForExplicitFinish();
+
+function test() {
+ let localStreams = [];
+ TestInit().then(function(eventHelper) {
+ /* step 1: create one audio stream
+ * expect: see one mozChromeEvent for recording start.
+ */
+ let eventDeferred = expectEvent({ active: true,
+ isAudio: true,
+ isVideo: false
+ }, eventHelper);
+
+ let gumDeferred = expectStream({ audio: true,
+ fake: true
+ }, function(stream) {
+ localStreams.push(stream);
+ });
+
+ return expectAll([eventDeferred, gumDeferred]);
+ }).then(function([eventHelper]) {
+ /* step 2: create another audio stream
+ * expect: no mozChromeEvent after audio stream is created
+ */
+ let gumDeferred = expectStream({ audio: true,
+ fake: true
+ }, function(stream) {
+ localStreams.push(stream);
+ });
+
+ return expectAll([Promise.resolve(eventHelper), gumDeferred]);
+ }).then(function([eventHelper]) {
+ /* step 3: create video stream
+ * expect: see one mozChromeEvent for recording start
+ */
+ let eventDeferred = expectEvent({ active: true,
+ isAudio: true,
+ isVideo: true
+ }, eventHelper);
+
+ let gumDeferred = expectStream({ video: true,
+ fake: true
+ }, function(stream) {
+ localStreams.push(stream);
+ });
+
+ return expectAll([eventDeferred, gumDeferred]);
+ }).then(function([eventHelper]) {
+ /* step 4: stop first audio stream
+ * expect: no mozChromeEvent after first audio stream is stopped
+ */
+ localStreams.shift().stop();
+ info('stop the first audio stream');
+ return Promise.resolve(eventHelper);
+ }).then(function(eventHelper) {
+ /* step 5: stop the second audio stream
+ * expect: see one mozChromeEvent for audio recording stop.
+ */
+ let eventDeferred = expectEvent({ active: true,
+ isAudio: false,
+ isVideo: true
+ }, eventHelper);
+
+ localStreams.shift().stop();
+ info('stop the second audio stream');
+ return eventDeferred;
+ }).then(function(eventHelper) {
+ /* step 6: stop the video stream
+ * expect: see one mozChromeEvent for video recording stop.
+ */
+ let eventDeferred = expectEvent({ active: false,
+ isAudio: false,
+ isVideo: false
+ }, eventHelper);
+
+ localStreams.shift().stop();
+ info('stop the video stream');
+ return eventDeferred;
+ }).then(function(eventHelper) {
+ eventHelper.finish();
+ SimpleTest.finish();
+ });
+}
+
+SpecialPowers.pushPrefEnv({
+ "set": [
+ ['media.navigator.permission.disabled', true]
+ ]
+}, test);
+
+</script>
+</pre>
+</body>
+</html>