fune/browser/components/uitour/test/browser_closeTab.js
Matthew Noorenberghe 2655b73c19 Bug 1245107 - browser_closeTab.js: wait for the tab to close. r=jaws
The UITour content API call uses sendAsyncMessage so we can't assume a synchronous close.

MozReview-Commit-ID: JXm2ztcLwW5

--HG--
extra : rebase_source : 0a7c3cdcd8e66eb33c56b143fe96b4f5dfd3bfc5
2016-02-18 12:40:47 -08:00

18 lines
512 B
JavaScript

"use strict";
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
var gTestTab;
var gContentAPI;
var gContentWindow;
add_task(setup_UITourTest);
add_UITour_task(function* test_closeTab() {
// Setting gTestTab to null indicates that the tab has already been closed,
// and if this does not happen the test run will fail.
let closePromise = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabClose");
yield gContentAPI.closeTab();
yield closePromise;
gTestTab = null;
});