| 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 } |
| 10 |
| 11 chrome.test.runTests([ |
| 12 // No origin nor size is specified. |
| 13 function openDetachedPanel() { |
| 14 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { |
| 15 chrome.test.assertEq("panel", window.type); |
| 16 chrome.test.assertTrue(!window.incognito); |
| 17 chrome.test.assertTrue(window.width > 0); |
| 18 chrome.test.assertTrue(window.height > 0); |
| 19 }); |
| 20 chrome.windows.create( |
| 21 { 'url': 'about:blank', |
| 22 'type': 'detached_panel' }, |
| 23 chrome.test.callbackPass(createCallback)); |
| 24 }, |
| 25 |
| 26 // Verify supplied size is obeyed even if no origin is specified. |
| 27 function openDetachedPanelWithSize() { |
| 28 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { |
| 29 chrome.test.assertEq("panel", window.type); |
| 30 chrome.test.assertTrue(!window.incognito); |
| 31 chrome.test.assertEq(250, window.width); |
| 32 chrome.test.assertEq(300, window.height); |
| 33 }); |
| 34 chrome.windows.create( |
| 35 { 'url': 'about:blank', |
| 36 'type': 'detached_panel', 'width': 250, 'height': 300 }, |
| 37 chrome.test.callbackPass(createCallback)); |
| 38 }, |
| 39 |
| 40 // Verify supplied origin is obeyed even if no size is specified. |
| 41 function openDetachedPanelWithOrigin() { |
| 42 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { |
| 43 chrome.test.assertEq("panel", window.type); |
| 44 chrome.test.assertTrue(!window.incognito); |
| 45 chrome.test.assertEq(42, window.top); |
| 46 chrome.test.assertEq(24, window.left); |
| 47 chrome.test.assertTrue(window.width > 0); |
| 48 chrome.test.assertTrue(window.height > 0); |
| 49 }); |
| 50 chrome.windows.create( |
| 51 { 'url': 'about:blank', |
| 52 'type': 'detached_panel', 'top': 42, 'left': 24 }, |
| 53 chrome.test.callbackPass(createCallback)); |
| 54 }, |
| 55 |
| 56 // Verify supplied bounds are obeyed. |
| 57 function openDetachedPanelWithFullBounds() { |
| 58 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { |
| 59 chrome.test.assertEq("panel", window.type); |
| 60 chrome.test.assertTrue(!window.incognito); |
| 61 chrome.test.assertEq(42, window.top); |
| 62 chrome.test.assertEq(24, window.left); |
| 63 chrome.test.assertEq(250, window.width); |
| 64 chrome.test.assertEq(300, window.height); |
| 65 }); |
| 66 chrome.windows.create( |
| 67 { 'url': 'about:blank', |
| 68 'type': 'detached_panel', 'top': 42, 'left': 24, |
| 69 'width': 250, 'height': 300 }, |
| 70 chrome.test.callbackPass(createCallback)); |
| 71 } |
| 72 ]); |
| OLD | NEW |