Commit b1e8ea00 authored by oysteine's avatar oysteine Committed by Commit bot

Modified two extension tests to not be dependent on low-latency DOM timers

ExtensionApiTest.Bookmarks
 was adding one bookmark per timer callback; changed to use an event test.
WindowOpenPanelTest.WindowOpenPanel was relying on the callback supplied to chrome.windows.create happening before the resource was actually loaded, when there's no such guarantee.

R=kalman
BUG=424661,253417,383452

Review URL: https://codereview.chromium.org/1094383005

Cr-Commit-Position: refs/heads/master@{#326933}
parent c9f46539
......@@ -4,6 +4,7 @@
"manifest_version": 2,
"description": "end-to-end browser test for chrome.bookmarks API",
"background": {
"persistent": false,
"scripts": ["test.js"]
},
"permissions": ["bookmarks"]
......
......@@ -3,9 +3,19 @@
// found in the LICENSE file.
var panelWindowId = 0;
var panelLoaded = false;
// This function is called by the panel during the test run.
function panelCallback() {
panelLoaded = true;
maybeReadyForTest();
}
function maybeReadyForTest() {
// The order of the two callbacks is not guaranteed.
if( panelWindowId === 0 || !panelLoaded)
return;
// We have now added a panel so the total counts is 2 (browser + panel).
chrome.test.assertEq(2, chrome.extension.getViews().length);
// Verify that we're able to get the view of the panel by its window id.
......@@ -29,6 +39,7 @@ chrome.test.runTests([
chrome.test.assertEq(true, win.alwaysOnTop);
panelWindowId = win.id;
// The panel will call back to us through panelCallback (above).
maybeReadyForTest();
});
}
]);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment