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

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

Issue 987583004: Add audible, muted to Tab, c.t.query, c.t.update, and c.t.onUpdated where relevant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch1
Patch Set: Change tabIsUnmutedWhenTabCaptured test to not require a timeout Created 5 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 var tabCapture = chrome.tabCapture; 5 var tabCapture = chrome.tabCapture;
6 6
7 chrome.test.runTests([ 7 chrome.test.runTests([
8 function captureTabAndVerifyStateTransitions() { 8 function captureTabAndVerifyStateTransitions() {
9 // Tab capture events in the order they happen. 9 // Tab capture events in the order they happen.
10 var tabCaptureEvents = []; 10 var tabCaptureEvents = [];
(...skipping 11 matching lines...) Expand all
22 }; 22 };
23 tabCapture.onStatusChanged.addListener(tabCaptureListener); 23 tabCapture.onStatusChanged.addListener(tabCaptureListener);
24 24
25 tabCapture.capture({audio: true, video: true}, function(stream) { 25 tabCapture.capture({audio: true, video: true}, function(stream) {
26 chrome.test.assertTrue(!!stream); 26 chrome.test.assertTrue(!!stream);
27 stream.stop(); 27 stream.stop();
28 }); 28 });
29 }, 29 },
30 30
31 function getCapturedTabs() { 31 function getCapturedTabs() {
32 chrome.tabs.create({active:true}, function(secondTab) { 32 chrome.tabs.create({active: true}, function(secondTab) {
33 // chrome.tabCapture.capture() will only capture the active tab. 33 // chrome.tabCapture.capture() will only capture the active tab.
34 chrome.test.assertTrue(secondTab.active); 34 chrome.test.assertTrue(secondTab.active);
35 35
36 function checkInfoForSecondTabHasStatus(infos, status) { 36 function checkInfoForSecondTabHasStatus(infos, status) {
37 for (var i = 0; i < infos.length; ++i) { 37 for (var i = 0; i < infos.length; ++i) {
38 if (infos[i].tabId == secondTab) { 38 if (infos[i].tabId == secondTab) {
39 chrome.test.assertNe(null, status); 39 chrome.test.assertNe(null, status);
40 chrome.test.assertEq(status, infos[i].status); 40 chrome.test.assertEq(status, infos[i].status);
41 chrome.test.assertEq(false, infos[i].fullscreen); 41 chrome.test.assertEq(false, infos[i].fullscreen);
42 return; 42 return;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 chrome.test.succeed(); 90 chrome.test.succeed();
91 }; 91 };
92 92
93 tabCapture.capture({audio: true, video: true}, function(stream) { 93 tabCapture.capture({audio: true, video: true}, function(stream) {
94 chrome.test.assertTrue(!!stream); 94 chrome.test.assertTrue(!!stream);
95 stream1 = stream; 95 stream1 = stream;
96 tabCapture.capture({audio: true, video: true}, tabMediaRequestCallback2); 96 tabCapture.capture({audio: true, video: true}, tabMediaRequestCallback2);
97 }); 97 });
98 }, 98 },
99 99
100 function tabIsUnmutedWhenTabCaptured() {
101 var stream1 = null;
102
103 chrome.tabs.getCurrent(function(tab) {
104 var stopListener = chrome.test.listenForever(chrome.tabs.onUpdated,
105 function(tabId, changeInfo, updatedTab) {
106 if ((changeInfo["muted"] === true)) {
not at google - send to devlin 2015/06/05 21:20:52 outer parens not necessary
107 tabCapture.capture({audio: true}, function(stream) {
108 stream1 = stream;
109 });
110 }
111 else if ((changeInfo["mutedCause"] == "capture") &&
112 (changeInfo["muted"] === false)) {
113 stream1.stop();
114 stopListener();
115 }
116 });
117
118 chrome.tabs.update(tab.id, {muted: true});
119 });
120 },
121
100 function onlyVideo() { 122 function onlyVideo() {
101 tabCapture.capture({video: true}, function(stream) { 123 tabCapture.capture({video: true}, function(stream) {
102 chrome.test.assertTrue(!!stream); 124 chrome.test.assertTrue(!!stream);
103 stream.stop(); 125 stream.stop();
104 chrome.test.succeed(); 126 chrome.test.succeed();
105 }); 127 });
106 }, 128 },
107 129
108 function onlyAudio() { 130 function onlyAudio() {
109 tabCapture.capture({audio: true}, function(stream) { 131 tabCapture.capture({audio: true}, function(stream) {
110 chrome.test.assertTrue(!!stream); 132 chrome.test.assertTrue(!!stream);
111 stream.stop(); 133 stream.stop();
112 chrome.test.succeed(); 134 chrome.test.succeed();
113 }); 135 });
114 }, 136 },
115 137
116 function noAudioOrVideoRequested() { 138 function noAudioOrVideoRequested() {
117 // If not specified, video is not requested. 139 // If not specified, video is not requested.
118 tabCapture.capture({audio: false}, function(stream) { 140 tabCapture.capture({audio: false}, function(stream) {
119 chrome.test.assertTrue(!stream); 141 chrome.test.assertTrue(!stream);
120 chrome.test.succeed(); 142 chrome.test.succeed();
121 }); 143 });
122 } 144 }
123 ]); 145 ]);
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/tabs.json ('k') | chrome/test/data/extensions/api_test/tabs/basics/audible.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698