Chromium Code Reviews| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 116 |
| 117 function cancelDialog() { | 117 function cancelDialog() { |
| 118 var requestId = chrome.desktopCapture.chooseDesktopMedia( | 118 var requestId = chrome.desktopCapture.chooseDesktopMedia( |
| 119 ["screen", "window"], | 119 ["screen", "window"], |
| 120 chrome.test.fail); | 120 chrome.test.fail); |
| 121 chrome.test.assertEq("number", typeof requestId); | 121 chrome.test.assertEq("number", typeof requestId); |
| 122 chrome.desktopCapture.cancelChooseDesktopMedia(requestId); | 122 chrome.desktopCapture.cancelChooseDesktopMedia(requestId); |
| 123 chrome.test.succeed(); | 123 chrome.test.succeed(); |
| 124 }, | 124 }, |
| 125 | 125 |
| 126 // For the following six, they all request audio track. Based on user's | 126 // Only screenShare can be tested as below, because we can't get stream with |
| 127 // permission and the source type, it may or may not actually get the audio | 127 // fake web-content/window source id. |
|
chfremer
2017/03/02 17:56:10
I don't immediately see why the changes in this CL
braveyao
2017/03/03 17:53:12
Revised the comments a bit. Is it better?
chfremer
2017/03/03 19:08:33
The extra information in the new comment seems hel
braveyao
2017/03/03 21:34:55
Before this cl, gUM always get successful callback
| |
| 128 // track. | |
| 129 // In detail: | |
| 130 // 1. We cannot support audio for Window share; | |
| 131 // 2. We can support audio for Tab share; | |
| 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; | |
| 134 // 5. To actually get audio track, user permission is always necessary; | |
| 135 // 6. To actually get audio track, getUserMedia() should set audio | |
| 136 // constraint. | |
| 137 function tabShareWithAudioPermissionGetStream() { | |
| 138 chrome.desktopCapture.chooseDesktopMedia( | |
| 139 ["tab", "audio"], onPickerResult.bind(undefined, 1)); | |
| 140 }, | |
| 141 | |
| 142 function windowShareWithAudioPermissionGetStream() { | |
| 143 chrome.desktopCapture.chooseDesktopMedia( | |
| 144 ["window", "audio"], onPickerResult.bind(undefined, 0)); | |
| 145 }, | |
| 146 | |
| 147 function screenShareWithAudioPermissionGetStream() { | 128 function screenShareWithAudioPermissionGetStream() { |
| 148 chrome.desktopCapture.chooseDesktopMedia( | 129 chrome.desktopCapture.chooseDesktopMedia( |
| 149 ["screen", "audio"], | 130 ["screen", "audio"], |
| 150 onPickerResult.bind(undefined, | 131 onPickerResult.bind(undefined, |
| 151 expected_audio_tracks_for_screen_share)); | 132 expected_audio_tracks_for_screen_share)); |
| 152 }, | 133 }, |
| 153 | 134 |
| 154 function tabShareWithoutAudioPermissionGetStream() { | |
| 155 chrome.desktopCapture.chooseDesktopMedia( | |
| 156 ["tab", "audio"], onPickerResult.bind(undefined, 0)); | |
| 157 }, | |
| 158 | |
| 159 function windowShareWithoutAudioPermissionGetStream() { | |
| 160 chrome.desktopCapture.chooseDesktopMedia( | |
| 161 ["window", "audio"], onPickerResult.bind(undefined, 0)); | |
| 162 }, | |
| 163 | |
| 164 function screenShareWithoutAudioPermissionGetStream() { | 135 function screenShareWithoutAudioPermissionGetStream() { |
| 165 chrome.desktopCapture.chooseDesktopMedia( | 136 chrome.desktopCapture.chooseDesktopMedia( |
| 166 ["screen", "audio"], onPickerResult.bind(undefined, 0)); | 137 ["screen", "audio"], onPickerResult.bind(undefined, 0)); |
| 167 } | 138 } |
| 168 ]); | 139 ]); |
| OLD | NEW |