| Index: chrome/test/data/extensions/platform_apps/windows_api/test.js
|
| diff --git a/chrome/test/data/extensions/platform_apps/windows_api/test.js b/chrome/test/data/extensions/platform_apps/windows_api/test.js
|
| index 442eb20aea5cf97dbaedb2e3392882a67c5e5e88..7f6b534986c4680a93e6e0b3f77eb91f760c8754 100644
|
| --- a/chrome/test/data/extensions/platform_apps/windows_api/test.js
|
| +++ b/chrome/test/data/extensions/platform_apps/windows_api/test.js
|
| @@ -129,6 +129,110 @@ chrome.app.runtime.onLaunched.addListener(function() {
|
| }));
|
| },
|
|
|
| + function testChangingMinAndMaxSize() {
|
| + chrome.app.window.create('test.html', {
|
| + bounds: { width: 102, height: 103 },
|
| + minWidth: 100, minHeight: 101,
|
| + maxWidth: 104, maxHeight: 105
|
| + }, callbackPass(function(win) {
|
| + chrome.test.assertEq(100, win.getMinWidth());
|
| + chrome.test.assertEq(101, win.getMinHeight());
|
| + chrome.test.assertEq(104, win.getMaxWidth());
|
| + chrome.test.assertEq(105, win.getMaxHeight());
|
| + win.setMinWidth(98);
|
| + win.setMinHeight(99);
|
| + win.setMaxWidth(106);
|
| + win.setMaxHeight(107);
|
| + // We need to wait for an onBoundsChanged to ensure the size has been
|
| + // updated.
|
| + win.setBounds({ width: 103, height: 102 });
|
| + var cb;
|
| + win.onBoundsChanged.addListener(cb = callbackPass(function() {
|
| + chrome.test.assertEq(98, win.getMinWidth());
|
| + chrome.test.assertEq(99, win.getMinHeight());
|
| + chrome.test.assertEq(106, win.getMaxWidth());
|
| + chrome.test.assertEq(107, win.getMaxHeight());
|
| + win.close();
|
| + }));
|
| + }));
|
| + },
|
| +
|
| + function testMinWidthLargerThanMaxWidth() {
|
| + chrome.app.window.create('test.html', {
|
| + bounds: { width: 102, height: 103 },
|
| + minWidth: 100, minHeight: 101,
|
| + maxWidth: 104, maxHeight: 105
|
| + }, callbackPass(function(win) {
|
| + win.setMinWidth(200);
|
| + // An onBoundsChanged will be fired because this resizes the window.
|
| + var cb;
|
| + win.onBoundsChanged.addListener(cb = callbackPass(function() {
|
| + chrome.test.assertEq(200, win.getMinWidth());
|
| + chrome.test.assertEq(101, win.getMinHeight());
|
| + chrome.test.assertEq(200, win.getMaxWidth());
|
| + chrome.test.assertEq(105, win.getMaxHeight());
|
| + win.close();
|
| + }));
|
| + }));
|
| + },
|
| +
|
| + function testMinHeightLargerThanMaxHeight() {
|
| + chrome.app.window.create('test.html', {
|
| + bounds: { width: 102, height: 103 },
|
| + minWidth: 100, minHeight: 101,
|
| + maxWidth: 104, maxHeight: 105
|
| + }, callbackPass(function(win) {
|
| + win.setMinHeight(200);
|
| + // An onBoundsChanged will be fired because this resizes the window.
|
| + var cb;
|
| + win.onBoundsChanged.addListener(cb = callbackPass(function() {
|
| + chrome.test.assertEq(100, win.getMinWidth());
|
| + chrome.test.assertEq(200, win.getMinHeight());
|
| + chrome.test.assertEq(104, win.getMaxWidth());
|
| + chrome.test.assertEq(200, win.getMaxHeight());
|
| + win.close();
|
| + }));
|
| + }));
|
| + },
|
| +
|
| + function testMaxWidthSmallerThanMinWidth() {
|
| + chrome.app.window.create('test.html', {
|
| + bounds: { width: 102, height: 103 },
|
| + minWidth: 100, minHeight: 101,
|
| + maxWidth: 104, maxHeight: 105
|
| + }, callbackPass(function(win) {
|
| + win.setMaxWidth(50);
|
| + // An onBoundsChanged will be fired because this resizes the window.
|
| + var cb;
|
| + win.onBoundsChanged.addListener(cb = callbackPass(function() {
|
| + chrome.test.assertEq(100, win.getMinWidth());
|
| + chrome.test.assertEq(101, win.getMinHeight());
|
| + chrome.test.assertEq(100, win.getMaxWidth());
|
| + chrome.test.assertEq(105, win.getMaxHeight());
|
| + win.close();
|
| + }));
|
| + }));
|
| + },
|
| +
|
| + function testMaxHeightSmallerThanMinHeight() {
|
| + chrome.app.window.create('test.html', {
|
| + bounds: { width: 102, height: 103 },
|
| + minWidth: 100, minHeight: 101,
|
| + maxWidth: 104, maxHeight: 105
|
| + }, callbackPass(function(win) {
|
| + win.setMaxHeight(50);
|
| + // An onBoundsChanged will be fired because this resizes the window.
|
| + var cb;
|
| + win.onBoundsChanged.addListener(cb = callbackPass(function() {
|
| + chrome.test.assertEq(100, win.getMinWidth());
|
| + chrome.test.assertEq(101, win.getMinHeight());
|
| + chrome.test.assertEq(104, win.getMaxWidth());
|
| + chrome.test.assertEq(101, win.getMaxHeight());
|
| + win.close();
|
| + }));
|
| + }));
|
| + },
|
| +
|
| function testMinSizeRestore() {
|
| chrome.app.window.create('test.html', {
|
| bounds: { width: 100, height: 150 },
|
|
|