OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 function createCallback(win) { | |
6 chrome.test.assertEq('panel', win.type); | |
7 // Unlike docked panels, detached is not alwaysOnTop. | |
8 chrome.test.assertEq(false, win.alwaysOnTop); | |
9 // Close the detached window to prevent the stacking. | |
10 chrome.windows.remove(win.id, chrome.test.callbackPass()); | |
11 } | |
12 | |
13 chrome.test.runTests([ | |
14 // No origin nor size is specified. | |
15 function openDetachedPanel() { | |
16 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { | |
17 chrome.test.assertEq("panel", window.type); | |
18 chrome.test.assertTrue(!window.incognito); | |
19 chrome.test.assertTrue(window.width > 0); | |
20 chrome.test.assertTrue(window.height > 0); | |
21 }); | |
22 chrome.windows.create( | |
23 { 'url': 'about:blank', | |
24 'type': 'detached_panel' }, | |
25 chrome.test.callbackPass(createCallback)); | |
26 }, | |
27 | |
28 // Verify supplied size is obeyed even if no origin is specified. | |
29 function openDetachedPanelWithSize() { | |
30 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { | |
31 chrome.test.assertEq("panel", window.type); | |
32 chrome.test.assertTrue(!window.incognito); | |
33 chrome.test.assertEq(250, window.width); | |
34 chrome.test.assertEq(200, window.height); | |
35 }); | |
36 // Do not use the big size because the maximium panel sizes are based on a | |
37 // factor of the screen resolution. Some try bots might be configured with | |
38 // 800x600 resolution that causes the panel not to exceed 280x280. | |
39 chrome.windows.create( | |
40 { 'url': 'about:blank', | |
41 'type': 'detached_panel', 'width': 250, 'height': 200 }, | |
42 chrome.test.callbackPass(createCallback)); | |
43 }, | |
44 | |
45 // Verify supplied origin is obeyed even if no size is specified. | |
46 function openDetachedPanelWithOrigin() { | |
47 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { | |
48 chrome.test.assertEq("panel", window.type); | |
49 chrome.test.assertTrue(!window.incognito); | |
50 // The top position could be changed when the stacking mode is enabled. | |
51 //chrome.test.assertEq(42, window.top); | |
52 chrome.test.assertEq(24, window.left); | |
53 chrome.test.assertTrue(window.width > 0); | |
54 chrome.test.assertTrue(window.height > 0); | |
55 }); | |
56 chrome.windows.create( | |
57 { 'url': 'about:blank', | |
58 'type': 'detached_panel', 'top': 42, 'left': 24 }, | |
59 chrome.test.callbackPass(createCallback)); | |
60 }, | |
61 | |
62 // Verify supplied bounds are obeyed. | |
63 function openDetachedPanelWithFullBounds() { | |
64 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { | |
65 chrome.test.assertEq("panel", window.type); | |
66 chrome.test.assertTrue(!window.incognito); | |
67 // The top position could be changed when the stacking mode is enabled. | |
68 //chrome.test.assertEq(42, window.top); | |
69 chrome.test.assertEq(24, window.left); | |
70 chrome.test.assertEq(250, window.width); | |
71 chrome.test.assertEq(200, window.height); | |
72 }); | |
73 // Do not use the big size because the maximium panel sizes are based on a | |
74 // factor of the screen resolution and the try bot might be configured with | |
75 // 800x600 resolution. | |
76 chrome.windows.create( | |
77 { 'url': 'about:blank', | |
78 'type': 'detached_panel', 'top': 42, 'left': 24, | |
79 'width': 250, 'height': 200 }, | |
80 chrome.test.callbackPass(createCallback)); | |
81 } | |
82 ]); | |
OLD | NEW |