https://github.com/web-platform-tests/wpt
Raw File
Tip revision: eb9f8a917a751b5bd2e4ed86840eac8b5c4445f2 authored by Brian Birtles on 15 March 2018, 06:57:09 UTC
[web-animations] Update various references to an effect's `timing` member
Tip revision: eb9f8a9
utils.js
'use strict';

// Depends on /service-workers/service-worker/resources/test-helpers.sub.js
async function registerAndActivateServiceWorker(test) {
  const script = 'resources/sw.js';
  const scope = 'resources/scope' + location.pathname;
  let serviceWorkerRegistration =
      await service_worker_unregister_and_register(test, script, scope);
  add_completion_callback(() => {
    serviceWorkerRegistration.unregister();
  });
  await wait_for_state(test, serviceWorkerRegistration.installing, 'activated');
  return serviceWorkerRegistration;
}

function backgroundFetchTest(func, description) {
  promise_test(async t => {
    const serviceWorkerRegistration = await registerAndActivateServiceWorker(t);
    return func(t, serviceWorkerRegistration.backgroundFetch);
  }, description);
}

let _nextBackgroundFetchTag = 0;
function uniqueTag() {
  return 'tag' + _nextBackgroundFetchTag++;
}
back to top