OLD | NEW |
---|---|
(Empty) | |
1 var registered = false; | |
Devlin
2015/07/10 21:51:23
nit: you'll need the license in .js files, too. (.
| |
2 var error_msg = ""; | |
Devlin
2015/07/10 21:51:23
nitty nit: prefer single quotes, unless you have a
| |
3 | |
not at google - send to devlin
2015/07/10 22:00:42
also, JS style is camelcase unlike C++.
| |
4 chrome.test.runTests([ | |
5 function registerServiceWorker() { | |
6 if ('serviceWorker' in navigator) { | |
Devlin
2015/07/10 21:51:23
We can probably ignore this - chrome always has se
| |
7 navigator.serviceWorker.register('/sw.js').then(function(registration) { | |
8 // Registration was successful | |
9 console.log('ServiceWorker registration successful with scope: ', | |
Devlin
2015/07/10 21:51:22
We're not supposed to spam the log with status fro
| |
10 registration.scope); | |
11 registered = true; | |
12 }).catch(function(err) { | |
13 // registration failed :( | |
14 error_msg = err.name + ': ' + err.message; | |
15 console.log('ServiceWorker registration failed: ' + error_msg); | |
16 // This is the error message that should appear when the extension | |
17 // scheme is registered to allow service workers | |
18 chrome.test.assertEq('SecurityError: Failed to register a' | |
Devlin
2015/07/10 21:51:23
For this test extension, how about we use chrome.t
| |
19 + 'ServiceWorker: No URL is associated with the caller\'s' | |
Devlin
2015/07/10 21:51:23
nitty nit: prefer double quotes when you have a qu
| |
20 + ' document.', error_msg); | |
21 }); | |
22 } | |
23 chrome.test.assertTrue(registered); | |
24 } | |
25 ]); | |
26 | |
OLD | NEW |