1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 var logForDebugging = false;
6 function log(message) {
11 chrome.test.runTests([
12 function registerServiceWorker() {
13 navigator.serviceWorker.register('/sw.js').then(function(registration) {
14 // Registration was successful
15 log('ServiceWorker registration successful with scope: ',
17 chrome.test.sendMessage("success");
18 chrome.test.succeed();
19 }).catch(function(err) {
20 // registration failed :(
21 var errorMsg = err.name + ': ' + err.message;
22 log('ServiceWorker registration failed: ' + errorMsg);
23 chrome.test.sendMessage(errorMsg);