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

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

Issue 6334101: Removal of chrome.experimental.popup set of APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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/popup/popup_main/dom_ui_popup_sizing.html
===================================================================
--- chrome/test/data/extensions/api_test/popup/popup_main/dom_ui_popup_sizing.html (revision 74596)
+++ chrome/test/data/extensions/api_test/popup/popup_main/dom_ui_popup_sizing.html (working copy)
@@ -1,112 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<script>
-// Returns the current size of the popup view.
-function getCurrentWindowSize() {
- return {
- "width": window.outerWidth,
- "height": window.outerHeight
- };
-}
-
-// Returns the current bounds of the displayed popup view.
-function getCurrentWindowBounds() {
- var windowSize = getCurrentWindowSize();
- return {
- "top": window.screenTop,
- "left": window.screenLeft,
- "width": windowSize.width,
- "height": windowSize.height
- };
-}
-
-// Utility that captures the size of the popup window before and after a browser
-// move and notifies the test's parent view of the respective sizes.
-function doSizingValidation() {
- var initialSize = getCurrentWindowBounds();
-
- // Move the browser, and ensure that the popup is repositioned correctly,
- // and retains its proper size.
- var offset = {'x': 5, 'y': 5};
- chrome.windows.getCurrent(function(browserWindow) {
- chrome.windows.update(browserWindow.id,
- {
- "left": browserWindow.left + offset.x,
- "top": browserWindow.top + offset.y
- },
- function(UpdatedWindow) {
- // Yield so that the window move notification may be processed before
- // invoking the callback. This is required because chrome.windows.update
- // calls its callback in a race with the windows message that repositions
- // the browser.
- // TODO: Fix this race condition so that the update callback is invoked
- // after all of the update machinery has been invoked.
- var updatePoller = setInterval(function() {
- var newPosition = getCurrentWindowBounds();
- if (newPosition.top != initialSize.top) {
- clearInterval(updatePoller);
- chrome.experimental.popup.getParentWindow().onWindowMoveCompleted(
- offset,
- initialSize,
- newPosition);
- window.close();
- }
- }, 50);
- });
- });
-}
-
-// Tests that resizing of the popup window, via a page-layout change, does not
-// result in a popup window that is larger than the specified maximal size.
-function doMaximalBoundsValidation() {
- var initialSize = getCurrentWindowSize();
-
- // Resize a portion of the page, and pass the resulting window size back
- // to the test host for validation.
- //var resizeDiv = document.getElementById("resizeMe");
- //resizeDiv.style.height = 1024;
- //resizeDiv.style.width = 1024;
- document.body.style.width = 1024;
- document.body.style.height = 1024;
-
- // Give the browser a chance to perform the resize.
- var updatePoller = setInterval(function() {
- var newSize = getCurrentWindowSize();
- if (newSize.width != initialSize.width) {
- clearInterval(updatePoller);
- chrome.experimental.popup.getParentWindow().
- onPopupWindowResizeCompleted(newSize);
- window.close();
- }
- }, 50);
-}
-
-// Invokes a test function based on the value of |test|.
-function runTest(test) {
- if ("doSizingValidation" == test)
- doSizingValidation();
-
- if ("doMaximalBoundsValidation" == test)
- doMaximalBoundsValidation();
-}
-
-window.onload = function() {
- // Delay invocation of the sizing test so that layout of the popup may
- // complete. On windows, onload is called before layout has been performed,
- // so window.screenTop, and the other fields used in getCurrentWindowSize will
- // return 0 until the layout has been performed.
- // TODO(twiz@chromium.org): Fix the order of the onload and layout processing.
- var positionPoller = setInterval(function() {
- var initialSize = getCurrentWindowSize();
- if (initialSize.width != 0) {
- clearInterval(positionPoller);
- runTest(chrome.experimental.popup.getParentWindow().currentTest);
- }
- }, 50);
-}
-</script>
-</head>
-<body style='width:128px; height:128px'>
-Testing Popup Sizing
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698