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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-getTags.https.html

Issue 2745543002: Implement BackgroundFetchManager::{get, fetch}() (Closed)
Patch Set: more webexposed tests Created 3 years, 9 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/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>

Powered by Google App Engine
This is Rietveld 408576698