https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 7da4e3fdf745990e52bb535e8e6d317cd21f2121 authored by Madeleine Barowsky on 21 December 2018, 02:41:02 UTC
WIP to add native YUV support for lossy WebP without alpha in the GPU rasterization non-OOPR case.
Tip revision: 7da4e3f
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, 'InvalidStateError');

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

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

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

}, 'Background Fetch updateUI fails when event is not active', swName);
back to top