storage/test/unit/test_storage_service_unshared.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/storage/test/unit/test_storage_service_unshared.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +// This file tests the openUnsharedDatabase function of mozIStorageService.
     1.9 +
    1.10 +function test_openUnsharedDatabase_file_DNE()
    1.11 +{
    1.12 +  // the file should be created after calling
    1.13 +  var db = getTestDB();
    1.14 +  do_check_false(db.exists());
    1.15 +  getService().openUnsharedDatabase(db);
    1.16 +  do_check_true(db.exists());
    1.17 +}
    1.18 +
    1.19 +function test_openUnsharedDatabase_file_exists()
    1.20 +{
    1.21 +  // it should already exist from our last test
    1.22 +  var db = getTestDB();
    1.23 +  do_check_true(db.exists());
    1.24 +  getService().openUnsharedDatabase(db);
    1.25 +  do_check_true(db.exists());
    1.26 +}
    1.27 +
    1.28 +var tests = [test_openUnsharedDatabase_file_DNE,
    1.29 +             test_openUnsharedDatabase_file_exists];
    1.30 +
    1.31 +function run_test()
    1.32 +{
    1.33 +  for (var i = 0; i < tests.length; i++)
    1.34 +    tests[i]();
    1.35 +    
    1.36 +  cleanup();
    1.37 +}
    1.38 +

mercurial