Bug 1638330 - Fix intermittent netwerk/test/unit/test_dns_disabled.js r=necko-reviewers,valentin

Remove test case which relied on an entry being in the DNS cache, and
was most likely the cause of the intermittent failures. Also added an assert
to check the lookup result status before calling inRecord.getNextAddrAsString(),
as that was resulting in a timeout instead of a test failure. Also some minor
changes removing a few lines that were not needed.

Differential Revision: https://phabricator.services.mozilla.com/D76097
This commit is contained in:
Alex Catarineu 2020-05-20 10:27:44 +00:00
Родитель f09b53287c
Коммит 76c5b17fcd
1 изменённых файлов: 2 добавлений и 13 удалений

Просмотреть файл

@ -19,13 +19,13 @@ function makeListenerBlock(next) {
Assert.ok(!Components.isSuccessCode(inStatus));
next();
},
QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
};
}
function makeListenerDontBlock(next, expectedAnswer) {
return {
onLookupComplete(inRequest, inRecord, inStatus) {
Assert.equal(inStatus, Cr.NS_OK);
var answer = inRecord.getNextAddrAsString();
if (expectedAnswer) {
Assert.equal(answer, expectedAnswer);
@ -34,7 +34,6 @@ function makeListenerDontBlock(next, expectedAnswer) {
}
next();
},
QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
};
}
@ -69,22 +68,12 @@ function all_done() {
do_test_finished();
}
// Cached hostnames should be resolved even if dns is disabled
function testCached() {
do_test({
dnsDisabled: true,
mustBlock: false,
testDomain: "foo.bar",
nextCallback: all_done,
});
}
function testNotBlocked() {
do_test({
dnsDisabled: false,
mustBlock: false,
testDomain: "foo.bar",
nextCallback: testCached,
nextCallback: all_done,
});
}