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

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

Issue 5254007: Addition of 'maxSize' to experimental popup extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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/popup/popup_main/dom_ui.html
===================================================================
--- chrome/test/data/extensions/api_test/popup/popup_main/dom_ui.html (revision 67311)
+++ chrome/test/data/extensions/api_test/popup/popup_main/dom_ui.html (working copy)
@@ -5,6 +5,13 @@
// created tabs/views may find this view.
var TESTING_TOKEN = true;
+// Constant storing the maximal size to which the popup may expand in the
+// following tests: popupRectangleMaxBoundsSizing, popupChromeMaxBoundsSizing
+var MAXIMAL_POPUP_SIZE = {
+ "width": 320,
+ "height": 240
+};
+
var globalValue = "I am not 42.";
// Some helper functions that track the focus state of a form on the toolbar.
@@ -17,6 +24,10 @@
formFocused = false;
}
+// Global variable accessed by tests that run in popup views to indicate which
+// suite of tests to execute.
+var currentTest = null;
+
// Callback that validates popup repositioning, and is invoked during execution
// of the following tests:
// popupRectangleSizing and popupChromeSizing.
@@ -32,6 +43,16 @@
"Popup repositioned incorrectly after browser move.");
}
+// Callback invoked upon completion of popup bounds validation tests.
+// |newSize| is the size of the popup window after a resize operation.
+function onPopupWindowResizeCompleted(newSize) {
+ // Note, we do not test for equality because the popup chrome may slightly
+ // boost the size of the popup. For example, the rectangle chrome adds
+ // a pixel to the dimensions of the popup.
+ chrome.test.assertTrue(newSize.width - MAXIMAL_POPUP_SIZE.width <= 2);
+ chrome.test.assertTrue(newSize.height - MAXIMAL_POPUP_SIZE.height <= 2);
+}
+
// Assert function used by tests executed in separate extension views.
// Used by the following test: popupTeardownDismissal
// |value| is value upon which to assert.
@@ -211,6 +232,7 @@
"relativeTo": document.getElementById("anchorHere")
};
+ currentTest = "doSizingValidation";
chrome.experimental.popup.show("dom_ui_popup_sizing.html",
showDetails);
},
@@ -225,9 +247,40 @@
"borderStyle": "rectangle"
};
+ currentTest = "doSizingValidation";
chrome.experimental.popup.show("dom_ui_popup_sizing.html",
showDetails);
},
+ function popupChromeMaxBoundsSizing() {
+ // Ensure that the test waits until the popup is dismissed.
+ chrome.test.listenOnce(chrome.experimental.popup.onClosed);
+
+ // Ensure that popups with a chrome border are repositioned and sized
+ // correctly.
+ var showDetails = {
+ "relativeTo": document.getElementById("anchorHere"),
+ "maxSize": MAXIMAL_POPUP_SIZE
+ };
+
+ currentTest = "doMaximalBoundsValidation";
+ chrome.experimental.popup.show("dom_ui_popup_sizing.html",
+ showDetails);
+ },
+ function popupRectangleMaxBoundsSizing() {
+ // Ensure that the test waits until the popup is dismissed.
+ chrome.test.listenOnce(chrome.experimental.popup.onClosed);
+
+ // Ensure that popups with a rectangle border respects the maximal bounds.
+ var showDetails = {
+ "relativeTo": document.getElementById("anchorHere"),
+ "borderStyle": "rectangle",
+ "maxSize": MAXIMAL_POPUP_SIZE
+ };
+
+ currentTest = "doMaximalBoundsValidation";
+ chrome.experimental.popup.show("dom_ui_popup_sizing.html",
+ showDetails);
+ },
function popupTeardownDismissal() {
// This test verifies that closing of views that launched active popups
// results in a popup dismissal.

Powered by Google App Engine
This is Rietveld 408576698