| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var tabCapture = chrome.tabCapture; | 5 var tabCapture = chrome.tabCapture; |
| 6 | 6 |
| 7 chrome.test.runTests([ | 7 chrome.test.runTests([ |
| 8 function captureTabAndVerifyStateTransitions() { | 8 function captureTabAndVerifyStateTransitions() { |
| 9 // Tab capture events in the order they happen. | 9 // Tab capture events in the order they happen. |
| 10 var tabCaptureEvents = []; | 10 var tabCaptureEvents = []; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 }, | 85 }, |
| 86 | 86 |
| 87 function onlyVideo() { | 87 function onlyVideo() { |
| 88 tabCapture.capture({video: true}, function(stream) { | 88 tabCapture.capture({video: true}, function(stream) { |
| 89 chrome.test.assertTrue(!!stream); | 89 chrome.test.assertTrue(!!stream); |
| 90 stream.stop(); | 90 stream.stop(); |
| 91 chrome.test.succeed(); | 91 chrome.test.succeed(); |
| 92 }); | 92 }); |
| 93 }, | 93 }, |
| 94 | 94 |
| 95 function onlyAudio() { | |
| 96 tabCapture.capture({audio: true}, function(stream) { | |
| 97 chrome.test.assertTrue(!!stream); | |
| 98 stream.stop(); | |
| 99 chrome.test.succeed(); | |
| 100 }); | |
| 101 }, | |
| 102 | |
| 103 function noAudioOrVideoRequested() { | 95 function noAudioOrVideoRequested() { |
| 104 // If not specified, video is not requested. | 96 // If not specified, video is not requested. |
| 105 tabCapture.capture({audio: false}, function(stream) { | 97 tabCapture.capture({audio: false}, function(stream) { |
| 106 chrome.test.assertTrue(!stream); | 98 chrome.test.assertTrue(!stream); |
| 107 chrome.test.succeed(); | 99 chrome.test.succeed(); |
| 108 }); | 100 }); |
| 109 }, | |
| 110 | |
| 111 function invalidAudioConstraints() { | |
| 112 var tabCaptureListener = function(info) { | |
| 113 if (info.status == 'stopped') { | |
| 114 tabCapture.onStatusChanged.removeListener(tabCaptureListener); | |
| 115 | |
| 116 tabCapture.capture({audio: true, video: true}, function(stream) { | |
| 117 chrome.test.assertTrue(!!stream); | |
| 118 chrome.test.succeed(); | |
| 119 }); | |
| 120 } | |
| 121 }; | |
| 122 tabCapture.onStatusChanged.addListener(tabCaptureListener); | |
| 123 | |
| 124 tabCapture.capture({audio: true, | |
| 125 audioConstraints: { | |
| 126 'mandatory': { | |
| 127 'notValid': '123' | |
| 128 } | |
| 129 }}, function(stream) { | |
| 130 chrome.test.assertTrue(!stream); | |
| 131 }); | |
| 132 } | 101 } |
| 133 | 102 |
| 134 ]); | 103 ]); |
| OLD | NEW |