Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9591)

Unified Diff: chrome/test/data/extensions/api_test/tab_capture/api_tests.js

Issue 1221483002: New tabCapture.captureOffscreenTab API, initially for Presentation API 1UA mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
+ });
+ });
+ });
}
]);

Powered by Google App Engine
This is Rietveld 408576698