Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(691)

Side by Side Diff: chrome/test/data/extensions/platform_apps/storage/test.js

Issue 10832352: Throw exceptions when attempts are made to use localStorage in packaged apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Throw exceptions when attempts are made to use localStorage in packaged apps. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/resources/extensions/platform_app.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ]);
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/platform_app.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698