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

Unified Diff: chrome/test/data/extensions/api_test/tab_capture/max_offscreen_tabs.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: Revert to only whitelisted extension use. Created 5 years, 3 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/max_offscreen_tabs.js
diff --git a/chrome/test/data/extensions/api_test/tab_capture/max_offscreen_tabs.js b/chrome/test/data/extensions/api_test/tab_capture/max_offscreen_tabs.js
new file mode 100644
index 0000000000000000000000000000000000000000..86a035f175ae69e5a6cd3ca3e60cccc961b361fe
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tab_capture/max_offscreen_tabs.js
@@ -0,0 +1,52 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var tabCapture = chrome.tabCapture;
+
+var helloWorldPageUri = 'data:text/html;charset=UTF-8,' +
+ encodeURIComponent('<html><body>Hello world!</body></html>');
+
+chrome.test.runTests([
+ function canOpenUpToThreeOffscreenTabs() {
+ tabCapture.captureOffscreenTab(
+ helloWorldPageUri,
+ {video: true},
+ function(stream1) {
+ // 1st off-screen tab capture should succeed.
+ chrome.test.assertTrue(!!stream1);
+ if (!stream1) return;
+
+ tabCapture.captureOffscreenTab(
+ helloWorldPageUri,
+ {video: true},
+ function(stream2) {
+ // 2nd off-screen tab capture should succeed.
+ chrome.test.assertTrue(!!stream2);
+ if (!stream2) return;
imcheng 2015/09/29 01:28:56 You'd have to stop stream1 before returning, right
miu 2015/09/30 19:46:38 Not really, but that *would* be cleaner. I rewrot
+
+ tabCapture.captureOffscreenTab(
+ helloWorldPageUri,
+ {video: true},
+ function(stream3) {
+ // 3rd off-screen tab capture should succeed.
+ chrome.test.assertTrue(!!stream3);
+ if (!stream3) return;
+
+ tabCapture.captureOffscreenTab(
+ helloWorldPageUri,
+ {video: true},
+ function(stream4) {
+ // 4th off-screen tab capture should fail.
+ chrome.test.assertFalse(!!stream4);
+
+ stream3.getVideoTracks()[0].stop();
+ stream2.getVideoTracks()[0].stop();
+ stream1.getVideoTracks()[0].stop();
+ chrome.test.succeed();
+ });
+ });
+ });
+ });
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698