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

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

Issue 9328037: Add fullscreen state support for chrome.windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small fix Created 8 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 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 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 9
10 var deltaWidth = 20; 10 var deltaWidth = 20;
11 var deltaHeight = 30; 11 var deltaHeight = 30;
12 12
13 function checkRestoreWithBounds(theWindow) { 13 function checkRestoreWithBounds(theWindow) {
14 chrome.test.assertEq('normal', theWindow.state); 14 chrome.test.assertEq('normal', theWindow.state);
15 chrome.test.assertEq(width, theWindow.width); 15 chrome.test.assertEq(width, theWindow.width);
16 chrome.test.assertEq(height, theWindow.height); 16 chrome.test.assertEq(height, theWindow.height);
17 chrome.windows.remove(theWindow.id, pass()); 17 chrome.windows.remove(theWindow.id, pass());
18 } 18 }
19 19
20 function checkFullscreen(theWindow) {
21 chrome.test.assertEq('fullscreen', theWindow.state);
22 chrome.test.assertTrue(width < theWindow.width || height < theWindow.height);
23
24 width += deltaWidth;
25 height += deltaHeight;
26 chrome.windows.update(theWindow.id,
27 {'state': 'normal', 'width': width, 'height': height},
28 pass(checkRestoreWithBounds));
29 }
30
20 function checkMaximized(theWindow) { 31 function checkMaximized(theWindow) {
21 if (theWindow.type == 'panel') { 32 if (theWindow.type == 'panel') {
22 // Maximize is the same as restore for panels. 33 // Maximize is the same as restore for panels.
23 chrome.test.assertEq('normal', theWindow.state); 34 chrome.test.assertEq('normal', theWindow.state);
24 chrome.test.assertEq(width, theWindow.width); 35 chrome.test.assertEq(width, theWindow.width);
25 chrome.test.assertEq(height, theWindow.height); 36 chrome.test.assertEq(height, theWindow.height);
37
38 width += deltaWidth;
39 height += deltaHeight;
40 chrome.windows.update(theWindow.id,
41 {'state': 'normal', 'width': width, 'height': height},
42 pass(checkRestoreWithBounds));
jennb 2012/02/06 23:34:25 Instead of having this special test path for panel
hashimoto 2012/02/07 02:16:00 Done. I made no assertion for panels because Pane
26 } else { 43 } else {
27 chrome.test.assertEq('maximized', theWindow.state); 44 chrome.test.assertEq('maximized', theWindow.state);
28 chrome.test.assertTrue(width < theWindow.width || 45 chrome.test.assertTrue(width < theWindow.width ||
29 height < theWindow.height); 46 height < theWindow.height);
47
48 chrome.windows.update(theWindow.id, {'state': 'fullscreen'},
49 pass(checkFullscreen));
30 } 50 }
31
32 width += deltaWidth;
33 height += deltaHeight;
34 chrome.windows.update(theWindow.id,
35 {'state': 'normal', 'width': width, 'height': height},
36 pass(checkRestoreWithBounds));
37 } 51 }
38 52
39 function checkRestored(theWindow) { 53 function checkRestored(theWindow) {
40 chrome.test.assertEq('normal', theWindow.state); 54 chrome.test.assertEq('normal', theWindow.state);
41 chrome.test.assertEq(width, theWindow.width); 55 chrome.test.assertEq(width, theWindow.width);
42 chrome.test.assertEq(height, theWindow.height); 56 chrome.test.assertEq(height, theWindow.height);
43 57
44 chrome.windows.update(theWindow.id, {'state': 'maximized'}, pass(checkMaximize d)); 58 chrome.windows.update(theWindow.id, {'state': 'maximized'}, pass(checkMaximize d));
45 } 59 }
46 60
(...skipping 20 matching lines...) Expand all
67 function changeWindowState() { 81 function changeWindowState() {
68 testWindowState('normal'); 82 testWindowState('normal');
69 }, 83 },
70 function changePopupWindowState() { 84 function changePopupWindowState() {
71 testWindowState('popup'); 85 testWindowState('popup');
72 }, 86 },
73 function changePanelWindowState() { 87 function changePanelWindowState() {
74 testWindowState('panel'); 88 testWindowState('panel');
75 } 89 }
76 ]); 90 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698