Files
UXP-Fixed/netwerk/test/unit/test_throttlequeue.js
T
2018-02-02 04:16:08 -05:00

24 lines
576 B
JavaScript

// Test ThrottleQueue initialization.
function init(tq, mean, max) {
let threw = false;
try {
tq.init(mean, max);
} catch (e) {
threw = true;
}
return !threw;
}
function run_test() {
let tq = Cc["@mozilla.org/network/throttlequeue;1"]
.createInstance(Ci.nsIInputChannelThrottleQueue);
ok(!init(tq, 0, 50), "mean bytes cannot be 0");
ok(!init(tq, 50, 0), "max bytes cannot be 0");
ok(!init(tq, 0, 0), "mean and max bytes cannot be 0");
ok(!init(tq, 70, 20), "max cannot be less than mean");
ok(init(tq, 2, 2), "valid initialization");
}