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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/update.html

Issue 2904063003: Upstream service worker "update" tests to WPT (Closed)
Patch Set: Move Chromium-specific test Created 3 years, 7 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/http/tests/serviceworker/update.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/update.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/update.html
deleted file mode 100644
index 82db1920d86ac8be8453caa4023f5ee6edefd8b0..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/update.html
+++ /dev/null
@@ -1,119 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: Registration update()</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';
- var worker_url = 'resources/update-worker.php';
- var expected_url = normalizeURL(worker_url);
- var registration;
- return service_worker_unregister_and_register(t, worker_url, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, registration.installing, 'activated');
- })
- .then(function() {
- assert_equals(registration.installing, null,
- 'installing should be null in the initial state.');
- assert_equals(registration.waiting, null,
- 'waiting should be null in the initial state.');
- assert_equals(registration.active.scriptURL, expected_url,
- 'active should exist in the initial state.');
-
- // A new worker (generated by update-worker.php) should be found.
- // The returned promise should resolve when a new worker script is
- // fetched and starts installing.
- return Promise.all([registration.update(),
- wait_for_update(t, registration)]);
- })
- .then(function() {
- assert_equals(registration.installing.scriptURL, expected_url,
- 'new installing should be set after update resolves.');
- assert_equals(registration.waiting, null,
- 'waiting should still be null after update resolves.');
- assert_equals(registration.active.scriptURL, expected_url,
- 'active should still exist after update found.');
- return wait_for_state(t, registration.installing, 'installed');
- })
- .then(function() {
- assert_equals(registration.installing, null,
- 'installing should be null after installing.');
- assert_equals(registration.waiting.scriptURL, expected_url,
- 'waiting should be set after installing.');
- assert_equals(registration.active.scriptURL, expected_url,
- 'active should still exist after installing.');
- return wait_for_state(t, registration.waiting, 'activated');
- })
- .then(function() {
- assert_equals(registration.installing, null,
- 'installing should be null after activated.');
- assert_equals(registration.waiting, null,
- 'waiting should be null after activated.');
- assert_equals(registration.active.scriptURL, expected_url,
- 'new worker should be promoted to active.');
- })
- .then(function() {
- // A new worker(generated by update-worker.php) should be found.
- // The returned promise should reject as update-worker.php sets the
- // mimetype to a disallowed value for this attempt.
- return registration.update();
- })
- .then(
- function() { assert_unreached("update() should reject."); },
- function(e) {
- assert_throws('SecurityError', function() { throw e; },
- 'Using a disallowed mimetype should make update() ' +
- 'promise reject with a SecurityError.');
- assert_equals(registration.active.scriptURL, expected_url,
- 'active should still exist after update failure.');
-
- // A new worker(generated by update-worker.py) should be found.
- // The returned promise should reject as update-worker.py returns
- // a worker script with a syntax error.
- return registration.update();
- })
- .then(
- function() { assert_unreached("update() should reject."); },
- function(e) {
- assert_throws({name: 'TypeError'}, function () { throw e; },
- 'A script syntax error should make update() ' +
- 'promise reject with a TypeError.');
- assert_equals(registration.active.scriptURL, expected_url,
- 'active should still exist after update failure.');
-
- // A new worker(generated by update-worker.py) should be found.
- // The returned promise should not reject, even though
- // update-worker.py returns a worker script that throws in the
- // install event handler.
- return Promise.all([registration.update(),
- wait_for_update(t, registration)]);
- })
- .then(function() {
- assert_equals(registration.installing.scriptURL, expected_url,
- 'installing should be set after update resolves (throw-install).');
- assert_equals(registration.waiting, null,
- 'waiting should still be null after update resolves (throw-install).');
- assert_equals(registration.active.scriptURL, expected_url,
- 'active should still exist after update found (throw-install).');
-
- // We need to hold a client alive so that unregister() below doesn't
- // remove the registration before update() has had a chance to look
- // at the pending uninstall flag.
- return with_iframe(scope);
- })
- .then(function(frame) {
- return Promise.all([registration.unregister(),
- registration.update()]);
- })
- .then(
- function() { assert_unreached("update() should reject."); },
- function(e) {
- assert_throws({name: 'TypeError'}, function () { throw e; },
- 'Calling update() while the uninstalling flag is ' +
- 'set should return a promise that rejects with an ' +
- 'TypeError.');
- });
- }, 'Update a registration.');
-</script>

Powered by Google App Engine
This is Rietveld 408576698