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

Side by Side Diff: chrome/test/data/extensions/api_test/window_open/panel/test.js

Issue 1094383005: Modified two extension tests to not be dependent on low-latency DOM timers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fix Created 5 years, 8 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
« no previous file with comments | « chrome/test/data/extensions/api_test/bookmarks/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
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; 5 var panelWindowId = 0;
6 var panelLoaded = false;
6 7
7 // This function is called by the panel during the test run. 8 // This function is called by the panel during the test run.
8 function panelCallback() { 9 function panelCallback() {
10 panelLoaded = true;
11 maybeReadyForTest();
12 }
13
14 function maybeReadyForTest() {
15 // The order of the two callbacks is not guaranteed.
16 if( panelWindowId === 0 || !panelLoaded)
17 return;
18
9 // We have now added a panel so the total counts is 2 (browser + panel). 19 // We have now added a panel so the total counts is 2 (browser + panel).
10 chrome.test.assertEq(2, chrome.extension.getViews().length); 20 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. 21 // Verify that we're able to get the view of the panel by its window id.
12 chrome.test.assertEq(1, 22 chrome.test.assertEq(1,
13 chrome.extension.getViews({"windowId": panelWindowId}).length); 23 chrome.extension.getViews({"windowId": panelWindowId}).length);
14 chrome.test.notifyPass(); 24 chrome.test.notifyPass();
15 } 25 }
16 26
17 chrome.test.runTests([ 27 chrome.test.runTests([
18 function openPanel() { 28 function openPanel() {
19 chrome.test.listenOnce(chrome.windows.onCreated, function(window) { 29 chrome.test.listenOnce(chrome.windows.onCreated, function(window) {
20 chrome.test.assertTrue(window.width > 0); 30 chrome.test.assertTrue(window.width > 0);
21 chrome.test.assertTrue(window.height > 0); 31 chrome.test.assertTrue(window.height > 0);
22 chrome.test.assertEq("panel", window.type); 32 chrome.test.assertEq("panel", window.type);
23 chrome.test.assertTrue(!window.incognito); 33 chrome.test.assertTrue(!window.incognito);
24 }); 34 });
25 chrome.windows.create( 35 chrome.windows.create(
26 { 'url': chrome.extension.getURL('panel.html'), 'type': 'panel' }, 36 { 'url': chrome.extension.getURL('panel.html'), 'type': 'panel' },
27 function(win) { 37 function(win) {
28 chrome.test.assertEq('panel', win.type); 38 chrome.test.assertEq('panel', win.type);
29 chrome.test.assertEq(true, win.alwaysOnTop); 39 chrome.test.assertEq(true, win.alwaysOnTop);
30 panelWindowId = win.id; 40 panelWindowId = win.id;
31 // The panel will call back to us through panelCallback (above). 41 // The panel will call back to us through panelCallback (above).
42 maybeReadyForTest();
32 }); 43 });
33 } 44 }
34 ]); 45 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/bookmarks/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698