Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / appcache / cyrillic-uri.html
blob1bd60cb89c23bcf481aab2c0d211284098bb2ed7
1 <html manifest="resources/cyrillic-uri.manifest">
2 <head>
3 <meta charset="koi8-r">
4 </head>
5 <body>
6 <p>Test that non-ASCII URIs work correctly in cache manifests.</p>
7 <p>Should be a series of PASS messages, followed with DONE.</p>
8 <div id=result></div>
10 <script>
11 if (window.testRunner) {
12 testRunner.dumpAsText();
13 testRunner.waitUntilDone();
16 function log(message)
18 document.getElementById("result").innerHTML += message + "<br>";
21 function load(url)
23 var req = new XMLHttpRequest;
24 req.open("GET", url, false);
25 req.send("");
26 return req.responseText;
29 function canLoad(url)
31 try {
32 var req = new XMLHttpRequest;
33 req.open("GET", url, false);
34 req.send("");
35 return true;
36 } catch (ex) {
37 return false;
41 function shouldBeLoadable(url)
43 log((canLoad(url) ? "PASS: " : "FAIL: ") + url);
46 function test()
48 // Path is always UTF-8.
49 shouldBeLoadable("resources/intercept/cached-ðÒÏ×ÅÒËÁ");
50 shouldBeLoadable("resources/intercept/cached-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0");
51 shouldBeLoadable("resources/intercept/cached2-ðÒÏ×ÅÒËÁ");
52 shouldBeLoadable("resources/intercept/cached2-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0");
53 shouldBeLoadable("resources/intercept/network-ðÒÏ×ÅÒËÁ-PASS");
54 shouldBeLoadable("resources/intercept/network-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0-PASS");
55 shouldBeLoadable("resources/does-not-exist-ðÒÏ×ÅÒËÁ");
57 // To test encodings other than UTF-8, we need to simulate form submission (for XHR, Firefox
58 // always uses UTF-8, even in query part).
59 applicationCache.onnoupdate = null;
60 applicationCache.oncached = null;
61 window.addEventListener("message", frameDone, false);
62 var ifr = document.createElement("iframe");
63 ifr.setAttribute("src", "resources/cyrillic-uri-form.html");
64 document.body.appendChild(ifr);
67 function frameDone(evt)
69 log("DONE");
70 if (window.testRunner)
71 testRunner.notifyDone();
74 applicationCache.onnoupdate = function() { test() }
75 applicationCache.oncached = function() { test() }
77 applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
78 applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
80 </script>
81 </body>
82 </html>