зеркало из https://github.com/mozilla/pjs.git
Bug 728790 test_prompt_async.html doesn't track its dialogs correctly r=mayhemer
This commit is contained in:
Родитель
3a6c76df6e
Коммит
3cc24bfd69
|
@ -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>
|
||||
|
|
Загрузка…
Ссылка в новой задаче