https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 304d5d487eda2ce794f9ce366a279787d239a2eb authored by Simon Pieters on 24 August 2018, 09:32:45 UTC
HTML: Add margins to reference for fieldset translateZ test
Tip revision: 304d5d4
update-ui.https.window.js
// META: script=/service-workers/service-worker/resources/test-helpers.sub.js
// META: script=resources/utils.js
'use strict';

// Covers functionality provided by BackgroundFetchUpdateUIEvent.updateUI().
//
// https://wicg.github.io/background-fetch/#backgroundfetchupdateuievent

const swName = 'sw-update-ui.js';

backgroundFetchTest(async (test, backgroundFetch) => {
  const registrationId = 'update-once';
  const registration =
      await backgroundFetch.fetch(registrationId, 'resources/feature-name.txt');
  assert_equals(registration.id, registrationId);

  const message = await getMessageFromServiceWorker();
  assert_equals(message.update, 'update success');

}, 'Background Fetch updateUI resolves', swName);


backgroundFetchTest(async (test, backgroundFetch) => {
  const registrationId = 'update-twice';
  const registration =
      await backgroundFetch.fetch(registrationId, 'resources/feature-name.txt');
  assert_equals(registration.id, registrationId);

  const message = await getMessageFromServiceWorker();
  assert_equals(message.update, 'updateUI may only be called once.');

}, 'Background Fetch updateUI called twice fails', swName);
back to top