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 8f3e1d168ffaf9d2717c2d1ad3448292348cdd90..96c619cb1a9a7e7a6e157f8d78d55062d3bab156 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,9 @@ |
var tabCapture = chrome.tabCapture; |
+var helloWorldPageUri = 'data:text/html;charset=UTF-8,' + |
+ encodeURIComponent('<html><body>Hello world!</body></html>'); |
+ |
chrome.test.runTests([ |
function captureTabAndVerifyStateTransitions() { |
// Tab capture events in the order they happen. |
@@ -119,5 +122,64 @@ chrome.test.runTests([ |
chrome.test.assertTrue(!stream); |
chrome.test.succeed(); |
}); |
+ }, |
+ |
+ function offscreenTabsDoNotShowUpAsCapturedTabs() { |
+ tabCapture.getCapturedTabs(function(captured_tabs_without_pres) { |
+ tabCapture.capturePresentation( |
+ helloWorldPageUri, |
+ "puppies", |
+ {video: true}, |
+ function(stream) { |
+ chrome.test.assertTrue(!!stream); |
+ tabCapture.getCapturedTabs(function(captured_tabs) { |
+ // Confirm that the same set of tabs is present (no more, no |
+ // less). |
+ chrome.test.assertEq(captured_tabs_without_pres.length, |
Kevin M
2015/06/29 22:17:02
Consider comparing the stringified arrays instead,
miu
2015/06/30 04:09:59
Done.
|
+ captured_tabs.length); |
+ function tabIdSortFunction(a, b) { |
+ return (a.tabId || 0) - (b.tabId || 0); |
+ } |
+ captured_tabs_without_pres.sort(tabIdSortFunction); |
+ captured_tabs.sort(tabIdSortFunction); |
+ for (var i = 0, end = captured_tabs.length; i < end; ++i) { |
+ chrome.test.assertEq(captured_tabs_without_pres[i], |
+ captured_tabs[i]); |
+ } |
+ |
+ stream.stop(); |
+ chrome.test.succeed(); |
+ }); |
+ }); |
+ }); |
+ }, |
+ |
+ function offscreenTabsDoNotShowUpInTabsQuery() { |
+ chrome.tabs.query({/* all tabs */}, function(first_tab_list) { |
+ tabCapture.capturePresentation( |
+ helloWorldPageUri, |
+ 'kittens', |
+ {video: true}, |
+ function(stream) { |
+ chrome.test.assertTrue(!!stream); |
+ chrome.tabs.query({/* all tabs */}, function(second_tab_list) { |
+ // Confirm that the same set of tabs is present (no more, no |
+ // less). |
+ chrome.test.assertEq(first_tab_list.length, |
+ second_tab_list.length); |
+ function tabIdSortFunction(a, b) { |
+ return (a.id || 0) - (b.id || 0); |
+ } |
+ first_tab_list.sort(tabIdSortFunction); |
+ second_tab_list.sort(tabIdSortFunction); |
+ for (var i = 0, end = first_tab_list.length; i < end; ++i) { |
+ chrome.test.assertEq(first_tab_list[i], second_tab_list[i]); |
+ } |
+ |
+ stream.stop(); |
+ chrome.test.succeed(); |
+ }); |
+ }); |
+ }); |
} |
]); |