Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / netwerk / test / unit / test_throttlequeue.js
blob4fa1eaa0e2dcd2974bd775503b18509e51386da4
1 // Test ThrottleQueue initialization.
2 "use strict";
4 function init(tq, mean, max) {
5 let threw = false;
6 try {
7 tq.init(mean, max);
8 } catch (e) {
9 threw = true;
11 return !threw;
14 function run_test() {
15 let tq = Cc["@mozilla.org/network/throttlequeue;1"].createInstance(
16 Ci.nsIInputChannelThrottleQueue
19 ok(!init(tq, 0, 50), "mean bytes cannot be 0");
20 ok(!init(tq, 50, 0), "max bytes cannot be 0");
21 ok(!init(tq, 0, 0), "mean and max bytes cannot be 0");
22 ok(!init(tq, 70, 20), "max cannot be less than mean");
24 ok(init(tq, 2, 2), "valid initialization");