OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>SW proxied mixed response shold be handled as an error.</title> | |
falken
2015/07/03 04:10:37
nit: "should" (two places)
horo
2015/07/06 11:45:40
Done.
| |
3 <script src="../../resources/testharness.js"></script> | |
4 <script src="../../resources/testharnessreport.js"></script> | |
5 <script src="../resources/test-helpers.js"></script> | |
6 <body> | |
7 <script> | |
8 // This file tests the following behavior: | |
9 // 1. The audio element sends the first request. | |
10 // 2. The ServiceWorker intercepts the request and proxies the request to | |
11 // service-worker-proxied-mixed-response.php. | |
12 // 3. service-worker-proxied-mixed-response.php returns the first 3 bytes | |
13 // ("Ogg"). | |
14 // 4. The element sends the second request with "Range: bytes=3-" header. | |
15 // 5. The ServiceWorker doesn't intercept the request. | |
16 // 6. load-video.php returns the audio file from the fourth byte. | |
17 // | |
18 // The original URLs of 3. (service-worker-proxied-mixed-response.php) and 6. | |
19 // (load-video.php) are different. So an error should be occur. | |
falken
2015/07/03 04:10:37
nit: "should occur"
Hm, I didn't realize we were
horo
2015/07/06 11:45:40
I think SW-proxied-mixing is useful for caching la
| |
20 | |
21 promise_test(function(t) { | |
22 var SCOPE = 'resources/blank.html?service-worker-proxied-mixed-response-ifra me.html'; | |
23 var SCRIPT = 'resources/service-worker-proxied-mixed-response-worker.js'; | |
24 var frame; | |
25 return service_worker_unregister_and_register(t, SCRIPT, SCOPE) | |
26 .then(function(registration) { | |
27 return wait_for_state(t, registration.installing, 'activated'); | |
28 }) | |
29 .then(function() { return with_iframe(SCOPE); }) | |
30 .then(function(f) { | |
31 frame = f; | |
32 return new Promise(function (resolve, reject) { | |
33 var audio = frame.contentWindow.document.createElement('audio'); | |
34 audio.oncanplay = function() { | |
35 reject('CanPlay event should not be fired.'); | |
falken
2015/07/03 04:10:37
nit: "canplay"
horo
2015/07/06 11:45:40
Done.
| |
36 }; | |
37 audio.onerror = resolve; | |
38 audio.src = | |
39 'http://localhost:8000/media/resources/load-video.php?' + | |
40 'name=../../../../media/content/silence.oga&type=audio/ogg'; | |
41 frame.contentWindow.document.body.appendChild(audio); | |
42 }) | |
43 }) | |
44 .then(function() { | |
45 frame.remove(); | |
46 return service_worker_unregister_and_done(t, SCOPE); | |
47 }); | |
48 }, 'SW proxied mixed response shold be handled as an error.'); | |
49 </script> | |
50 </body> | |
OLD | NEW |