|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 // This file tests the openUnsharedDatabase function of mozIStorageService. |
|
6 |
|
7 function test_openUnsharedDatabase_file_DNE() |
|
8 { |
|
9 // the file should be created after calling |
|
10 var db = getTestDB(); |
|
11 do_check_false(db.exists()); |
|
12 getService().openUnsharedDatabase(db); |
|
13 do_check_true(db.exists()); |
|
14 } |
|
15 |
|
16 function test_openUnsharedDatabase_file_exists() |
|
17 { |
|
18 // it should already exist from our last test |
|
19 var db = getTestDB(); |
|
20 do_check_true(db.exists()); |
|
21 getService().openUnsharedDatabase(db); |
|
22 do_check_true(db.exists()); |
|
23 } |
|
24 |
|
25 var tests = [test_openUnsharedDatabase_file_DNE, |
|
26 test_openUnsharedDatabase_file_exists]; |
|
27 |
|
28 function run_test() |
|
29 { |
|
30 for (var i = 0; i < tests.length; i++) |
|
31 tests[i](); |
|
32 |
|
33 cleanup(); |
|
34 } |
|
35 |