OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 function assertContains(string, substring, error) { | 5 function assertContains(string, substring, error) { |
6 chrome.test.assertTrue(string.indexOf(substring) != -1, error); | 6 chrome.test.assertTrue(string.indexOf(substring) != -1, error); |
7 } | 7 } |
8 | 8 |
9 chrome.test.runTests([ | 9 chrome.test.runTests([ |
10 function testOpenDatabase() { | 10 function testOpenDatabase() { |
11 chrome.test.assertTrue(!window.openDatabase); | 11 chrome.test.assertTrue(!window.openDatabase); |
12 chrome.test.succeed(); | 12 chrome.test.succeed(); |
13 }, | 13 }, |
14 | 14 |
15 function testOpenDatabaseSync() { | 15 function testOpenDatabaseSync() { |
16 chrome.test.assertTrue(!window.openDatabaseSync); | 16 chrome.test.assertTrue(!window.openDatabaseSync); |
17 chrome.test.succeed(); | 17 chrome.test.succeed(); |
18 }, | 18 }, |
19 | 19 |
20 function testLocalStorage() { | 20 function testLocalStorage() { |
21 try { | 21 chrome.test.assertTrue(!window.localStorage); |
22 window.localStorage; | 22 chrome.test.succeed(); |
23 chrome.test.fail('error not thrown'); | |
24 } catch (e) { | |
25 var message = e.message || e; | |
26 var expected = 'is not available in packaged apps. ' + | |
27 'Use chrome.storage.local instead.'; | |
28 assertContains(message, expected, 'Unexpected message ' + message); | |
29 chrome.test.succeed(); | |
30 } | |
31 } | 23 } |
32 ]); | 24 ]); |
OLD | NEW |