| James Graham | 2120f70 | 2012-10-27 09:13:40 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>EventSource: Cache-Control</title> |
| 5 | <script src="/resources/testharness.js"></script> |
| 6 | <script src="/resources/testharnessreport.js"></script> |
| 7 | </head> |
| 8 | <body> |
| 9 | <div id="log"></div> |
| 10 | <script> |
| 11 | var crossdomain = location.href |
| Arthur Barstow | ec1a757 | 2013-08-12 15:31:57 | [diff] [blame] | 12 | .replace('://', '://www2.') |
| James Graham | 2120f70 | 2012-10-27 09:13:40 | [diff] [blame] | 13 | .replace(/\/[^\/]*$/, '/') |
| 14 | |
| 15 | // running it twice to check whether it stays consistent |
| 16 | function cacheTest(runAgain, url) { |
| 17 | var test = async_test() |
| 18 | test.step(function() { |
| 19 | var source = new EventSource(url) |
| 20 | source.onmessage = function(e) { |
| 21 | test.step(function() { |
| 22 | assert_equals(e.data, "no-cache") |
| 23 | this.close() |
| 24 | if(runAgain) |
| 25 | cacheTest(false, url) // this nests tests |
| 26 | }, this) |
| 27 | test.done() |
| 28 | } |
| 29 | }) |
| 30 | } |
| 31 | |
| James Graham | 234a672 | 2013-09-17 17:54:38 | [diff] [blame] | 32 | cacheTest(true, "resources/cache-control.event_stream?pipe=sub") |
| 33 | cacheTest(true, crossdomain + "resources/cors.py?run=cache-control") |
| James Graham | 2120f70 | 2012-10-27 09:13:40 | [diff] [blame] | 34 | </script> |
| 35 | </body> |
| 36 | </html> |
| 37 | |