OLD | NEW |
---|---|
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 panelWindowId = 0; | |
6 | |
7 // This function is called by the panel during the test run. | 5 // This function is called by the panel during the test run. |
8 function panelCallback() { | 6 function panelCallback() { |
9 // We have now added a panel so the total counts is 2 (browser + panel). | 7 // We have now added a panel so the total counts is 2 (browser + panel). |
10 chrome.test.assertEq(2, chrome.extension.getViews().length); | 8 chrome.test.assertEq(2, chrome.extension.getViews().length); |
11 // Verify that we're able to get the view of the panel by its window id. | |
12 chrome.test.assertEq(1, | |
13 chrome.extension.getViews({"windowId": panelWindowId}).length); | |
14 chrome.test.notifyPass(); | 9 chrome.test.notifyPass(); |
15 } | 10 } |
16 | 11 |
17 chrome.test.runTests([ | 12 chrome.test.runTests([ |
18 function openPanel() { | 13 function openPanel() { |
19 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { | 14 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { |
20 chrome.test.assertTrue(window.width > 0); | 15 chrome.test.assertTrue(window.width > 0); |
21 chrome.test.assertTrue(window.height > 0); | 16 chrome.test.assertTrue(window.height > 0); |
22 chrome.test.assertEq("panel", window.type); | 17 chrome.test.assertEq("panel", window.type); |
23 chrome.test.assertTrue(!window.incognito); | 18 chrome.test.assertTrue(!window.incognito); |
24 }); | 19 }); |
25 chrome.windows.create( | 20 chrome.windows.create( |
26 { 'url': chrome.extension.getURL('panel.html'), 'type': 'panel' }, | 21 { 'url': chrome.extension.getURL('panel.html'), 'type': 'panel' }, |
27 function(win) { | 22 function(win) { |
28 chrome.test.assertEq('panel', win.type); | 23 chrome.test.assertEq('panel', win.type); |
29 chrome.test.assertEq(true, win.alwaysOnTop); | 24 chrome.test.assertEq(true, win.alwaysOnTop); |
30 panelWindowId = win.id; | 25 // Verify that we're able to get the view of the panel by its |
26 // window id. | |
27 chrome.test.assertEq(1, | |
28 chrome.extension.getViews({"windowId": win.id}).length); | |
not at google - send to devlin
2015/04/24 22:18:10
This test still has a small problem, where if pane
| |
31 // The panel will call back to us through panelCallback (above). | 29 // The panel will call back to us through panelCallback (above). |
32 }); | 30 }); |
33 } | 31 } |
34 ]); | 32 ]); |
OLD | NEW |