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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-registration-abort.https.html

Issue 2762663002: BackgroundFetchRegistration.abort() should return a Promise. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <meta charset="utf-8">
3 <title>Background Fetch API: BackgroundFetchRegistration.abort() tests</title>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script src="/serviceworker/resources/test-helpers.js"></script>
7
8 <h1>BackgroundFetchRegistration.abort()</h1>
9 <p>This test validates the behaviour of the abort() method.</p>
10
11 <!-- TODO(peter): Move this to the WPT directory when it's merged and we
12 can successfully create a new Background Fetch registration. -->
13
14 <script>
15 'use strict';
16
17 const workerUrl = 'resources/empty-worker.js';
18 const scope = 'resources/scope/' + location.pathname;
19
20 promise_test(function(test) {
21 const tag = 'my-background-fetch';
22
23 let registration = null;
24 let backgroundFetchRegistration = null;
25
26 return service_worker_unregister_and_register(test, workerUrl, scope)
27 .then(r => {
28 registration = r;
29 return wait_for_state(test, r.installing, 'activated');
30 })
31 .then(() => registration.backgroundFetch.fetch(tag, ['resources/non-existing -file.png']))
32 .then(r => {
33 backgroundFetchRegistration = r;
34
35 assert_true(backgroundFetchRegistration instanceof BackgroundFetchRegistra tion);
36 assert_inherits(backgroundFetchRegistration, 'abort');
37
38 return backgroundFetchRegistration.abort();
39 })
40 .then(success => {
41 // The registration was valid, so aborting it should be successful.
42 assert_true(success);
43
44 return backgroundFetchRegistration.abort();
45 })
46 .then(success => {
47 // The registration had already been aborted, so aborting it again should fail.
48 // TODO(peter): This is a change-detector test, and will deliberately
49 // start failing when the browser side has been hooked up.
50 assert_true(success);
51 });
52
53 }, 'BackgroundFetchRegistration.abort() return a Promise indicating success.');
54 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698