| OLD | NEW |
| 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 27 matching lines...) Expand all Loading... |
| 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; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Step 4: After the second tab is closed, check that getCapturedTabs() | 47 // Step 4: After the second tab is closed, check that getCapturedTabs() |
| 48 // returns no info at all about the second tab. http://crbug.com/338445 | 48 // returns no info at all about the second tab. |
| 49 chrome.tabs.onRemoved.addListener(function() { | 49 chrome.tabs.onRemoved.addListener(function() { |
| 50 tabCapture.getCapturedTabs(function checkNoInfos(infos) { | 50 tabCapture.getCapturedTabs(function checkNoInfos(infos) { |
| 51 checkInfoForSecondTabHasStatus(infos, null); | 51 checkInfoForSecondTabHasStatus(infos, null); |
| 52 chrome.test.succeed(); | 52 chrome.test.succeed(); |
| 53 }); | 53 }); |
| 54 }); | 54 }); |
| 55 | 55 |
| 56 var activeStream = null; | 56 var activeStream = null; |
| 57 | 57 |
| 58 // Step 3: After the stream is stopped, check that getCapturedTabs() | 58 // Step 3: After the stream is stopped, check that getCapturedTabs() |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 }, | 98 }, |
| 99 | 99 |
| 100 function onlyVideo() { | 100 function onlyVideo() { |
| 101 tabCapture.capture({video: true}, function(stream) { | 101 tabCapture.capture({video: true}, function(stream) { |
| 102 chrome.test.assertTrue(!!stream); | 102 chrome.test.assertTrue(!!stream); |
| 103 stream.stop(); | 103 stream.stop(); |
| 104 chrome.test.succeed(); | 104 chrome.test.succeed(); |
| 105 }); | 105 }); |
| 106 }, | 106 }, |
| 107 | 107 |
| 108 function onlyAudio() { |
| 109 tabCapture.capture({audio: true}, function(stream) { |
| 110 chrome.test.assertTrue(!!stream); |
| 111 stream.stop(); |
| 112 chrome.test.succeed(); |
| 113 }); |
| 114 }, |
| 115 |
| 108 function noAudioOrVideoRequested() { | 116 function noAudioOrVideoRequested() { |
| 109 // If not specified, video is not requested. | 117 // If not specified, video is not requested. |
| 110 tabCapture.capture({audio: false}, function(stream) { | 118 tabCapture.capture({audio: false}, function(stream) { |
| 111 chrome.test.assertTrue(!stream); | 119 chrome.test.assertTrue(!stream); |
| 112 chrome.test.succeed(); | 120 chrome.test.succeed(); |
| 113 }); | 121 }); |
| 114 } | 122 } |
| 115 | |
| 116 ]); | 123 ]); |
| OLD | NEW |