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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/registration-service-worker-attributes.https.html

Issue 2415873002: Import w3c tests for the service workers (Closed)
Patch Set: Rebase Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/registration-service-worker-attributes.https.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-service-worker-attributes.html b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/registration-service-worker-attributes.https.html
similarity index 63%
copy from third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-service-worker-attributes.html
copy to third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/registration-service-worker-attributes.https.html
index 2ee1784b80cc0b433fb63cb753c303ad9f60083a..a0dea5428db141c6c70688b705ebe60c85d0a54d 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-service-worker-attributes.html
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/registration-service-worker-attributes.https.html
@@ -1,20 +1,16 @@
<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
<script>
-promise_test(function(t) {
+async_test(function(t) {
var scope = 'resources/scope/installing-waiting-active-after-registration';
var worker_url = 'resources/empty-worker.js';
var expected_url = normalizeURL(worker_url);
- var installing_worker;
- var registration;
- return service_worker_unregister_and_register(t, worker_url, scope)
+ service_worker_unregister_and_register(t, worker_url, scope)
.then(function(r) {
- add_completion_callback(function() { r.unregister(); });
registration = r;
- installing_worker = registration.installing;
assert_equals(registration.installing.scriptURL, expected_url,
'installing before updatefound');
assert_equals(registration.waiting, null,
@@ -23,8 +19,8 @@ promise_test(function(t) {
'active before updatefound');
return wait_for_update(t, registration);
})
- .then(function() {
- assert_equals(registration.installing, installing_worker,
+ .then(function(worker) {
+ assert_equals(registration.installing.scriptURL, expected_url,
'installing after updatefound');
assert_equals(registration.waiting, null,
'waiting after updatefound');
@@ -35,19 +31,22 @@ promise_test(function(t) {
.then(function() {
assert_equals(registration.installing, null,
'installing after installed');
- assert_equals(registration.waiting, installing_worker,
- 'waiting after installed');
- assert_equals(registration.active, null,
- 'active after installed');
- return wait_for_state(t, registration.waiting, 'activated');
+ var newest = registration.waiting || registration.active;
+ assert_equals(newest.scriptURL, expected_url,
+ 'waiting or active after installed');
+ if (registration.waiting) {
+ return wait_for_state(t, registration.waiting, 'activated')
+ .then(function() {
+ assert_equals(registration.installing, null,
+ 'installing after activated');
+ assert_equals(registration.waiting, null,
+ 'waiting after activated');
+ assert_equals(registration.active.scriptURL, expected_url,
+ 'active after activated');
+ });
+ }
})
.then(function() {
- assert_equals(registration.installing, null,
- 'installing after activated');
- assert_equals(registration.waiting, null,
- 'waiting after activated');
- assert_equals(registration.active, installing_worker,
- 'active after activated');
return Promise.all([
wait_for_state(t, registration.active, 'redundant'),
registration.unregister()
@@ -64,6 +63,8 @@ promise_test(function(t) {
// resolved, this will be gone.
assert_equals(registration.active, null,
'active should be null after redundant');
- });
+ t.done();
+ })
+ .catch(unreached_rejection(t));
}, 'installing/waiting/active after registration');
</script>

Powered by Google App Engine
This is Rietveld 408576698