mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 700540 - Part 2: intermittent orange in test_jpakeclient. Again. r=gps
This commit is contained in:
parent
056a79a42d
commit
3d129e68af
@ -67,9 +67,11 @@ function server_report(request, response) {
|
||||
}
|
||||
|
||||
// Hook for test code.
|
||||
let hooks = {
|
||||
onGET: function onGET(request) {}
|
||||
let hooks = {};
|
||||
function initHooks() {
|
||||
hooks.onGET = function onGET(request) {};
|
||||
}
|
||||
initHooks();
|
||||
|
||||
function ServerChannel() {
|
||||
this.data = "";
|
||||
@ -271,11 +273,19 @@ add_test(function test_firstMsgMaxTries() {
|
||||
// For the purpose of the tests, the poll interval is 50ms and
|
||||
// we're polling up to 5 times for the first exchange (as
|
||||
// opposed to 2 times for most of the other exchanges). So let's
|
||||
// pretend it took 150ms to enter the PIN on the sender.
|
||||
_("Received PIN " + pin + ". Waiting 150ms before entering it into sender...");
|
||||
// pretend it took 150ms to enter the PIN on the sender, which should
|
||||
// require 3 polls.
|
||||
// Rather than using an imprecise timer, we hook into the channel's
|
||||
// GET handler to know how long to wait.
|
||||
_("Received PIN " + pin + ". Waiting for three polls before entering it into sender...");
|
||||
this.cid = pin.slice(JPAKE_LENGTH_SECRET);
|
||||
Utils.namedTimer(function() { snd.pairWithPIN(pin, false); },
|
||||
150, this, "_sendTimer");
|
||||
let count = 0;
|
||||
hooks.onGET = function onGET(request) {
|
||||
if (++count == 3) {
|
||||
_("Third GET. Triggering pair.");
|
||||
Utils.nextTick(function() { snd.pairWithPIN(pin, false); });
|
||||
}
|
||||
};
|
||||
},
|
||||
onPairingStart: function onPairingStart(pin) {},
|
||||
onComplete: function onComplete(data) {
|
||||
@ -283,12 +293,15 @@ add_test(function test_firstMsgMaxTries() {
|
||||
// Ensure channel was cleared, no error report.
|
||||
do_check_eq(channels[this.cid].data, undefined);
|
||||
do_check_eq(error_report, undefined);
|
||||
|
||||
// Clean up.
|
||||
initHooks();
|
||||
run_next_test();
|
||||
}
|
||||
});
|
||||
rec.receiveNoPIN();
|
||||
});
|
||||
|
||||
|
||||
|
||||
add_test(function test_lastMsgMaxTries() {
|
||||
_("Test that receiver can wait longer for the last message.");
|
||||
@ -329,7 +342,7 @@ add_test(function test_lastMsgMaxTries() {
|
||||
do_check_eq(error_report, undefined);
|
||||
|
||||
// Clean up.
|
||||
hooks.onGET = function onGET(request) {};
|
||||
initHooks();
|
||||
run_next_test();
|
||||
}
|
||||
});
|
||||
@ -420,14 +433,22 @@ add_test(function test_abort_sender() {
|
||||
// Ensure channel was cleared, no error report.
|
||||
do_check_eq(channels[this.cid].data, undefined);
|
||||
do_check_eq(error_report, undefined);
|
||||
initHooks();
|
||||
run_next_test();
|
||||
},
|
||||
displayPIN: function displayPIN(pin) {
|
||||
_("Received PIN " + pin + ". Entering it in the other computer...");
|
||||
this.cid = pin.slice(JPAKE_LENGTH_SECRET);
|
||||
Utils.nextTick(function() { snd.pairWithPIN(pin, false); });
|
||||
Utils.namedTimer(function() { snd.abort(); },
|
||||
POLLINTERVAL, this, "_abortTimer");
|
||||
|
||||
// Abort after the first poll.
|
||||
let count = 0;
|
||||
hooks.onGET = function onGET(request) {
|
||||
if (++count >= 1) {
|
||||
_("First GET. Aborting.");
|
||||
Utils.nextTick(function() { snd.abort(); });
|
||||
}
|
||||
};
|
||||
},
|
||||
onPairingStart: function onPairingStart(pin) {}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user