| 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>
|
|
|