mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 728790 test_prompt_async.html doesn't track its dialogs correctly r=mayhemer
This commit is contained in:
parent
249630e90b
commit
3159e835b7
@ -31,11 +31,13 @@
|
||||
login2 = Cc["@mozilla.org/login-manager/loginInfo;1"].createInstance(Ci.nsILoginInfo);
|
||||
login2.init("http://mochi.test:8888", null, "mochirealm", "user1name", "user1pass", "", "");
|
||||
pwmgr.addLogin(login2);
|
||||
startCallbackTimer();
|
||||
}
|
||||
function cleanup() {
|
||||
var pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
|
||||
pwmgr.removeLogin(login);
|
||||
pwmgr.removeLogin(login2);
|
||||
timer.cancel();
|
||||
}
|
||||
|
||||
function makeXHR(expectedStatus, expectedText, extra) {
|
||||
@ -59,7 +61,6 @@
|
||||
function testNonAnonymousCredentials() {
|
||||
var xhr = makeXHR(200, "OK");
|
||||
xhr.send();
|
||||
startCallbackTimer();
|
||||
}
|
||||
|
||||
function testAnonymousCredentials() {
|
||||
@ -77,10 +78,14 @@
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
var gExpectedDialogs = 0;
|
||||
var gCurrentTest;
|
||||
function runNextTest() {
|
||||
is(gExpectedDialogs, 0, "received expected number of auth dialogs");
|
||||
Cc["@mozilla.org/network/http-auth-manager;1"].getService(Components.interfaces.nsIHttpAuthManager).clearAll();
|
||||
if (pendingTests.length > 0) {
|
||||
gCurrentTest = pendingTests.shift();
|
||||
({expectedDialogs: gExpectedDialogs,
|
||||
test: gCurrentTest}) = pendingTests.shift();
|
||||
gCurrentTest.call(this);
|
||||
} else {
|
||||
cleanup();
|
||||
@ -88,8 +93,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
var pendingTests = [testNonAnonymousCredentials, testAnonymousCredentials,
|
||||
testAnonymousNoAuth];
|
||||
var pendingTests = [{expectedDialogs: 2, test: testNonAnonymousCredentials},
|
||||
{expectedDialogs: 1, test: testAnonymousCredentials},
|
||||
{expectedDialogs: 0, test: testAnonymousNoAuth}];
|
||||
init();
|
||||
runNextTest();
|
||||
|
||||
@ -97,9 +103,8 @@
|
||||
{
|
||||
var dialog = doc.getElementById("commonDialog");
|
||||
dialog.acceptDialog();
|
||||
if (gCurrentTest == testNonAnonymousCredentials) {
|
||||
startCallbackTimer();
|
||||
}
|
||||
gExpectedDialogs--;
|
||||
startCallbackTimer();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user