Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: LayoutTests/http/tests/serviceworker/chromium/memory-cache.html

Issue 632213002: Fetcher: Disable memory caching when Service Worker handles a request (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: s/getJSON/getJSONP Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/chromium/resources/memory-cache.jsonp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <title>Service Worker: Memory Cache</title>
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/test-helpers.js"></script>
7 <script>
8 var callback;
9
10 function getJSONP(url) {
11 var sc = document.createElement('script');
12 sc.src = url;
13 document.body.appendChild(sc);
14 return new Promise(function(resolve) {
15 // This callback function is called by appending a script element.
16 callback = function(data) { resolve(data); }
17 });
18 }
19
20 async_test(function(t) {
21 var scope = 'resources/memory-cache-controlled.html';
22 var worker = 'resources/memory-cache-worker.js';
23 var json_url = '/serviceworker/chromium/resources/memory-cache.jsonp';
24 var registration;
25 var frame;
26 var promises = [];
27
28 service_worker_unregister_and_register(t, worker, scope)
29 .then(function(r) {
30 registration = r;
31 return wait_for_activated(t, registration);
32 })
33 .then(function() { return with_iframe(scope); })
34 .then(function(f) {
35 frame = f;
36 // Request a json file from controlled page.
37 promises.push(frame.contentWindow.getJSONP(json_url));
38 // Request a json file from non-controlled page.
39 promises.push(getJSONP(json_url));
40 return Promise.all(promises);
41 })
42 .then(function(results) {
43 assert_equals(
44 results[0].src,
45 'service worker',
46 'Response for controlled page should be served by Service Worker');
47 assert_equals(
48 results[1].src,
49 'network',
50 'Response for non-controlled page should be served by network');
51 unload_iframe(frame);
52 return registration.unregister();
53 })
54 .then(function() {
55 t.done();
56 })
57 .catch(unreached_rejection(t));
58 }, 'Non-controlled page should not use a cache filled by Service Worker');
59 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/chromium/resources/memory-cache.jsonp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698