OLD | NEW |
---|---|
(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 ]); | |
OLD | NEW |