OLD | NEW |
1 /* Test imported from Alex Vincent's XHR2 timeout tests, written for Mozilla. | 1 /* Test imported from Alex Vincent's XHR2 timeout tests, written for Mozilla. |
2 https://hg.mozilla.org/mozilla-central/file/tip/content/base/test/ | 2 https://hg.mozilla.org/mozilla-central/file/tip/content/base/test/ |
3 Released into the public domain, according to | 3 Released into the public domain, according to |
4 https://bugzilla.mozilla.org/show_bug.cgi?id=525816#c86 | 4 https://bugzilla.mozilla.org/show_bug.cgi?id=525816#c86 |
5 */ | 5 */ |
6 | 6 |
7 /* Notes: | 7 /* Notes: |
8 - All times are expressed in milliseconds in this test suite. | 8 - All times are expressed in milliseconds in this test suite. |
9 - Test harness code is at the end of this file. | 9 - Test harness code is at the end of this file. |
10 - We generate only one request at a time, to avoid overloading the HTTP | 10 - We generate only one request at a time, to avoid overloading the HTTP |
11 request handlers. | 11 request handlers. |
12 */ | 12 */ |
13 | 13 |
14 var TIME_NORMAL_LOAD = 1000; | 14 var TIME_NORMAL_LOAD = 1000; |
15 var TIME_LATE_TIMEOUT = 800; | 15 var TIME_LATE_TIMEOUT = 800; |
16 var TIME_XHR_LOAD = 600; | 16 var TIME_XHR_LOAD = 600; |
17 var TIME_REGULAR_TIMEOUT = 400; | 17 var TIME_REGULAR_TIMEOUT = 400; |
18 var TIME_SYNC_TIMEOUT = 200; | 18 var TIME_SYNC_TIMEOUT = 200; |
19 var TIME_DELAY = 200; | 19 var TIME_DELAY = 200; |
20 | 20 |
21 /* | 21 /* |
22 * This should point to a resource that responds after a delay of TIME_XHR_LOAD
milliseconds. | 22 * This should point to a resource that responds after a delay of TIME_XHR_LOAD
milliseconds. |
23 */ | 23 */ |
24 var STALLED_REQUEST_URL = "/resources/load-and-stall.cgi?name=../../../http/test
s/xmlhttprequest/timeout/xmlhttprequest-timeout.js&stallFor=" + TIME_XHR_LOAD/10
00 + "&stallAt=0&mimeType=text/plain"; | 24 var STALLED_REQUEST_URL = "/resources/load-and-stall.php?name=../../../http/test
s/xmlhttprequest/timeout/xmlhttprequest-timeout.js&stallFor=" + TIME_XHR_LOAD/10
00 + "&stallAt=0&mimeType=text/plain"; |
25 | 25 |
26 var inWorker = false; | 26 var inWorker = false; |
27 try { | 27 try { |
28 inWorker = !(self instanceof Window); | 28 inWorker = !(self instanceof Window); |
29 } catch (e) { | 29 } catch (e) { |
30 inWorker = true; | 30 inWorker = true; |
31 } | 31 } |
32 | 32 |
33 function message(obj) { | 33 function message(obj) { |
34 if (inWorker) | 34 if (inWorker) |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 } | 367 } |
368 }; | 368 }; |
369 | 369 |
370 self.addEventListener("message", function (event) { | 370 self.addEventListener("message", function (event) { |
371 if (event.data.type == "start") { | 371 if (event.data.type == "start") { |
372 TestRequests = TestRequestGroups[event.data.group]; | 372 TestRequests = TestRequestGroups[event.data.group]; |
373 TestCounter.next(); | 373 TestCounter.next(); |
374 } | 374 } |
375 }); | 375 }); |
OLD | NEW |