Update web-platform-tests to revision 2df7f9ff620cbdaa2928464892fb1dfb880fd6c6

This commit is contained in:
WPT Sync Bot 2018-09-28 21:31:46 -04:00
parent 97e3c5f3a9
commit 7ba3376dde
74 changed files with 1985 additions and 504 deletions

View file

@ -67,6 +67,21 @@ backgroundFetchTest(async (test, backgroundFetch) => {
}, 'IDs must be unique among active Background Fetch registrations');
backgroundFetchTest(async (test, backgroundFetch) => {
const registrationId = uniqueId();
const registration =
await backgroundFetch.fetch(registrationId, '');
assert_equals(registration.id, registrationId);
const {type, eventRegistration, results} = await getMessageFromServiceWorker();
assert_equals('backgroundfetchsuccess', type);
assert_equals(eventRegistration.result, 'success');
assert_equals(eventRegistration.failureReason, '');
}, 'Empty URL is OK.');
backgroundFetchTest(async (test, backgroundFetch) => {
const registrationId = uniqueId();
const registration =
@ -190,4 +205,20 @@ backgroundFetchTest(async (test, backgroundFetch) => {
assert_equals(eventRegistration.result, 'failure');
assert_equals(eventRegistration.failureReason, 'bad-status');
}, 'Using Background Fetch to fetch a non-existent resource should fail.');
}, 'Using Background Fetch to fetch a non-existent resource should fail.');
backgroundFetchTest(async (test, backgroundFetch) => {
const registration = await backgroundFetch.fetch(
'my-id',
['https://example.com', 'http://example.com']);
const {type, eventRegistration, results} = await getMessageFromServiceWorker();
assert_equals('backgroundfetchfail', type);
assert_equals(eventRegistration.failureReason, 'fetch-error');
assert_equals(results.length, 2);
assert_true(results[0].url.includes('https://example.com'));
assert_equals(results[1].url, '');
}, 'Fetches with mixed content should fail.');

View file

@ -30,34 +30,6 @@ backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueId(), 'http://localhost');
}, 'localhost http: fetch should register ok');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueId(), 'http://example.com'));
}, 'non-loopback http: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueId(), 'http://192.0.2.0'));
}, 'non-loopback IPv4 http: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueId(), 'http://[2001:db8::1]'));
}, 'non-loopback IPv6 http: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueId(), ['https://example.com',
'http://example.com']));
}, 'https: and non-loopback http: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueId(), ['http://example.com',
'https://example.com']));
}, 'non-loopback http: and https: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueId(), 'wss:127.0.0.1'));

View file

@ -27,5 +27,3 @@ function handleBackgroundFetchUpdateEvent(event) {
self.addEventListener('backgroundfetchsuccess', handleBackgroundFetchUpdateEvent);
self.addEventListener('backgroundfetchfail', handleBackgroundFetchUpdateEvent);