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 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 window.setTimeout(done, 0); |
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"; | 22 storage["preload"] = "done"; |
23 checkEqual("done", storage["preload"], | 23 checkEqual("done", storage["preload"], |
24 "storage['preload'] != 'done' after addition"); | 24 "storage['preload'] != 'done' after addition"); |
25 | 25 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 function checkEqual(lhs, rhs, errorMessage) { | 81 function checkEqual(lhs, rhs, errorMessage) { |
82 if (lhs !== rhs) | 82 if (lhs !== rhs) |
83 throw errorMessage; | 83 throw errorMessage; |
84 } | 84 } |
85 | 85 |
86 function makeLargeString(minimumSize) { | 86 function makeLargeString(minimumSize) { |
87 return Array(minimumSize).join("X"); | 87 return Array(minimumSize).join("X"); |
88 } | 88 } |
OLD | NEW |