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

Side by Side Diff: chrome/test/data/extensions/api_test/window_update/show_state/test.js

Issue 9181005: Allow resizing a panel using chrome.windows.update() extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add forgotten test file. Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/api_test/window_update/resize/test.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 pass = chrome.test.callbackPass; 5 var pass = chrome.test.callbackPass;
6 6
7 var width = 0; 7 var width = 0;
8 var height = 0; 8 var height = 0;
9 var changedWidth = 500; 9
10 var changedHeight = 500; 10 var deltaWidth = 20;
11 var deltaHeight = 30;
11 12
12 function checkRestoreWithBounds(theWindow) { 13 function checkRestoreWithBounds(theWindow) {
13 chrome.test.assertEq('normal', theWindow.state); 14 chrome.test.assertEq('normal', theWindow.state);
14 if (theWindow.type == 'panel') { 15 chrome.test.assertEq(width, theWindow.width);
15 // Panels decide their own bounds. 16 chrome.test.assertEq(height, theWindow.height);
16 chrome.test.assertEq(width, theWindow.width);
17 chrome.test.assertEq(height, theWindow.height);
18 } else {
19 chrome.test.assertEq(changedWidth, theWindow.width);
20 chrome.test.assertEq(changedHeight, theWindow.height);
21 }
22
23 chrome.windows.remove(theWindow.id, pass()); 17 chrome.windows.remove(theWindow.id, pass());
24 } 18 }
25 19
26 function checkMaximized(theWindow) { 20 function checkMaximized(theWindow) {
27 if (theWindow.type == 'panel') { 21 if (theWindow.type == 'panel') {
28 // Maximize is the same as restore for panels. 22 // Maximize is the same as restore for panels.
29 chrome.test.assertEq('normal', theWindow.state); 23 chrome.test.assertEq('normal', theWindow.state);
30 chrome.test.assertEq(width, theWindow.width); 24 chrome.test.assertEq(width, theWindow.width);
31 chrome.test.assertEq(height, theWindow.height); 25 chrome.test.assertEq(height, theWindow.height);
32 } else { 26 } else {
33 chrome.test.assertEq('maximized', theWindow.state); 27 chrome.test.assertEq('maximized', theWindow.state);
34 chrome.test.assertTrue(width < theWindow.width || 28 chrome.test.assertTrue(width < theWindow.width ||
35 height < theWindow.height); 29 height < theWindow.height);
36 } 30 }
37 31
32 width += deltaWidth;
33 height += deltaHeight;
38 chrome.windows.update(theWindow.id, 34 chrome.windows.update(theWindow.id,
39 {'state': 'normal', width: changedWidth, height: changedHeight}, 35 {'state': 'normal', 'width': width, 'height': height},
40 pass(checkRestoreWithBounds)); 36 pass(checkRestoreWithBounds));
41 } 37 }
42 38
43 function checkRestored(theWindow) { 39 function checkRestored(theWindow) {
44 chrome.test.assertEq('normal', theWindow.state); 40 chrome.test.assertEq('normal', theWindow.state);
45 chrome.test.assertEq(width, theWindow.width); 41 chrome.test.assertEq(width, theWindow.width);
46 chrome.test.assertEq(height, theWindow.height); 42 chrome.test.assertEq(height, theWindow.height);
47 43
48 chrome.windows.update(theWindow.id, {'state': 'maximized'}, pass(checkMaximize d)); 44 chrome.windows.update(theWindow.id, {'state': 'maximized'}, pass(checkMaximize d));
49 } 45 }
(...skipping 21 matching lines...) Expand all
71 function changeWindowState() { 67 function changeWindowState() {
72 testWindowState('normal'); 68 testWindowState('normal');
73 }, 69 },
74 function changePopupWindowState() { 70 function changePopupWindowState() {
75 testWindowState('popup'); 71 testWindowState('popup');
76 }, 72 },
77 function changePanelWindowState() { 73 function changePanelWindowState() {
78 testWindowState('panel'); 74 testWindowState('panel');
79 } 75 }
80 ]); 76 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/window_update/resize/test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698