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

Unified Diff: chrome/test/data/extensions/api_test/popup/toolband.html

Issue 2003016: Disallow display of multiple experimental.extension.popup(...) windows ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 7 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
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | chrome/test/data/extensions/api_test/popup/toolband_popup_a.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/popup/toolband.html
===================================================================
--- chrome/test/data/extensions/api_test/popup/toolband.html (revision 47023)
+++ chrome/test/data/extensions/api_test/popup/toolband.html (working copy)
@@ -111,8 +111,7 @@
},
function popupBlackBorder() {
// Ensure that the test waits until the popup is dismissed.
- chrome.test.listenOnce(chrome.experimental.popup.onClosed,
- function() {});
+ chrome.test.listenOnce(chrome.experimental.popup.onClosed);
// Validate that displaying a pop-up with a black border still invokes
// the callback successfully. Note that this test does not validate
@@ -127,6 +126,62 @@
chrome.experimental.extension.getPopupView().close();
}));
},
+ function disallowMultiplePopups() {
+ // This test ensures that for a given extension with a popup displayed,
+ // displaying a subsequent popup will dismiss the first.
+ var showDetails1 = {
+ "relativeTo": document.getElementById("anchorHere"),
+ };
+
+ var showDetails2 = {
+ "relativeTo": document.getElementById("anchorHere2"),
+ "borderStyle": "rectangle"
+ };
+
+ // Track the number of popups opened and closed, so that we can signal
+ // the test as completed when appropriate.
+ var numberClosed = 0;
+ var doneListening = chrome.test.listenForever(
+ chrome.experimental.popup.onClosed,
+ function() {
+ // This test expects to open and close two popups, so signify that
+ // the test has succeeded, after closing the second popup.
+ if (++numberClosed == 2) {
+ doneListening();
+ }
+ });
+
+ chrome.experimental.popup.show("toolband_popup_a.html",
+ showDetails1,
+ function() {
+ // Validate that the popup view returned is the one we expect.
+ chrome.test.assertEq(
+ 'a',
+ chrome.experimental.extension.getPopupView().getIdentity());
+
+ // Ensure that only one popup is open.
+ chrome.test.assertEq(
+ 1,
+ chrome.extension.getViews({type: "popup"}).length);
+
+ chrome.experimental.popup.show("toolband_popup_b.html",
+ showDetails2,
+ function() {
+ // Validate that the first popup view is fully closed, and that
+ // getPopupView returns the most recently opened popup.
+ chrome.test.assertEq(
+ 'b',
+ chrome.experimental.extension.getPopupView().getIdentity());
+
+ // Ensure that only one popup is open.
+ chrome.test.assertEq(
+ 1,
+ chrome.extension.getViews({type: 'popup'}).length);
+
+ chrome.experimental.extension.getPopupView().close();
+ });
+ });
+ },
function popupChromeSizing() {
// Ensure that the test waits until the popup is dismissed.
chrome.test.listenOnce(chrome.experimental.popup.onClosed);
@@ -159,9 +214,12 @@
</script>
</head>
<body>
-<div>
-<span id="anchorHere">TEST</span>
+<div id="anchorHere">
+<span>TEST</span>
</div>
+<div id="anchorHere2">
+<span>TESTING 2</span>
+</div>
<form>
<input id="entryForm" onfocus="onFormFocused();" onblur="onFormBlurred();"/>
</form>
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | chrome/test/data/extensions/api_test/popup/toolband_popup_a.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698