toolkit/components/places/tests/migration/test_database_from_alpha.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * This file tests migration replaces the database if schema version < 6.
     6  */
     8 add_test(function corrupt_database_not_exists() {
     9   let dbFile = gProfD.clone();
    10   dbFile.append("places.sqlite.corrupt");
    11   do_check_false(dbFile.exists());
    12   run_next_test();
    13 });
    15 add_test(function database_is_valid() {
    16   do_check_eq(PlacesUtils.history.databaseStatus,
    17               PlacesUtils.history.DATABASE_STATUS_CORRUPT);
    18   do_check_eq(DBConn().schemaVersion, CURRENT_SCHEMA_VERSION);
    19   run_next_test();
    20 });
    22 add_test(function corrupt_database_exists() {
    23   let dbFile = gProfD.clone();
    24   dbFile.append("places.sqlite.corrupt");
    25   do_check_true(dbFile.exists());
    26   run_next_test();
    27 });
    29 function run_test()
    30 {
    31   setPlacesDatabase("places_alpha.sqlite");
    32   run_next_test();
    33 }

mercurial