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.capturePresentation( |
| 13 helloWorldPageUri, |
| 14 '1st', |
| 15 {video: true}, |
| 16 function(stream1) { |
| 17 // 1st presentation capture should succeed. |
| 18 chrome.test.assertTrue(!!stream1); |
| 19 if (!stream1) return; |
| 20 |
| 21 tabCapture.capturePresentation( |
| 22 helloWorldPageUri, |
| 23 '2nd', |
| 24 {video: true}, |
| 25 function(stream2) { |
| 26 // 2nd presentation capture should succeed. |
| 27 chrome.test.assertTrue(!!stream2); |
| 28 if (!stream2) return; |
| 29 |
| 30 tabCapture.capturePresentation( |
| 31 helloWorldPageUri, |
| 32 '3rd', |
| 33 {video: true}, |
| 34 function(stream3) { |
| 35 // 3rd presentation capture should succeed. |
| 36 chrome.test.assertTrue(!!stream3); |
| 37 if (!stream3) return; |
| 38 |
| 39 tabCapture.capturePresentation( |
| 40 helloWorldPageUri, |
| 41 '4th', |
| 42 {video: true}, |
| 43 function(stream4) { |
| 44 // 4th presentation capture should fail. |
| 45 chrome.test.assertFalse(!!stream4); |
| 46 |
| 47 stream3.stop(); |
| 48 stream2.stop(); |
| 49 stream1.stop(); |
| 50 chrome.test.succeed(); |
| 51 }); |
| 52 }); |
| 53 }); |
| 54 }); |
| 55 } |
| 56 ]); |
OLD | NEW |