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

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

Issue 8586045: Add extension API to change window show state using chrome.windows.update(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced Created 9 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
« no previous file with comments | « chrome/test/data/extensions/api_test/window_update/show_state/manifest.json ('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
(Empty)
1 <script>
2 var pass = chrome.test.callbackPass;
3
4 var width = 0;
5 var height = 0;
6 var changedWidth = 500;
7 var changedHeight = 500;
8
9 function checkRestoreWithBounds(theWindow) {
10 chrome.test.assertEq('normal', theWindow.state);
11 if (theWindow.type == 'panel') {
12 // Panels decide their own bounds.
13 chrome.test.assertEq(width, theWindow.width);
14 chrome.test.assertEq(height, theWindow.height);
15 } else {
16 chrome.test.assertEq(changedWidth, theWindow.width);
17 chrome.test.assertEq(changedHeight, theWindow.height);
18 }
19
20 chrome.windows.remove(theWindow.id, pass());
21 }
22
23 function checkMaximized(theWindow) {
24 if (theWindow.type == 'panel') {
25 // Maximize is the same as restore for panels.
26 chrome.test.assertEq('normal', theWindow.state);
27 chrome.test.assertEq(width, theWindow.width);
28 chrome.test.assertEq(height, theWindow.height);
29 } else {
30 chrome.test.assertEq('maximized', theWindow.state);
31 chrome.test.assertTrue(width < theWindow.width ||
32 height < theWindow.height);
33 }
34
35 chrome.windows.update(theWindow.id,
36 {'state': 'normal', width: changedWidth, height: changedHeight},
37 pass(checkRestoreWithBounds));
38 }
39
40 function checkRestored(theWindow) {
41 chrome.test.assertEq('normal', theWindow.state);
42 chrome.test.assertEq(width, theWindow.width);
43 chrome.test.assertEq(height, theWindow.height);
44
45 chrome.windows.update(theWindow.id, {'state': 'maximized'}, pass(checkMaximize d));
46 }
47
48 function checkMinimized(theWindow) {
49 chrome.test.assertEq('minimized', theWindow.state);
50 chrome.windows.update(theWindow.id, {'state': 'normal'}, pass(checkRestored));
51 }
52
53 function minimizeWindow(theWindow) {
54 chrome.test.assertEq('normal', theWindow.state);
55 width = theWindow.width;
56 height = theWindow.height;
57 chrome.windows.update(theWindow.id, {'state': 'minimized'}, pass(checkMinimize d));
58 }
59
60 function testWindowState(windowType) {
61 chrome.windows.create({'url': 'hello.html', 'type': windowType},
62 pass(minimizeWindow));
63 }
64
65 chrome.test.runTests([
66 function changeWindowState() {
67 testWindowState('normal');
68 },
69 function changePopupWindowState() {
70 testWindowState('popup');
71 },
72 function changePanelWindowState() {
73 testWindowState('panel');
74 }
75 ]);
76 </script>
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/window_update/show_state/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698