| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 function onPickerResult(audio_track_num, id, options) { | 5 function onPickerResult(audio_track_num, id, options) { |
| 6 chrome.test.assertEq("string", typeof id); | 6 chrome.test.assertEq("string", typeof id); |
| 7 chrome.test.assertTrue(id != ""); | 7 chrome.test.assertTrue(id != ""); |
| 8 var video_constraint = { mandatory: { chromeMediaSource: "desktop", | 8 var video_constraint = { mandatory: { chromeMediaSource: "desktop", |
| 9 chromeMediaSourceId: id } }; | 9 chromeMediaSourceId: id } }; |
| 10 var audio_constraint = | 10 var audio_constraint = |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // permission and the source type, it may or may not actually get the audio | 127 // permission and the source type, it may or may not actually get the audio |
| 128 // track. | 128 // track. |
| 129 // In detail: | 129 // In detail: |
| 130 // 1. We cannot support audio for Window share; | 130 // 1. We cannot support audio for Window share; |
| 131 // 2. We can support audio for Tab share; | 131 // 2. We can support audio for Tab share; |
| 132 // 3. We can support audio for Screen share on Windows; | 132 // 3. We can support audio for Screen share on Windows; |
| 133 // 4. We can support audio for Screen Share on ChromeOS if USE_CRAS is on; | 133 // 4. We can support audio for Screen Share on ChromeOS if USE_CRAS is on; |
| 134 // 5. To actually get audio track, user permission is always necessary; | 134 // 5. To actually get audio track, user permission is always necessary; |
| 135 // 6. To actually get audio track, getUserMedia() should set audio | 135 // 6. To actually get audio track, getUserMedia() should set audio |
| 136 // constraint. | 136 // constraint. |
| 137 function tabShareWithAudioPermissionGetStream() { | |
| 138 chrome.desktopCapture.chooseDesktopMedia( | |
| 139 ["tab", "audio"], onPickerResult.bind(undefined, 1)); | |
| 140 }, | |
| 141 | 137 |
| 142 function windowShareWithAudioPermissionGetStream() { | 138 // Only screenShare can be tested currently, because "chooseDesktopMedia" will |
| 143 chrome.desktopCapture.chooseDesktopMedia( | 139 // return fake source id to tab/windowShare, with which tab/window catpure |
| 144 ["window", "audio"], onPickerResult.bind(undefined, 0)); | 140 // can't be started successfully. |
| 145 }, | 141 // TODO(braveyao): get below cases working again. http://crbug.com/699201 |
| 142 |
| 143 //function tabShareWithAudioPermissionGetStream() { |
| 144 // chrome.desktopCapture.chooseDesktopMedia( |
| 145 // ["tab", "audio"], onPickerResult.bind(undefined, 1)); |
| 146 //}, |
| 147 |
| 148 //function windowShareWithAudioPermissionGetStream() { |
| 149 // chrome.desktopCapture.chooseDesktopMedia( |
| 150 // ["window", "audio"], onPickerResult.bind(undefined, 0)); |
| 151 //}, |
| 146 | 152 |
| 147 function screenShareWithAudioPermissionGetStream() { | 153 function screenShareWithAudioPermissionGetStream() { |
| 148 chrome.desktopCapture.chooseDesktopMedia( | 154 chrome.desktopCapture.chooseDesktopMedia( |
| 149 ["screen", "audio"], | 155 ["screen", "audio"], |
| 150 onPickerResult.bind(undefined, | 156 onPickerResult.bind(undefined, |
| 151 expected_audio_tracks_for_screen_share)); | 157 expected_audio_tracks_for_screen_share)); |
| 152 }, | 158 }, |
| 153 | 159 |
| 154 function tabShareWithoutAudioPermissionGetStream() { | 160 //function tabShareWithoutAudioPermissionGetStream() { |
| 155 chrome.desktopCapture.chooseDesktopMedia( | 161 // chrome.desktopCapture.chooseDesktopMedia( |
| 156 ["tab", "audio"], onPickerResult.bind(undefined, 0)); | 162 // ["tab", "audio"], onPickerResult.bind(undefined, 0)); |
| 157 }, | 163 //}, |
| 158 | 164 |
| 159 function windowShareWithoutAudioPermissionGetStream() { | 165 //function windowShareWithoutAudioPermissionGetStream() { |
| 160 chrome.desktopCapture.chooseDesktopMedia( | 166 // chrome.desktopCapture.chooseDesktopMedia( |
| 161 ["window", "audio"], onPickerResult.bind(undefined, 0)); | 167 // ["window", "audio"], onPickerResult.bind(undefined, 0)); |
| 162 }, | 168 //}, |
| 163 | 169 |
| 164 function screenShareWithoutAudioPermissionGetStream() { | 170 function screenShareWithoutAudioPermissionGetStream() { |
| 165 chrome.desktopCapture.chooseDesktopMedia( | 171 chrome.desktopCapture.chooseDesktopMedia( |
| 166 ["screen", "audio"], onPickerResult.bind(undefined, 0)); | 172 ["screen", "audio"], onPickerResult.bind(undefined, 0)); |
| 167 } | 173 } |
| 168 ]); | 174 ]); |
| OLD | NEW |