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

Unified Diff: chrome/test/data/extensions/api_test/app_background_page/common/c.html

Issue 8116015: Now closes existing background contents if app opens a new one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comment. Created 9 years, 2 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/app_background_page/common/c.html
diff --git a/chrome/test/data/extensions/api_test/app_background_page/common/c.html b/chrome/test/data/extensions/api_test/app_background_page/common/c.html
new file mode 100644
index 0000000000000000000000000000000000000000..651a0f4b685a285250cd8329c4058bec28a876a6
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/app_background_page/common/c.html
@@ -0,0 +1,31 @@
+<script src="common.js"></script>
+<h1 id="status">Page C</h1>
+<div style="display:none" id="pageToScriptTunnel"></div>
+<div style="display:none" id="scriptToPageTunnel"></div>
+
+<script>
+var backgroundWindow;
+
+window.onload = function() {
+ setupScriptTunnel();
+ // Note we are using a different window name than a.html so this should open
+ // a different background page.
+ backgroundWindow = window.open('bg.html', 'bg2', 'background');
+ if (backgroundWindow) {
+ setStatus('background page opened');
+ } else {
+ notifyBackgroundPagePermissionDenied();
+ setStatus('background page permission denied');
+ }
+}
+
+function onBackgroundPageLoaded() {
+ if (!backgroundWindow.checkAndIncrementCounter(0)) {
+ notifyCounterError();
+ return;
+ }
+
+ setStatus('background page loaded');
+ notifyBackgroundPageLoaded();
+}
+</script>

Powered by Google App Engine
This is Rietveld 408576698