Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: chrome/test/data/extensions/api_test/desktop_capture/test.js

Issue 2721113002: getUserMedia: handle the device starting status report. (Closed)
Patch Set: address nits on PS#6 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 screenShareWithAudioPermissionGetStream() {
138 chrome.desktopCapture.chooseDesktopMedia(
139 ["screen", "audio"],
140 onPickerResult.bind(undefined,
141 expected_audio_tracks_for_screen_share));
142 },
143
144 function screenShareWithoutAudioPermissionGetStream() {
145 chrome.desktopCapture.chooseDesktopMedia(
146 ["screen", "audio"], onPickerResult.bind(undefined, 0));
147 }
148
149 /**
Sergey Ulanov 2017/03/14 19:43:34 use // for comments please And then you also would
150 * Only screenShare can be tested as above, because "chooseDesktopMedia" will
151 * return fake source id to tab/windowShare, with which tab/window catpure
152 * can't be started successfully.
153 * TODO(braveyao): get below cases working again. http://crbug.com/699201
137 function tabShareWithAudioPermissionGetStream() { 154 function tabShareWithAudioPermissionGetStream() {
138 chrome.desktopCapture.chooseDesktopMedia( 155 chrome.desktopCapture.chooseDesktopMedia(
139 ["tab", "audio"], onPickerResult.bind(undefined, 1)); 156 ["tab", "audio"], onPickerResult.bind(undefined, 1));
140 }, 157 },
141 158
142 function windowShareWithAudioPermissionGetStream() { 159 function windowShareWithAudioPermissionGetStream() {
143 chrome.desktopCapture.chooseDesktopMedia( 160 chrome.desktopCapture.chooseDesktopMedia(
144 ["window", "audio"], onPickerResult.bind(undefined, 0)); 161 ["window", "audio"], onPickerResult.bind(undefined, 0));
145 }, 162 },
146 163
147 function screenShareWithAudioPermissionGetStream() {
148 chrome.desktopCapture.chooseDesktopMedia(
149 ["screen", "audio"],
150 onPickerResult.bind(undefined,
151 expected_audio_tracks_for_screen_share));
152 },
153
154 function tabShareWithoutAudioPermissionGetStream() { 164 function tabShareWithoutAudioPermissionGetStream() {
155 chrome.desktopCapture.chooseDesktopMedia( 165 chrome.desktopCapture.chooseDesktopMedia(
156 ["tab", "audio"], onPickerResult.bind(undefined, 0)); 166 ["tab", "audio"], onPickerResult.bind(undefined, 0));
157 }, 167 },
158 168
159 function windowShareWithoutAudioPermissionGetStream() { 169 function windowShareWithoutAudioPermissionGetStream() {
160 chrome.desktopCapture.chooseDesktopMedia( 170 chrome.desktopCapture.chooseDesktopMedia(
161 ["window", "audio"], onPickerResult.bind(undefined, 0)); 171 ["window", "audio"], onPickerResult.bind(undefined, 0));
162 }, 172 }
173 **/
163 174
164 function screenShareWithoutAudioPermissionGetStream() {
165 chrome.desktopCapture.chooseDesktopMedia(
166 ["screen", "audio"], onPickerResult.bind(undefined, 0));
167 }
168 ]); 175 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698