Bug 718817 - Tests for deleted passwords database migration. r=dolske

This commit is contained in:
Wes Johnston 2012-02-09 09:56:03 -08:00
Родитель 80342f9cf7
Коммит 1fca56aea3
3 изменённых файлов: 32 добавлений и 1 удалений

Двоичные данные
toolkit/components/passwordmgr/test/unit/data/signons-v4.sqlite Normal file

Двоичный файл не отображается.

Двоичные данные
toolkit/components/passwordmgr/test/unit/data/signons-v4v5.sqlite Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -14,7 +14,7 @@ const ENCTYPE_SDR = 1;
// Current schema version used by storage-mozStorage.js. This will need to be
// kept in sync with the version there (or else the tests fail).
const CURRENT_SCHEMA = 4;
const CURRENT_SCHEMA = 5;
function run_test() {
@ -294,6 +294,37 @@ do_check_true(LoginTest.is_about_now(t2.timeCreated));
do_check_true(LoginTest.is_about_now(t2.timeLastUsed));
do_check_true(LoginTest.is_about_now(t2.timePasswordChanged));
/* ========== 9 ========== */
testnum++;
testdesc = "Test upgrade from v4 storage"
LoginTest.copyFile("signons-v4.sqlite");
// Sanity check the test file.
dbConnection = LoginTest.openDB("signons-v4.sqlite");
do_check_eq(4, dbConnection.schemaVersion);
do_check_false(dbConnection.tableExists("moz_deleted_logins"));
storage = LoginTest.reloadStorage(OUTDIR, "signons-v4.sqlite");
do_check_eq(CURRENT_SCHEMA, dbConnection.schemaVersion);
do_check_true(dbConnection.tableExists("moz_deleted_logins"));
/* ========== 10 ========== */
testnum++;
testdesc = "Test upgrade from v4->v5->v4 storage"
LoginTest.copyFile("signons-v4v5.sqlite");
// Sanity check the test file.
dbConnection = LoginTest.openDB("signons-v4v5.sqlite");
do_check_eq(4, dbConnection.schemaVersion);
do_check_true(dbConnection.tableExists("moz_deleted_logins"));
storage = LoginTest.reloadStorage(OUTDIR, "signons-v4v5.sqlite");
do_check_eq(CURRENT_SCHEMA, dbConnection.schemaVersion);
do_check_true(dbConnection.tableExists("moz_deleted_logins"));
} catch (e) {
throw "FAILED in test #" + testnum + " -- " + testdesc + ": " + e;
}