<!--
  Any copyright is dedicated to the Public Domain.
  http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
  <title>Bug 930348 - test stub Navigator ServiceWorker utilities.</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
<script class="testbody" type="text/javascript">

  function checkEnabled() {
    ok(navigator.serviceWorker, "navigator.serviceWorker should exist when ServiceWorkers are enabled.");
    ok(typeof navigator.serviceWorker.register === "function", "navigator.serviceWorker.register() should be a function.");
    ok(typeof navigator.serviceWorker.getRegistration === "function", "navigator.serviceWorker.getAll() should be a function.");
    ok(typeof navigator.serviceWorker.getRegistrations === "function", "navigator.serviceWorker.getAll() should be a function.");
    ok(navigator.serviceWorker.ready instanceof Promise, "navigator.serviceWorker.ready should be a Promise.");
    ok(navigator.serviceWorker.controller === null, "There should be no controller worker for an uncontrolled document.");
  }

  SimpleTest.waitForExplicitFinish();

  SpecialPowers.pushPrefEnv({"set": [
    ["dom.serviceWorkers.exemptFromPerDomainMax", true],
    ["dom.serviceWorkers.enabled", true],
    ["dom.serviceWorkers.testing.enabled", true]
  ]}, function() {
    checkEnabled();
    SimpleTest.finish();
  });
</script>
</pre>
</body>
</html>
