blob: b3965929257dce8d7a45215eb99f5a53991aca2e [file] [log] [blame]
James Graham2120f702012-10-27 09:13:401<!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 Barstowec1a7572013-08-12 15:31:5712 .replace('://', '://www2.')
James Graham2120f702012-10-27 09:13:4013 .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 Graham234a6722013-09-17 17:54:3832 cacheTest(true, "resources/cache-control.event_stream?pipe=sub")
33 cacheTest(true, crossdomain + "resources/cors.py?run=cache-control")
James Graham2120f702012-10-27 09:13:4034 </script>
35 </body>
36</html>
37