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

Unified Diff: chrome/test/data/extensions/api_test/desktop_capture/test.js

Issue 2547633002: Desktop Capture API: Pass Audio Selection Information To Javascript (Closed)
Patch Set: Browser Test Case Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/resources/extensions/desktop_capture_custom_bindings.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/desktop_capture/test.js
diff --git a/chrome/test/data/extensions/api_test/desktop_capture/test.js b/chrome/test/data/extensions/api_test/desktop_capture/test.js
index cacaab27c84a1a3829898e1ee742e778e8d1761c..bdf3131048a12721601097d02ba957c1cfdbf0f5 100644
--- a/chrome/test/data/extensions/api_test/desktop_capture/test.js
+++ b/chrome/test/data/extensions/api_test/desktop_capture/test.js
@@ -2,21 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-function onPickerResult(request_audio, audio_track_num, id) {
+function onPickerResult(audio_track_num, id, options) {
chrome.test.assertEq("string", typeof id);
chrome.test.assertTrue(id != "");
var video_constraint = { mandatory: { chromeMediaSource: "desktop",
chromeMediaSourceId: id } };
- var audio_constraint = request_audio ? video_constraint : false;
- navigator.webkitGetUserMedia({
+ var audio_constraint =
+ options.canRequestAudioTrack ? video_constraint : false;
+
+ navigator.mediaDevices.getUserMedia({
audio: audio_constraint,
video: video_constraint
- },
+ }).then(
function(stream) {
if (audio_track_num != null)
chrome.test.assertEq(audio_track_num, stream.getAudioTracks().length);
chrome.test.succeed();
- }, chrome.test.fail);
+ }).catch(chrome.test.fail);
}
// We can support audio for screen share on Windows. For ChromeOS, it depends
@@ -72,20 +74,30 @@ chrome.test.runTests([
function tabOnly() {
chrome.desktopCapture.chooseDesktopMedia(
["tab"],
- chrome.test.succeed);
+ chrome.test.callbackPass(function(id) {}));
+ },
+
+ function audioShareNoApproval() {
+ chrome.desktopCapture.chooseDesktopMedia(
+ ["screen", "window", "tab", "audio"],
+ chrome.test.callbackPass(function(id, options) {
+ chrome.test.assertEq(false, options.canRequestAudioTrack);
+ }));
},
- function audioShare() {
+ function audioShareApproval() {
chrome.desktopCapture.chooseDesktopMedia(
["screen", "window", "tab", "audio"],
- chrome.test.succeed);
+ chrome.test.callbackPass(function(id, options) {
+ chrome.test.assertEq(true, options.canRequestAudioTrack);
+ }));
},
// Show window picker and then get the selected stream using
// getUserMedia().
function chooseMediaAndGetStream() {
chrome.desktopCapture.chooseDesktopMedia(
- ["screen", "window"], onPickerResult.bind(undefined, false, 0));
+ ["screen", "window"], onPickerResult.bind(undefined, 0));
},
// Same as above but attempts to specify invalid source id.
@@ -124,33 +136,33 @@ chrome.test.runTests([
// constraint.
function tabShareWithAudioPermissionGetStream() {
chrome.desktopCapture.chooseDesktopMedia(
- ["tab", "audio"], onPickerResult.bind(undefined, true, 1));
+ ["tab", "audio"], onPickerResult.bind(undefined, 1));
},
function windowShareWithAudioPermissionGetStream() {
chrome.desktopCapture.chooseDesktopMedia(
- ["window", "audio"], onPickerResult.bind(undefined, true, 0));
+ ["window", "audio"], onPickerResult.bind(undefined, 0));
},
function screenShareWithAudioPermissionGetStream() {
chrome.desktopCapture.chooseDesktopMedia(
["screen", "audio"],
- onPickerResult.bind(undefined, true,
+ onPickerResult.bind(undefined,
expected_audio_tracks_for_screen_share));
},
function tabShareWithoutAudioPermissionGetStream() {
chrome.desktopCapture.chooseDesktopMedia(
- ["tab", "audio"], onPickerResult.bind(undefined, true, 0));
+ ["tab", "audio"], onPickerResult.bind(undefined, 0));
},
function windowShareWithoutAudioPermissionGetStream() {
chrome.desktopCapture.chooseDesktopMedia(
- ["window", "audio"], onPickerResult.bind(undefined, true, 0));
+ ["window", "audio"], onPickerResult.bind(undefined, 0));
},
function screenShareWithoutAudioPermissionGetStream() {
chrome.desktopCapture.chooseDesktopMedia(
- ["screen", "audio"], onPickerResult.bind(undefined, true, 0));
+ ["screen", "audio"], onPickerResult.bind(undefined, 0));
}
]);
« no previous file with comments | « chrome/renderer/resources/extensions/desktop_capture_custom_bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698