| Index: chrome/test/data/extensions/api_test/tab_capture/api_tests.js
|
| diff --git a/chrome/test/data/extensions/api_test/tab_capture/api_tests.js b/chrome/test/data/extensions/api_test/tab_capture/api_tests.js
|
| index 1efad1de61f8b4b295784fc716fc78dd0ef11a35..c55e8f60cc3875999a9392c50e58d97be49de27a 100644
|
| --- a/chrome/test/data/extensions/api_test/tab_capture/api_tests.js
|
| +++ b/chrome/test/data/extensions/api_test/tab_capture/api_tests.js
|
| @@ -4,6 +4,21 @@
|
|
|
| var tabCapture = chrome.tabCapture;
|
|
|
| +var helloWorldPageUri = 'data:text/html;charset=UTF-8,' +
|
| + encodeURIComponent('<html><body>Hello world!</body></html>');
|
| +
|
| +function assertIsSameSetOfTabs(list_a, list_b, id_field_name) {
|
| + chrome.test.assertEq(list_a.length, list_b.length);
|
| + function tabIdSortFunction(a, b) {
|
| + return (a[id_field_name] || 0) - (b[id_field_name] || 0);
|
| + }
|
| + list_a.sort(tabIdSortFunction);
|
| + list_b.sort(tabIdSortFunction);
|
| + for (var i = 0, end = list_a.length; i < end; ++i) {
|
| + chrome.test.assertEq(list_a[i][id_field_name], list_b[i][id_field_name]);
|
| + }
|
| +}
|
| +
|
| chrome.test.runTests([
|
| function captureTabAndVerifyStateTransitions() {
|
| // Tab capture events in the order they happen.
|
| @@ -144,5 +159,37 @@ chrome.test.runTests([
|
| chrome.test.assertTrue(!stream);
|
| chrome.test.succeed();
|
| });
|
| + },
|
| +
|
| + function offscreenTabsDoNotShowUpAsCapturedTabs() {
|
| + tabCapture.getCapturedTabs(function(tab_list_before) {
|
| + tabCapture.captureOffscreenTab(
|
| + helloWorldPageUri,
|
| + {video: true},
|
| + function(stream) {
|
| + chrome.test.assertTrue(!!stream);
|
| + tabCapture.getCapturedTabs(function(tab_list_after) {
|
| + assertIsSameSetOfTabs(tab_list_before, tab_list_after, 'tabId');
|
| + stream.getVideoTracks()[0].stop();
|
| + chrome.test.succeed();
|
| + });
|
| + });
|
| + });
|
| + },
|
| +
|
| + function offscreenTabsDoNotShowUpInTabsQuery() {
|
| + chrome.tabs.query({/* all tabs */}, function(tab_list_before) {
|
| + tabCapture.captureOffscreenTab(
|
| + helloWorldPageUri,
|
| + {video: true},
|
| + function(stream) {
|
| + chrome.test.assertTrue(!!stream);
|
| + chrome.tabs.query({/* all tabs */}, function(tab_list_after) {
|
| + assertIsSameSetOfTabs(tab_list_before, tab_list_after, 'id');
|
| + stream.getVideoTracks()[0].stop();
|
| + chrome.test.succeed();
|
| + });
|
| + });
|
| + });
|
| }
|
| ]);
|
|
|