mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Count open windows in browser_522545.js for bug 528776
This commit is contained in:
parent
6050028e36
commit
6d378fb627
@ -50,23 +50,9 @@ function waitForBrowserState(aState, aSetStateCallback) {
|
||||
ss.setBrowserState(JSON.stringify(aState));
|
||||
}
|
||||
|
||||
function browserWindowsCount() {
|
||||
let count = 0;
|
||||
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Ci.nsIWindowMediator)
|
||||
.getEnumerator("navigator:browser");
|
||||
while (e.hasMoreElements()) {
|
||||
if (!e.getNext().closed)
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
function test() {
|
||||
/** Test for Bug 394759 **/
|
||||
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
|
||||
|
||||
|
||||
// test setup
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
let pb = Cc["@mozilla.org/privatebrowsing;1"].getService(Ci.nsIPrivateBrowsingService);
|
||||
@ -326,7 +312,6 @@ function test() {
|
||||
test_basic(function() {
|
||||
test_behavior(function() {
|
||||
test_purge(function() {
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
|
||||
finish();
|
||||
});
|
||||
});
|
||||
|
@ -35,8 +35,21 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function browserWindowsCount() {
|
||||
let count = 0;
|
||||
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Ci.nsIWindowMediator)
|
||||
.getEnumerator("navigator:browser");
|
||||
while (e.hasMoreElements()) {
|
||||
if (!e.getNext().closed)
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
function test() {
|
||||
/** Test for Bug 522545 **/
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
@ -292,7 +305,10 @@ function test() {
|
||||
tests.shift().call();
|
||||
} else {
|
||||
ss.setBrowserState(originalState);
|
||||
executeSoon(finish);
|
||||
executeSoon(function () {
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
|
||||
finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user