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

Unified Diff: LayoutTests/http/tests/serviceworker/ready.html

Issue 912443002: ServiceWorker: Make "ready" fetches registration from browser process(3/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/ready.html
diff --git a/LayoutTests/http/tests/serviceworker/ready.html b/LayoutTests/http/tests/serviceworker/ready.html
index e0080032dfd6d57cf102a71e4832d586f1061b54..6a427c8e549fdd27771851b16e546cf6a91fc887 100644
--- a/LayoutTests/http/tests/serviceworker/ready.html
+++ b/LayoutTests/http/tests/serviceworker/ready.html
@@ -91,42 +91,38 @@ async_test(function(t) {
async_test(function(t) {
var url = 'resources/empty-worker.js';
- var scope = 'resources/blank.html?ready-after-unregister';
- var expected_url = normalizeURL(url);
- var frame;
- var registration;
+ var matched_scope = 'resources/blank.html?ready-after-match';
+ var better_matched_scope = 'resources/blank.html?ready-after-match-better';
+ var frame, registration;
- service_worker_unregister_and_register(t, url, scope)
dominicc (has gone to gerrit) 2015/02/16 07:19:22 Shouldn't all tests start with this, in case a tes
falken 2015/02/16 09:20:42 Yep
xiang 2015/02/26 08:50:33 Done.
+ with_iframe(better_matched_scope)
+ .then(function(f) {
+ frame = f;
+ return navigator.serviceWorker.register(url, {scope: matched_scope});
+ })
.then(function(r) {
registration = r;
return wait_for_state(t, r.installing, 'activated');
})
- .then(function() { return with_iframe(scope); })
- .then(function(f) {
- frame = f;
- return registration.unregister();
+ .then(function() {
+ return navigator.serviceWorker.register(
+ url, {scope: better_matched_scope});
})
.then(function() {
return frame.contentWindow.navigator.serviceWorker.ready;
})
- .then(function(registration) {
- assert_equals(registration.installing, null,
- 'installing should be null');
- assert_equals(registration.waiting, null,
- 'waiting should be null');
- assert_equals(registration.active.scriptURL, expected_url,
- 'active after ready should not be null');
- assert_equals(
- frame.contentWindow.navigator.serviceWorker.controller.scriptURL,
- expected_url,
- 'controlled document should have a controller');
-
+ .then(function(r) {
+ assert_equals(r.scope, normalizeURL(better_matched_scope),
+ 'better matched registration should be returned');
+ assert_equals(frame.contentWindow.navigator.serviceWorker.controller,
+ null, 'controller should be null');
+ return registration.unregister();
+ })
+ .then(function() {
unload_iframe(frame);
- service_worker_unregister_and_done(t, scope);
+ return service_worker_unregister_and_done(t, better_matched_scope);
})
.catch(unreached_rejection(t));
- }, 'ready after unregistration');
+ }, 'ready after a better matched registration registered');
-// FIXME: When replace() is implemented add a test that .ready is
-// repeatedly created and settled.
</script>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698