| <html manifest="../resources/simple-no-token.manifest"> |
| <!-- |
| Generate this token with the command: |
| tools/origin_trials/generate_token.py http://127.0.0.1:8000 AppCache --expire-days=2000 |
| --> |
| <meta http-equiv="origin-trial" content="AnwB3aSh6U8pmYtO/AzzxELSwk8BRJoj77nUnCq6u3N8LMJKlX/ImydQmXn3SgE0a+8RyowLbV835tXQHJMHuAEAAABQeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiQXBwQ2FjaGUiLCAiZXhwaXJ5IjogMTc2MTE3NjE5OH0="> |
| <script src="/js-test-resources/js-test.js"></script> |
| <script> |
| var jsTestIsAsync = true; |
| description("Test that manifests without origin trial tokens are treated the same as a missing/unparseable manifest."); |
| |
| let seenUnexpectedEvent = false; |
| |
| function unexpectedEvent(name) |
| { |
| if (seenUnexpectedEvent) |
| return; |
| testFailed("Unexpected " + name + " event."); |
| // We only care about the first unexpected event. |
| // Suppress others to avoid inconsistent test output. |
| seenUnexpectedEvent = true; |
| finishJSTest(); |
| } |
| |
| applicationCache.addEventListener('noupdate', function() { unexpectedEvent("noupdate") }, false); |
| applicationCache.addEventListener('downloading', function() { unexpectedEvent("downloading") }, false); |
| applicationCache.addEventListener('progress', function() { unexpectedEvent("progress") }, false); |
| applicationCache.addEventListener('updateready', function() { unexpectedEvent("updateready") }, false); |
| applicationCache.addEventListener('cached', function() { unexpectedEvent("cached") }, false); |
| applicationCache.addEventListener('obsolete', function() { unexpectedEvent("obsolete") }, false); |
| |
| function test(e) |
| { |
| if (seenUnexpectedEvent) |
| return; |
| shouldBeTrue("gotCheckingEvent"); |
| shouldBe("window.applicationCache.status", "applicationCache.UNCACHED"); |
| |
| event = e; |
| shouldBeEqualToString("event.reason", "manifest"); |
| shouldBeEqualToString("event.message", "Invalid or missing manifest origin trial token: http://127.0.0.1:8000/appcache/resources/simple-no-token.manifest"); |
| |
| shouldBeEqualToString("event.url", "http://127.0.0.1:8000/appcache/resources/simple-no-token.manifest"); |
| // event.status is 0 and not relevant when there is a token error. |
| shouldBe("event.status", "0"); |
| |
| // The manifest failed to load, so there should be no cache, and subresources should be loaded normally. |
| try { |
| req = new XMLHttpRequest(); |
| req.open("GET", "../resources/simple.txt", false); |
| req.send(); |
| |
| shouldBeEqualToString("req.responseText", 'Hello, World!'); |
| } catch (e) { |
| testFailed("Could not load data."); |
| } |
| |
| finishJSTest(); |
| } |
| |
| var gotCheckingEvent = false; |
| applicationCache.addEventListener('checking', function() { gotCheckingEvent = true; }, false); |
| applicationCache.addEventListener('error', test, false); |
| |
| </script> |
| </html> |