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

Side by Side Diff: chrome/test/data/extensions/platform_apps/windows_api/test.js

Issue 11362003: Make app windows restore position even if bounds are explicitly specified. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var callbackPass = chrome.test.callbackPass; 5 var callbackPass = chrome.test.callbackPass;
6 6
7 chrome.app.runtime.onLaunched.addListener(function() { 7 chrome.app.runtime.onLaunched.addListener(function() {
8 chrome.test.runTests([ 8 chrome.test.runTests([
9 function testCreateWindow() { 9 function testCreateWindow() {
10 chrome.app.window.create('test.html', 10 chrome.app.window.create('test.html',
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 function testContentSize() { 61 function testContentSize() {
62 chrome.app.window.create('test.html', 62 chrome.app.window.create('test.html',
63 {width: 250, height: 200}, callbackPass(function(win) { 63 {width: 250, height: 200}, callbackPass(function(win) {
64 chrome.test.assertEq(250, win.contentWindow.innerWidth); 64 chrome.test.assertEq(250, win.contentWindow.innerWidth);
65 chrome.test.assertEq(200, win.contentWindow.innerHeight); 65 chrome.test.assertEq(200, win.contentWindow.innerHeight);
66 win.close(); 66 win.close();
67 })); 67 }));
68 }, 68 },
69 69
70 function testRestoreBounds() {
71 chrome.app.window.create('test.html',
72 {id: 'test_window', left: 20, height: 20, width: 250, height: 200},
73 callbackPass(function(win) {
74 chrome.test.assertEq(250, win.contentWindow.innerWidth);
75 chrome.test.assertEq(200, win.contentWindow.innerHeight);
76 // TODO(jeremya): use setBounds() here when available instead of DOM
77 // methods.
78 win.contentWindow.moveTo(50, 50);
79 win.contentWindow.resizeTo(500, 250);
80 win.close();
81 chrome.app.window.create('test.html',
82 {id: 'test_window', left: 20, height: 20, width: 250, height: 200},
83 callbackPass(function(win) {
84 // TODO(jeremya): also check that the position has been restored once
85 // getBounds() is available.
86 chrome.test.assertEq(500, win.contentWindow.innerWidth);
87 chrome.test.assertEq(250, win.contentWindow.innerHeight);
88 win.close();
89 }));
90 }));
91 },
92
70 function testUpdateWindowWidth() { 93 function testUpdateWindowWidth() {
71 chrome.app.window.create('test.html', 94 chrome.app.window.create('test.html',
72 {width:512, height:384, frame:'none'}, 95 {width:512, height:384, frame:'none'},
73 callbackPass(function(win) { 96 callbackPass(function(win) {
74 chrome.test.assertEq(512, win.contentWindow.innerWidth); 97 chrome.test.assertEq(512, win.contentWindow.innerWidth);
75 chrome.test.assertEq(384, win.contentWindow.innerHeight); 98 chrome.test.assertEq(384, win.contentWindow.innerHeight);
76 var oldWidth = win.contentWindow.outerWidth; 99 var oldWidth = win.contentWindow.outerWidth;
77 var oldHeight = win.contentWindow.outerHeight; 100 var oldHeight = win.contentWindow.outerHeight;
78 win.contentWindow.resizeBy(-256, 0); 101 win.contentWindow.resizeBy(-256, 0);
79 chrome.test.assertEq(oldWidth - 256, win.contentWindow.outerWidth); 102 chrome.test.assertEq(oldWidth - 256, win.contentWindow.outerWidth);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 chrome.test.assertEq(oldHeight, win.innerHeight); 146 chrome.test.assertEq(oldHeight, win.innerHeight);
124 }); 147 });
125 }) 148 })
126 win.chrome.app.window.restore(); 149 win.chrome.app.window.restore();
127 }); 150 });
128 win.chrome.app.window.maximize(); 151 win.chrome.app.window.maximize();
129 })); 152 }));
130 },*/ 153 },*/
131 ]); 154 ]);
132 }); 155 });
OLDNEW
« chrome/common/extensions/api/app_window.idl ('K') | « chrome/common/extensions/api/app_window.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698