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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-fetch.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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-get.https.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!doctype html>
2 <meta charset="utf-8">
3 <title>Background Fetch API: fetch() 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>BackgroundFetchManager.fetch()</h1>
9 <p>This test validates the behaviour of the fetch() method.</p>
10
11 <!-- TODO(peter): Move this to the WPT directory when it's merged. -->
12
13 <script>
14 'use strict';
15
16 const workerUrl = 'resources/empty-worker.js';
17 const scope = 'resources/scope/' + location.pathname;
18
19 promise_test(function(test) {
20 return service_worker_unregister_and_register(test, workerUrl, scope)
21 .then(registration => {
22 assert_equals(null, registration.active);
23 return registration.backgroundFetch.fetch('tag', ['resources/non-existing- file.png']);
24 })
25 .then(unreached_fulfillment(test), error => {
26 assert_equals(error.name, 'TypeError');
27 });
28
29 }, 'BackgroundFetchManager.fetch() requires an activated Service Worker.');
30
31 promise_test(function(test) {
32 const tag = 'my-background-fetch';
33 const options = {
34 icons: [
35 {
36 src: 'resources/non-existing-large-icon.png',
37 sizes: '256x256',
38 type: 'image/png'
39 },
40 {
41 src: 'resources/non-existing-small-icon.jpg',
42 sizes: '64x64',
43 type: 'image/jpg'
44 }
45 ],
46 title: 'My Background Fetch',
47 totalDownloadSize: 1024
48 };
49
50 let registration = null;
51
52 return service_worker_unregister_and_register(test, workerUrl, scope)
53 .then(r => {
54 registration = r;
55 return wait_for_state(test, r.installing, 'activated');
56 })
57 .then(() => registration.backgroundFetch.fetch(tag, ['resources/non-existing -file.png'], options))
58 .then(backgroundFetchRegistration => {
59 assert_true(backgroundFetchRegistration instanceof BackgroundFetchRegistra tion);
60 assert_equals(backgroundFetchRegistration.tag, tag);
61 assert_object_equals(backgroundFetchRegistration.icons, options.icons);
62 assert_equals(backgroundFetchRegistration.totalDownloadSize, options.total DownloadSize);
63 assert_equals(backgroundFetchRegistration.title, options.title);
64 });
65
66 }, 'BackgroundFetchManager.fetch() returns a BackgroundFetchRegistration object. ');
67 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-get.https.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698