michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: var testnum = 0; michael@0: michael@0: let iter; michael@0: michael@0: function run_test() michael@0: { michael@0: do_test_pending(); michael@0: iter = next_test(); michael@0: iter.next(); michael@0: } michael@0: michael@0: function next_test() michael@0: { michael@0: try { michael@0: michael@0: // ===== test init ===== michael@0: var testfile = do_get_file("formhistory_v3v4.sqlite"); michael@0: var profileDir = dirSvc.get("ProfD", Ci.nsIFile); michael@0: michael@0: // Cleanup from any previous tests or failures. michael@0: var destFile = profileDir.clone(); michael@0: destFile.append("formhistory.sqlite"); michael@0: if (destFile.exists()) michael@0: destFile.remove(false); michael@0: michael@0: testfile.copyTo(profileDir, "formhistory.sqlite"); michael@0: do_check_eq(3, getDBVersion(testfile)); michael@0: michael@0: // ===== 1 ===== michael@0: testnum++; michael@0: michael@0: destFile = profileDir.clone(); michael@0: destFile.append("formhistory.sqlite"); michael@0: dbConnection = Services.storage.openUnsharedDatabase(destFile); michael@0: michael@0: // check for upgraded schema. michael@0: do_check_eq(CURRENT_SCHEMA, FormHistory.schemaVersion); michael@0: michael@0: // Check that the index was added michael@0: do_check_true(dbConnection.tableExists("moz_deleted_formhistory")); michael@0: dbConnection.close(); michael@0: michael@0: // check that an entry still exists michael@0: yield countEntries("name-A", "value-A", michael@0: function (num) { michael@0: do_check_true(num > 0); michael@0: do_test_finished(); michael@0: } michael@0: ); michael@0: michael@0: } catch (e) { michael@0: throw "FAILED in test #" + testnum + " -- " + e; michael@0: } michael@0: }