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) { |
| 6 chrome.test.assertTrue(string.indexOf(substring) != -1, error); |
| 7 } |
| 8 |
5 chrome.test.runTests([ | 9 chrome.test.runTests([ |
6 function testOpenDatabase() { | 10 function testOpenDatabase() { |
7 chrome.test.assertTrue(!window.openDatabase); | 11 chrome.test.assertTrue(!window.openDatabase); |
8 chrome.test.succeed(); | 12 chrome.test.succeed(); |
9 }, | 13 }, |
10 | 14 |
11 function testOpenDatabaseSync() { | 15 function testOpenDatabaseSync() { |
12 chrome.test.assertTrue(!window.openDatabaseSync); | 16 chrome.test.assertTrue(!window.openDatabaseSync); |
13 chrome.test.succeed(); | 17 chrome.test.succeed(); |
14 }, | 18 }, |
15 | 19 |
16 function testLocalStorage() { | 20 function testLocalStorage() { |
17 chrome.test.assertTrue(!window.localStorage); | 21 try { |
18 chrome.test.succeed(); | 22 window.localStorage; |
| 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 } |
19 } | 31 } |
20 ]); | 32 ]); |
OLD | NEW |