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

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

Issue 1221483002: New tabCapture.captureOffscreenTab API, initially for Presentation API 1UA mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert to only whitelisted extension use. Created 5 years, 2 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var tabCapture = chrome.tabCapture;
6
7 var helloWorldPageUri = 'data:text/html;charset=UTF-8,' +
8 encodeURIComponent('<html><body>Hello world!</body></html>');
9
10 chrome.test.runTests([
11 function canOpenUpToThreeOffscreenTabs() {
12 tabCapture.captureOffscreenTab(
13 helloWorldPageUri,
14 {video: true},
15 function(stream1) {
16 // 1st off-screen tab capture should succeed.
17 chrome.test.assertTrue(!!stream1);
18 if (!stream1) return;
19
20 tabCapture.captureOffscreenTab(
21 helloWorldPageUri,
22 {video: true},
23 function(stream2) {
24 // 2nd off-screen tab capture should succeed.
25 chrome.test.assertTrue(!!stream2);
26 if (!stream2) return;
imcheng 2015/09/29 01:28:56 You'd have to stop stream1 before returning, right
miu 2015/09/30 19:46:38 Not really, but that *would* be cleaner. I rewrot
27
28 tabCapture.captureOffscreenTab(
29 helloWorldPageUri,
30 {video: true},
31 function(stream3) {
32 // 3rd off-screen tab capture should succeed.
33 chrome.test.assertTrue(!!stream3);
34 if (!stream3) return;
35
36 tabCapture.captureOffscreenTab(
37 helloWorldPageUri,
38 {video: true},
39 function(stream4) {
40 // 4th off-screen tab capture should fail.
41 chrome.test.assertFalse(!!stream4);
42
43 stream3.getVideoTracks()[0].stop();
44 stream2.getVideoTracks()[0].stop();
45 stream1.getVideoTracks()[0].stop();
46 chrome.test.succeed();
47 });
48 });
49 });
50 });
51 }
52 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698