mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 700540 - Part 2: intermittent orange in test_jpakeclient. Again. r=gps
This commit is contained in:
parent
d5206a38a4
commit
9b6429adef
@ -67,9 +67,11 @@ function server_report(request, response) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hook for test code.
|
// Hook for test code.
|
||||||
let hooks = {
|
let hooks = {};
|
||||||
onGET: function onGET(request) {}
|
function initHooks() {
|
||||||
|
hooks.onGET = function onGET(request) {};
|
||||||
}
|
}
|
||||||
|
initHooks();
|
||||||
|
|
||||||
function ServerChannel() {
|
function ServerChannel() {
|
||||||
this.data = "";
|
this.data = "";
|
||||||
@ -271,11 +273,19 @@ add_test(function test_firstMsgMaxTries() {
|
|||||||
// For the purpose of the tests, the poll interval is 50ms and
|
// For the purpose of the tests, the poll interval is 50ms and
|
||||||
// we're polling up to 5 times for the first exchange (as
|
// 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
|
// opposed to 2 times for most of the other exchanges). So let's
|
||||||
// pretend it took 150ms to enter the PIN on the sender.
|
// pretend it took 150ms to enter the PIN on the sender, which should
|
||||||
_("Received PIN " + pin + ". Waiting 150ms before entering it into sender...");
|
// 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);
|
this.cid = pin.slice(JPAKE_LENGTH_SECRET);
|
||||||
Utils.namedTimer(function() { snd.pairWithPIN(pin, false); },
|
let count = 0;
|
||||||
150, this, "_sendTimer");
|
hooks.onGET = function onGET(request) {
|
||||||
|
if (++count == 3) {
|
||||||
|
_("Third GET. Triggering pair.");
|
||||||
|
Utils.nextTick(function() { snd.pairWithPIN(pin, false); });
|
||||||
|
}
|
||||||
|
};
|
||||||
},
|
},
|
||||||
onPairingStart: function onPairingStart(pin) {},
|
onPairingStart: function onPairingStart(pin) {},
|
||||||
onComplete: function onComplete(data) {
|
onComplete: function onComplete(data) {
|
||||||
@ -283,12 +293,15 @@ add_test(function test_firstMsgMaxTries() {
|
|||||||
// Ensure channel was cleared, no error report.
|
// Ensure channel was cleared, no error report.
|
||||||
do_check_eq(channels[this.cid].data, undefined);
|
do_check_eq(channels[this.cid].data, undefined);
|
||||||
do_check_eq(error_report, undefined);
|
do_check_eq(error_report, undefined);
|
||||||
|
|
||||||
|
// Clean up.
|
||||||
|
initHooks();
|
||||||
run_next_test();
|
run_next_test();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rec.receiveNoPIN();
|
rec.receiveNoPIN();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
add_test(function test_lastMsgMaxTries() {
|
add_test(function test_lastMsgMaxTries() {
|
||||||
_("Test that receiver can wait longer for the last message.");
|
_("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);
|
do_check_eq(error_report, undefined);
|
||||||
|
|
||||||
// Clean up.
|
// Clean up.
|
||||||
hooks.onGET = function onGET(request) {};
|
initHooks();
|
||||||
run_next_test();
|
run_next_test();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -420,14 +433,22 @@ add_test(function test_abort_sender() {
|
|||||||
// Ensure channel was cleared, no error report.
|
// Ensure channel was cleared, no error report.
|
||||||
do_check_eq(channels[this.cid].data, undefined);
|
do_check_eq(channels[this.cid].data, undefined);
|
||||||
do_check_eq(error_report, undefined);
|
do_check_eq(error_report, undefined);
|
||||||
|
initHooks();
|
||||||
run_next_test();
|
run_next_test();
|
||||||
},
|
},
|
||||||
displayPIN: function displayPIN(pin) {
|
displayPIN: function displayPIN(pin) {
|
||||||
_("Received PIN " + pin + ". Entering it in the other computer...");
|
_("Received PIN " + pin + ". Entering it in the other computer...");
|
||||||
this.cid = pin.slice(JPAKE_LENGTH_SECRET);
|
this.cid = pin.slice(JPAKE_LENGTH_SECRET);
|
||||||
Utils.nextTick(function() { snd.pairWithPIN(pin, false); });
|
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) {}
|
onPairingStart: function onPairingStart(pin) {}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user