Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / appcache / resource-redirect.html
1 <html manifest="resources/resource-redirect.manifest">
2 <script src="/js-test-resources/js-test.js"></script>
3 <script>
4 var jsTestIsAsync = true;
5 description("Test that a redirect makes resource caching fail.");
6
7 function unexpectedCallback(eventName)
8 {
9     testFailed("An unexpected " + eventName + " event was dispatched on window.applicationCache.");
10     finishJSTest();
11 }
12
13 function test(e)
14 {
15     shouldBe("window.applicationCache.status", "window.applicationCache.UNCACHED");
16
17     event = e;
18     shouldBeEqualToString("event.reason", "resource");
19     shouldBeEqualToString("event.url", "http://127.0.0.1:8000/appcache/resources/resource-redirect.php");
20     shouldBe("event.status", "307");
21     shouldBeTrue("'message' in event");
22
23     finishJSTest();
24 }
25
26 applicationCache.addEventListener('cached', function() { unexpectedCallback("cached"); }, false);
27 applicationCache.addEventListener('noupdate', function() { unexpectedCallback("noupdate"); }, false);
28 applicationCache.addEventListener('error', test, false);
29
30 </script>
31 </body>
32 </html>