Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / access-control-basic-allow-preflight-cache-timeout.html
blob0189948e3313095292ece66612fc11686c267183
1 <html>
2 <body>
3 <pre id='console'></pre>
4 <script type="text/javascript">
5 function log(message)
7 document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
10 if (window.testRunner) {
11 testRunner.dumpAsText();
12 testRunner.waitUntilDone();
15 function errorHandler(event)
17 log("FAIL: Network error. ");
18 if (window.testRunner)
19 testRunner.notifyDone();
22 var filename = "filename=preflightCacheTimeout.txt";
24 var xhr = new XMLHttpRequest;
25 xhr.onerror = errorHandler;
27 start = function()
29 // Temp file removed. We can start the test now.
30 if (xhr.readyState == xhr.DONE) {
31 firstRequest();
35 xhr.open("GET", "/resources/reset-temp-file.php?" + filename, true);
36 xhr.onreadystatechange = start;
37 xhr.send();
39 function firstRequest()
41 xhr.onreadystatechange = function()
43 if (xhr.readyState == xhr.DONE) {
44 log(xhr.responseText);
45 log("PASS: First request complete");
46 setTimeout(secondRequest, 3000); // 5 seconds
50 xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache-timeout.php?" + filename, true);
51 xhr.send();
54 function secondRequest()
56 xhr.onreadystatechange = function()
58 if (xhr.readyState == xhr.DONE) {
59 log(xhr.responseText);
60 log("PASS: Second request complete")
61 if (window.testRunner)
62 testRunner.notifyDone();
66 xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache-timeout.php?" + filename, true);
67 xhr.send();
70 </script>
71 </body>
72 </html>