Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: LayoutTests/http/tests/appcache/404-manifest.html

Issue 217133002: AppCache error details tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Restore missing files Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <html manifest="does-not-exist.manifest"> 1 <html manifest="does-not-exist.manifest">
2 <script src="/js-test-resources/js-test.js"></script>
2 <script> 3 <script>
3 if (window.testRunner) { 4 var jsTestIsAsync = true;
4 testRunner.dumpAsText() 5 description("Test that subresources can be loaded if manifest is not available." );
5 testRunner.waitUntilDone();
6 }
7
8 function log(message)
9 {
10 document.getElementById("result").innerHTML += message + "<br>";
11 }
12 6
13 function unexpectedEvent(name) 7 function unexpectedEvent(name)
14 { 8 {
15 log("FAILURE: Unexpected " + name + " event."); 9 testFailed("Unexpected " + name + " event.");
10 finishJSTest();
16 } 11 }
17 12
18 applicationCache.addEventListener('noupdate', function() { unexpectedEvent("noup date") }, false); 13 applicationCache.addEventListener('noupdate', function() { unexpectedEvent("noup date") }, false);
19 applicationCache.addEventListener('downloading', function() { unexpectedEvent("d ownloading") }, false); 14 applicationCache.addEventListener('downloading', function() { unexpectedEvent("d ownloading") }, false);
20 applicationCache.addEventListener('progress', function() { unexpectedEvent("prog ress") }, false); 15 applicationCache.addEventListener('progress', function() { unexpectedEvent("prog ress") }, false);
21 applicationCache.addEventListener('updateready', function() { unexpectedEvent("u pdateready") }, false); 16 applicationCache.addEventListener('updateready', function() { unexpectedEvent("u pdateready") }, false);
22 applicationCache.addEventListener('cached', function() { unexpectedEvent("cached ") }, false); 17 applicationCache.addEventListener('cached', function() { unexpectedEvent("cached ") }, false);
23 applicationCache.addEventListener('obsolete', function() { unexpectedEvent("obso lete") }, false); 18 applicationCache.addEventListener('obsolete', function() { unexpectedEvent("obso lete") }, false);
24 19
25 function test() 20 function test(e)
26 { 21 {
27 if (!gotCheckingEvent) 22 shouldBeTrue("gotCheckingEvent");
28 log("FAILURE: Did not get a checking event"); 23 shouldBe("window.applicationCache.status", "applicationCache.UNCACHED");
29 if (window.applicationCache.status) 24
30 log("FAILURE: Cache status is not UNCACHED, " + window.applicationCache. status); 25 event = e;
26 shouldBeTrue("'reason' in event");
27 shouldBeTrue("'url' in event");
28 shouldBeTrue("'status' in event");
29 shouldBeTrue("'message' in event");
30
31 shouldBeEqualToString("event.reason", "manifest");
32 shouldBeEqualToString("event.url", "http://127.0.0.1:8000/appcache/does-not- exist.manifest");
33 shouldBe("event.status", "404");
31 34
32 // The manifest failed to load, so there should be no cache, and subresource s should be loaded normally. 35 // The manifest failed to load, so there should be no cache, and subresource s should be loaded normally.
33 try { 36 try {
34 var req = new XMLHttpRequest(); 37 req = new XMLHttpRequest();
35 req.open("GET", "resources/simple.txt", false); 38 req.open("GET", "resources/simple.txt", false);
36 req.send(); 39 req.send();
37 40
38 if (req.responseText == 'Hello, World!') 41 shouldBeEqualToString("req.responseText", 'Hello, World!');
39 log("SUCCESS");
40 else
41 log("FAILURE: Did not get expected response data.");
42 } catch (e) { 42 } catch (e) {
43 log("FAILURE: Could not load data."); 43 testFailed("Could not load data.");
44 } 44 }
45 45
46 if (window.testRunner) 46 finishJSTest();
47 testRunner.notifyDone();
48 } 47 }
49 48
50 var gotCheckingEvent = false; 49 var gotCheckingEvent = false;
51 applicationCache.addEventListener('checking', function() { gotCheckingEvent = tr ue; }, false); 50 applicationCache.addEventListener('checking', function() { gotCheckingEvent = tr ue; }, false);
52 51 applicationCache.addEventListener('error', test, false);
53 applicationCache.addEventListener('error', function() { test() }, false);
54 52
55 </script> 53 </script>
56 <p>Test that subresources can be loaded if manifest is not available. Should say SUCCESS.</p>
57
58 <div id=result></div>
59 </html> 54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698