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

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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