Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/update-served-from-cache.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/update-served-from-cache.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/update-served-from-cache.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d6f77e7baddbc659c7dfb7f86605f3bd29b7cf50 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/update-served-from-cache.html |
@@ -0,0 +1,33 @@ |
+<!DOCTYPE html> |
+<title>Service Worker: Registration update() served from cache</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="resources/test-helpers.js"></script> |
+<script> |
+promise_test(function(t) { |
+ var scope = 'resources/scope/update-served-from-cache'; |
+ var worker_url = 'resources/update-served-from-cache-worker.php'; |
+ var registration; |
+ |
+ return service_worker_unregister_and_register(t, worker_url, scope) |
+ .then(function(r) { |
+ // The script resource for this register() having a non-zero max-age |
+ // value was cached. |
+ registration = r; |
+ return wait_for_state(t, registration.installing, 'activated'); |
+ }) |
+ .then(function() { |
+ // update() should consult the cache. The returned promise should |
+ // resolve when the script is retrieved from the cache. |
+ return registration.update(); |
+ }) |
+ .then(function() { |
+ // installing should be null as update() does not trigger install. |
+ assert_equals( |
+ registration.installing, |
+ null, |
+ 'installing should be null as the script was served from cache.'); |
+ return service_worker_unregister_and_done(t, scope); |
+ }); |
+ }, 'Update a registration served from cache.'); |
+</script> |