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
) {
10 navigator
.serviceWorker
.register('/sw.js').then(function(registration
) {
11 // Registration was successful
12 log('ServiceWorker registration successful with scope: ',
14 chrome
.test
.succeed();
15 }).catch(function(err
) {
16 // registration failed :(
17 var errorMsg
= err
.name
+ ': ' + err
.message
;
18 log('ServiceWorker registration failed: ' + errorMsg
);