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

Unified Diff: LayoutTests/http/tests/serviceworker/fetch-event.html

Issue 468753003: SW tests update (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 467133002 and fix test Created 6 years, 4 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
Index: LayoutTests/http/tests/serviceworker/fetch-event.html
diff --git a/LayoutTests/http/tests/serviceworker/fetch-event.html b/LayoutTests/http/tests/serviceworker/fetch-event.html
index ff0ff5a35ff20494a601deca712604e600356955..fd6aba2e8819d1a0dda77511515e1417841a0341 100644
--- a/LayoutTests/http/tests/serviceworker/fetch-event.html
+++ b/LayoutTests/http/tests/serviceworker/fetch-event.html
@@ -6,72 +6,80 @@
<script>
var worker = 'resources/fetch-event-test-worker.js';
-(function() {
- var t = async_test('Service Worker responds to fetch event with string');
+async_test(function(t) {
var scope = 'resources/simple.html?string';
service_worker_unregister_and_register(t, worker, scope)
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
.then(t.step_func(function(sw) {
return wait_for_state(t, sw, 'activated');
}))
.then(t.step_func(function() { return with_iframe(scope); }))
.then(t.step_func(function(frame) {
assert_equals(
- frame.contentDocument.body.textContent,
- 'Test string',
- 'Service Worker should respond to fetch with a test string');
+ frame.contentDocument.body.textContent,
+ 'Test string',
+ 'Service Worker should respond to fetch with a test string');
assert_equals(
- frame.contentDocument.contentType,
- 'text/plain',
- 'The content type of the response created with a string should be text/plain');
+ frame.contentDocument.contentType,
+ 'text/plain',
+ 'The content type of the response created with a string should be text/plain');
assert_equals(
- frame.contentDocument.characterSet,
- 'UTF-8',
- 'The character set of the response created with a string should be UTF-8');
+ frame.contentDocument.characterSet,
+ 'UTF-8',
+ 'The character set of the response created with a string should be UTF-8');
return service_worker_unregister_and_done(t, scope);
}))
.catch(unreached_rejection(t));
-}());
+ }, 'Service Worker responds to fetch event with string');
-(function() {
- var t = async_test('Service Worker responds to fetch event with blob body');
+async_test(function(t) {
var scope = 'resources/simple.html?blob';
service_worker_unregister_and_register(t, worker, scope)
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
.then(t.step_func(function(sw) {
return wait_for_state(t, sw, 'activated');
}))
.then(t.step_func(function() { return with_iframe(scope); }))
.then(t.step_func(function(frame) {
assert_equals(
- frame.contentDocument.body.textContent,
- 'Test blob',
- 'Service Worker should respond to fetch with a test string');
+ frame.contentDocument.body.textContent,
+ 'Test blob',
+ 'Service Worker should respond to fetch with a test string');
return service_worker_unregister_and_done(t, scope);
}))
.catch(unreached_rejection(t));
-}());
+ }, 'Service Worker responds to fetch event with blob body');
-(function() {
- var t = async_test('Service Worker responds to fetch event with the referrer URL');
+async_test(function(t) {
var scope = 'resources/simple.html?referrer';
service_worker_unregister_and_register(t, worker, scope)
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
.then(t.step_func(function(sw) {
return wait_for_state(t, sw, 'activated');
}))
.then(t.step_func(function() { return with_iframe(scope); }))
.then(t.step_func(function(frame) {
assert_equals(
- frame.contentDocument.body.textContent,
- 'Referrer: ' + document.location.href,
- 'Service Worker should respond to fetch with the referrer URL');
+ frame.contentDocument.body.textContent,
+ 'Referrer: ' + document.location.href,
+ 'Service Worker should respond to fetch with the referrer URL');
return service_worker_unregister_and_done(t, scope);
}))
.catch(unreached_rejection(t));
-}());
+ }, 'Service Worker responds to fetch event with the referrer URL');
-(function() {
- var t = async_test('Service Worker does not respond to fetch event');
+async_test(function(t) {
var scope = 'resources/simple.html?ignore';
service_worker_unregister_and_register(t, worker, scope)
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
.then(t.step_func(function(sw) {
return wait_for_state(t, sw, 'activated');
}))
@@ -83,13 +91,14 @@ var worker = 'resources/fetch-event-test-worker.js';
return service_worker_unregister_and_done(t, scope);
}))
.catch(unreached_rejection(t));
-}());
+ }, 'Service Worker does not respond to fetch event');
-(function() {
- var t = async_test(
- 'Service Worker responds to fetch event with null response body');
+async_test(function(t) {
var scope = 'resources/simple.html?null';
service_worker_unregister_and_register(t, worker, scope)
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
.then(t.step_func(function(sw) {
return wait_for_state(t, sw, 'activated');
}))
@@ -101,12 +110,14 @@ var worker = 'resources/fetch-event-test-worker.js';
return service_worker_unregister_and_done(t, scope);
}))
.catch(unreached_rejection(t));
-}());
+ }, 'Service Worker responds to fetch event with null response body');
-(function() {
- var t = async_test('Service Worker rejects fetch event');
+async_test(function(t) {
var scope = 'resources/simple.html?reject';
service_worker_unregister_and_register(t, worker, scope)
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
.then(t.step_func(function(sw) {
return wait_for_state(t, sw, 'activated');
}))
@@ -118,12 +129,14 @@ var worker = 'resources/fetch-event-test-worker.js';
return service_worker_unregister_and_done(t, scope);
}))
.catch(unreached_rejection(t));
-}());
+ }, 'Service Worker rejects fetch event');
-(function() {
- var t = async_test('Service Worker fetches other file in fetch event');
+async_test(function(t) {
var scope = 'resources/simple.html?fetch';
service_worker_unregister_and_register(t, worker, scope)
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
.then(t.step_func(function(sw) {
return wait_for_state(t, sw, 'activated');
}))
@@ -135,6 +148,6 @@ var worker = 'resources/fetch-event-test-worker.js';
return service_worker_unregister_and_done(t, scope);
}))
.catch(unreached_rejection(t));
-}());
+ }, 'Service Worker fetches other file in fetch event');
</script>
</body>
« no previous file with comments | « LayoutTests/http/tests/serviceworker/fetch-csp.html ('k') | LayoutTests/http/tests/serviceworker/indexeddb.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698