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

Side by Side Diff: content/test/data/dom_storage/sanity_check.js

Issue 1923673002: Run the DOMStorageBrowserTest.SanityCheck against the mojo based implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « content/public/common/content_switches.h ('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 startTestSoon() { 5 function startTestSoon() {
6 window.setTimeout(test, 0); 6 window.setTimeout(test, 0);
7 } 7 }
8 8
9 function test() { 9 function test() {
10 try { 10 try {
11 debug('Checking window.localStorage'); 11 debug('Checking window.localStorage');
12 sanityCheck(window.localStorage); 12 sanityCheck(window.localStorage);
13 debug('Checking window.sessionStorage'); 13 debug('Checking window.sessionStorage');
14 sanityCheck(window.sessionStorage); 14 sanityCheck(window.sessionStorage);
15 done(); 15 done();
16 } catch(e) { 16 } catch(e) {
17 fail(e); 17 fail(e);
18 } 18 }
19 } 19 }
20 20
21 function sanityCheck(storage) { 21 function sanityCheck(storage) {
22 storage["preload"] = "done";
23 checkEqual("done", storage["preload"],
24 "storage['preload'] != 'done' after addition");
25
22 storage.clear(); 26 storage.clear();
23 27
24 checkEqual(0, storage.length, 28 checkEqual(0, storage.length,
25 "storage.length != 0 at start"); 29 "storage.length != 0 at start");
26 checkEqual(null, storage.getItem("foo"), 30 checkEqual(null, storage.getItem("foo"),
27 "getItem('foo') != null prior to addition"); 31 "getItem('foo') != null prior to addition");
28 checkEqual(null, storage.key(0), 32 checkEqual(null, storage.key(0),
29 "key(0) != null prior to addition"); 33 "key(0) != null prior to addition");
30 34
31 storage.setItem("foo", "bar"); 35 storage.setItem("foo", "bar");
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 79 }
76 80
77 function checkEqual(lhs, rhs, errorMessage) { 81 function checkEqual(lhs, rhs, errorMessage) {
78 if (lhs !== rhs) 82 if (lhs !== rhs)
79 throw errorMessage; 83 throw errorMessage;
80 } 84 }
81 85
82 function makeLargeString(minimumSize) { 86 function makeLargeString(minimumSize) {
83 return Array(minimumSize).join("X"); 87 return Array(minimumSize).join("X");
84 } 88 }
OLDNEW
« no previous file with comments | « content/public/common/content_switches.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698