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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/resources/extensions/platform_app.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/platform_apps/storage/test.js
diff --git a/chrome/test/data/extensions/platform_apps/storage/test.js b/chrome/test/data/extensions/platform_apps/storage/test.js
index 015517bbb7a1606b920c7cd23222d66a12790d2b..34efdca3e2aefc3514fd88d34fa299bb179e2641 100644
--- a/chrome/test/data/extensions/platform_apps/storage/test.js
+++ b/chrome/test/data/extensions/platform_apps/storage/test.js
@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+function assertContains(string, substring, error) {
+ chrome.test.assertTrue(string.indexOf(substring) != -1, error);
+}
+
chrome.test.runTests([
function testOpenDatabase() {
chrome.test.assertTrue(!window.openDatabase);
@@ -14,7 +18,15 @@ chrome.test.runTests([
},
function testLocalStorage() {
- chrome.test.assertTrue(!window.localStorage);
- chrome.test.succeed();
+ try {
+ window.localStorage;
+ chrome.test.fail('error not thrown');
+ } catch (e) {
+ var message = e.message || e;
+ var expected = 'is not available in packaged apps. ' +
+ 'Use chrome.storage.local instead.';
+ assertContains(message, expected, 'Unexpected message ' + message);
+ chrome.test.succeed();
+ }
}
]);
« 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