| Index: third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-getTags.https.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-getTags.https.html b/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-getTags.https.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bee0cc8833dc117eabcfe68ef34ef855569968f7
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-getTags.https.html
|
| @@ -0,0 +1,46 @@
|
| +<!doctype html>
|
| +<meta charset="utf-8">
|
| +<title>Background Fetch API: getTags() tests</title>
|
| +<script src="/resources/testharness.js"></script>
|
| +<script src="/resources/testharnessreport.js"></script>
|
| +<script src="/serviceworker/resources/test-helpers.js"></script>
|
| +
|
| +<h1>BackgroundFetchManager.getTags()</h1>
|
| +<p>This test validates the behaviour of the getTags() method.</p>
|
| +
|
| +<!-- TODO(peter): Move this to the WPT directory when it's merged. -->
|
| +
|
| +<script>
|
| +'use strict';
|
| +
|
| +const workerUrl = 'resources/empty-worker.js';
|
| +const scope = 'resources/scope/' + location.pathname;
|
| +
|
| +promise_test(function(test) {
|
| + return service_worker_unregister_and_register(test, workerUrl, scope)
|
| + .then(registration => {
|
| + assert_equals(null, registration.active);
|
| + return registration.backgroundFetch.getTags();
|
| + })
|
| + .then(unreached_fulfillment(test), error => {
|
| + assert_equals(error.name, 'TypeError');
|
| + });
|
| +
|
| +}, 'BackgroundFetchManager.getTags() requires an activated Service Worker.');
|
| +
|
| +promise_test(function(test) {
|
| + let registration = null;
|
| +
|
| + return service_worker_unregister_and_register(test, workerUrl, scope)
|
| + .then(r => {
|
| + registration = r;
|
| + return wait_for_state(test, r.installing, 'activated');
|
| + })
|
| + .then(() => registration.backgroundFetch.getTags())
|
| + .then(tags => {
|
| + assert_true(Array.isArray(tags));
|
| + assert_equals(tags.length, 0);
|
| + });
|
| +
|
| +}, 'BackgroundFetchManager.getTags() returns an empty sequence by default.');
|
| +</script>
|
|
|