1 <html manifest="resources/manifest-parsing.manifest"> 2 <body> 3 <p>Test application cache manifest parsing.</p> 4 <div id=result></div> 5 6 <script> 7 if (window.layoutTestController) { 8 layoutTestController.dumpAsText(); 9 layoutTestController.waitUntilDone(); 10 } 11 12 function log(message) 13 { 14 document.getElementById("result").innerHTML += message + "<br>"; 15 } 16 17 function canLoad(url) 18 { 19 try { 20 var req = new XMLHttpRequest(); 21 req.open("GET", url, false); 22 req.send(); 23 return true; 24 } catch (e) { 25 return false; 26 } 27 } 28 29 function test() 30 { 31 var hadError = false; 32 33 // Check that section name wasn't misparsed as resource URL. 34 if (canLoad("resources/UNKNOWN:")) { 35 log("Loaded 'UNKNOWN:'"); 36 hadError = true; 37 } 38 39 // Load a resource that was in UNKNOWN section - in other words, that is not in cache. 40 if (canLoad("resources/not-in-cache.txt")) { 41 log("Loaded 'not-in-cache.txt'"); 42 hadError = true; 43 } 44 45 // Load resources were specified with tricky whitespace. 46 if (!canLoad("resources/empty.txt")) { 47 log("Could not load 'empty.txt'"); 48 hadError = true; 49 } 50 if (!canLoad("resources/simple.txt")) { 51 log("Could not load 'simple.txt'"); 52 hadError = true; 53 } 54 55 log(hadError ? "FAILURE" : "SUCCESS"); 56 if (window.layoutTestController) 57 layoutTestController.notifyDone(); 58 } 59 60 applicationCache.onnoupdate = function() { test() } 61 applicationCache.oncached = function() { test() } 62 63 applicationCache.onerror = function() { log("error") } 64 </script> 65 </body> 66 </html> 67