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

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

Issue 1758463002: Add browser test cases for tab and audio share, which are new functionality of desktop share. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 chrome.test.runTests([ 5 chrome.test.runTests([
6 function emptySourceList() { 6 function emptySourceList() {
7 chrome.desktopCapture.chooseDesktopMedia( 7 chrome.desktopCapture.chooseDesktopMedia(
8 [], 8 [],
9 chrome.test.callback(function(id) { 9 chrome.test.callback(function(id) {
10 chrome.test.assertEq("undefined", typeof id); 10 chrome.test.assertEq("undefined", typeof id);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 ["screen", "window"], onPickerResult); 74 ["screen", "window"], onPickerResult);
75 }, 75 },
76 76
77 function cancelDialog() { 77 function cancelDialog() {
78 var requestId = chrome.desktopCapture.chooseDesktopMedia( 78 var requestId = chrome.desktopCapture.chooseDesktopMedia(
79 ["screen", "window"], 79 ["screen", "window"],
80 chrome.test.fail); 80 chrome.test.fail);
81 chrome.test.assertEq("number", typeof requestId); 81 chrome.test.assertEq("number", typeof requestId);
82 chrome.desktopCapture.cancelChooseDesktopMedia(requestId); 82 chrome.desktopCapture.cancelChooseDesktopMedia(requestId);
83 chrome.test.succeed(); 83 chrome.test.succeed();
84 },
85
86 function tabShare() {
87 chrome.desktopCapture.chooseDesktopMedia(
88 ["screen", "window", "tab"],
89 chrome.test.succeed);
90 },
91
92 function audioShare() {
93 chrome.desktopCapture.chooseDesktopMedia(
94 ["screen", "window", "audio"],
95 chrome.test.succeed);
96 },
97
98 function tabShareWithAudioGetStream() {
99 function onPickerResult(id) {
100 chrome.test.assertEq("string", typeof id);
101 chrome.test.assertTrue(id != "");
102 navigator.webkitGetUserMedia({
103 audio: { mandatory: { chromeMediaSource: "desktop",
104 chromeMediaSourceId: id } },
105 video: { mandatory: { chromeMediaSource: "desktop",
106 chromeMediaSourceId: id } }
107 },
108 function(stream) {
109 chrome.test.assertEq(1, stream.getAudioTracks().length);
110 chrome.test.succeed();
111 }, chrome.test.fail);
112 }
113
114 chrome.desktopCapture.chooseDesktopMedia(
115 ["tab", "audio"], onPickerResult);
116 },
117
118 function windowShareWithAudioGetStream() {
119 function onPickerResult(id) {
120 chrome.test.assertEq("string", typeof id);
121 chrome.test.assertTrue(id != "");
122 navigator.webkitGetUserMedia({
123 audio: { mandatory: { chromeMediaSource: "desktop",
124 chromeMediaSourceId: id } },
125 video: { mandatory: { chromeMediaSource: "desktop",
126 chromeMediaSourceId: id } }
127 },
128 function(stream) {
129 // For window share, we cannot support audio. This test is to make
130 // sure that our code does not crash.
131 chrome.test.assertEq(0, stream.getAudioTracks().length);
132 chrome.test.succeed();
133 }, chrome.test.fail);
134 }
135
136 chrome.desktopCapture.chooseDesktopMedia(
137 ["window", "audio"], onPickerResult);
84 } 138 }
85 ]); 139 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698