toolkit/components/satchel/test/unit/test_db_update_v4b.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:03067c63bcd3
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 file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 var testnum = 0;
6
7 let iter;
8
9 function run_test()
10 {
11 do_test_pending();
12 iter = next_test();
13 iter.next();
14 }
15
16 function next_test()
17 {
18 try {
19
20 // ===== test init =====
21 var testfile = do_get_file("formhistory_v3v4.sqlite");
22 var profileDir = dirSvc.get("ProfD", Ci.nsIFile);
23
24 // Cleanup from any previous tests or failures.
25 var destFile = profileDir.clone();
26 destFile.append("formhistory.sqlite");
27 if (destFile.exists())
28 destFile.remove(false);
29
30 testfile.copyTo(profileDir, "formhistory.sqlite");
31 do_check_eq(3, getDBVersion(testfile));
32
33 // ===== 1 =====
34 testnum++;
35
36 destFile = profileDir.clone();
37 destFile.append("formhistory.sqlite");
38 dbConnection = Services.storage.openUnsharedDatabase(destFile);
39
40 // check for upgraded schema.
41 do_check_eq(CURRENT_SCHEMA, FormHistory.schemaVersion);
42
43 // Check that the index was added
44 do_check_true(dbConnection.tableExists("moz_deleted_formhistory"));
45 dbConnection.close();
46
47 // check that an entry still exists
48 yield countEntries("name-A", "value-A",
49 function (num) {
50 do_check_true(num > 0);
51 do_test_finished();
52 }
53 );
54
55 } catch (e) {
56 throw "FAILED in test #" + testnum + " -- " + e;
57 }
58 }

mercurial