|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * This file tests migration replaces the database if schema version < 6. |
|
6 */ |
|
7 |
|
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 }); |
|
14 |
|
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 }); |
|
21 |
|
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 }); |
|
28 |
|
29 function run_test() |
|
30 { |
|
31 setPlacesDatabase("places_alpha.sqlite"); |
|
32 run_next_test(); |
|
33 } |
|
34 |