summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorestade <estade@chromium.org>2015-03-02 09:12:39 -0800
committerCommit bot <commit-bot@chromium.org>2015-03-02 17:13:28 +0000
commit4299f239e7cced41cfb6f3ac2f8464957197822d (patch)
tree1688dc0ce85db77e561b0dca77ba04079be2c2e8 /components
parentb907b0c9264e74fa890318a36bbbe947badda192 (diff)
downloadchromium_src-4299f239e7cced41cfb6f3ac2f8464957197822d.zip
chromium_src-4299f239e7cced41cfb6f3ac2f8464957197822d.tar.gz
chromium_src-4299f239e7cced41cfb6f3ac2f8464957197822d.tar.bz2
Raze old WebDatabases.
BUG=382562 Review URL: https://codereview.chromium.org/962583003 Cr-Commit-Position: refs/heads/master@{#318713}
Diffstat (limited to 'components')
-rw-r--r--components/autofill/core/browser/webdata/autofill_table.cc877
-rw-r--r--components/autofill/core/browser/webdata/autofill_table.h14
-rw-r--r--components/search_engines/keyword_table.cc173
-rw-r--r--components/search_engines/keyword_table.h13
-rw-r--r--components/test/data/web_database/version_20.sql23
-rw-r--r--components/test/data/web_database/version_21.sql40
-rw-r--r--components/test/data/web_database/version_22.sql28
-rw-r--r--components/test/data/web_database/version_22_corrupt.sql32
-rw-r--r--components/test/data/web_database/version_25.sql23
-rw-r--r--components/test/data/web_database/version_26.sql23
-rw-r--r--components/test/data/web_database/version_27.sql26
-rw-r--r--components/test/data/web_database/version_29.sql29
-rw-r--r--components/test/data/web_database/version_30.sql31
-rw-r--r--components/test/data/web_database/version_31.sql29
-rw-r--r--components/test/data/web_database/version_32.sql33
-rw-r--r--components/test/data/web_database/version_33.sql32
-rw-r--r--components/test/data/web_database/version_34.sql54
-rw-r--r--components/test/data/web_database/version_35.sql59
-rw-r--r--components/test/data/web_database/version_37.sql26
-rw-r--r--components/test/data/web_database/version_38.sql26
-rw-r--r--components/test/data/web_database/version_39.sql26
-rw-r--r--components/test/data/web_database/version_40.sql29
-rw-r--r--components/test/data/web_database/version_41.sql30
-rw-r--r--components/test/data/web_database/version_42.sql30
-rw-r--r--components/test/data/web_database/version_43.sql31
-rw-r--r--components/test/data/web_database/version_44.sql53
-rw-r--r--components/test/data/web_database/version_45.sql53
-rw-r--r--components/test/data/web_database/version_45_compatible.sql50
-rw-r--r--components/test/data/web_database/version_45_invalid.sql50
-rw-r--r--components/test/data/web_database/version_46.sql31
-rw-r--r--components/test/data/web_database/version_47.sql50
-rw-r--r--components/test/data/web_database/version_48.sql28
-rw-r--r--components/test/data/web_database/version_49.sql31
-rw-r--r--components/webdata/common/web_database.cc27
-rw-r--r--components/webdata/common/web_database.h2
-rw-r--r--components/webdata/common/web_database_migration_unittest.cc1977
36 files changed, 25 insertions, 4064 deletions
diff --git a/components/autofill/core/browser/webdata/autofill_table.cc b/components/autofill/core/browser/webdata/autofill_table.cc
index 14fd62e..9e960cf 100644
--- a/components/autofill/core/browser/webdata/autofill_table.cc
+++ b/components/autofill/core/browser/webdata/autofill_table.cc
@@ -189,37 +189,6 @@ scoped_ptr<CreditCard> CreditCardFromStatement(const sql::Statement& s) {
return credit_card.Pass();
}
-// Obsolete version of AddAutofillProfileNamesToProfile, but still needed
-// for MigrateToVersion37MergeAndCullOlderProfiles().
-bool AddAutofillProfileNamesToProfileForVersion37(sql::Connection* db,
- AutofillProfile* profile) {
- sql::Statement s(db->GetUniqueStatement(
- "SELECT guid, first_name, middle_name, last_name "
- "FROM autofill_profile_names "
- "WHERE guid=?"));
- s.BindString(0, profile->guid());
-
- if (!s.is_valid())
- return false;
-
- std::vector<base::string16> first_names;
- std::vector<base::string16> middle_names;
- std::vector<base::string16> last_names;
- while (s.Step()) {
- DCHECK_EQ(profile->guid(), s.ColumnString(0));
- first_names.push_back(s.ColumnString16(1));
- middle_names.push_back(s.ColumnString16(2));
- last_names.push_back(s.ColumnString16(3));
- }
- if (!s.Succeeded())
- return false;
-
- profile->SetRawMultiInfo(NAME_FIRST, first_names);
- profile->SetRawMultiInfo(NAME_MIDDLE, middle_names);
- profile->SetRawMultiInfo(NAME_LAST, last_names);
- return true;
-}
-
bool AddAutofillProfileNamesToProfile(sql::Connection* db,
AutofillProfile* profile) {
sql::Statement s(db->GetUniqueStatement(
@@ -298,38 +267,6 @@ bool AddAutofillProfilePhonesToProfile(sql::Connection* db,
return true;
}
-// Obsolete version of AddAutofillProfileNames needed for
-// MigrateToVersion33ProfilesBasedOnFirstName() and
-// MigrateToVersion37MergeAndCullOlderProfiles().
-bool AddAutofillProfileNamesForVersion3x(
- const AutofillProfile& profile,
- sql::Connection* db) {
- std::vector<base::string16> first_names;
- profile.GetRawMultiInfo(NAME_FIRST, &first_names);
- std::vector<base::string16> middle_names;
- profile.GetRawMultiInfo(NAME_MIDDLE, &middle_names);
- std::vector<base::string16> last_names;
- profile.GetRawMultiInfo(NAME_LAST, &last_names);
- DCHECK_EQ(first_names.size(), middle_names.size());
- DCHECK_EQ(first_names.size(), last_names.size());
-
- for (size_t i = 0; i < first_names.size(); ++i) {
- // Add the new name.
- sql::Statement s(db->GetUniqueStatement(
- "INSERT INTO autofill_profile_names"
- " (guid, first_name, middle_name, last_name) "
- "VALUES (?,?,?,?)"));
- s.BindString(0, profile.guid());
- s.BindString16(1, first_names[i]);
- s.BindString16(2, middle_names[i]);
- s.BindString16(3, last_names[i]);
-
- if (!s.Run())
- return false;
- }
- return true;
-}
-
bool AddAutofillProfileNames(const AutofillProfile& profile,
sql::Connection* db) {
std::vector<base::string16> first_names;
@@ -511,48 +448,6 @@ bool AutofillTable::MigrateToVersion(int version,
bool* update_compatible_version) {
// Migrate if necessary.
switch (version) {
- case 22:
- return MigrateToVersion22ClearAutofillEmptyValueElements();
- case 23:
- return MigrateToVersion23AddCardNumberEncryptedColumn();
- case 24:
- return MigrateToVersion24CleanupOversizedStringFields();
- case 27:
- *update_compatible_version = true;
- return MigrateToVersion27UpdateLegacyCreditCards();
- case 30:
- *update_compatible_version = true;
- return MigrateToVersion30AddDateModifed();
- case 31:
- *update_compatible_version = true;
- return MigrateToVersion31AddGUIDToCreditCardsAndProfiles();
- case 32:
- *update_compatible_version = true;
- return MigrateToVersion32UpdateProfilesAndCreditCards();
- case 33:
- *update_compatible_version = true;
- return MigrateToVersion33ProfilesBasedOnFirstName();
- case 34:
- *update_compatible_version = true;
- return MigrateToVersion34ProfilesBasedOnCountryCode();
- case 35:
- *update_compatible_version = true;
- return MigrateToVersion35GreatBritainCountryCodes();
- // Combine migrations 36 and 37. This is due to enhancements to the merge
- // step when migrating profiles. The original migration from 35 to 36 did
- // not merge profiles with identical addresses, but the migration from 36 to
- // 37 does. The step from 35 to 36 should only happen on the Chrome 12 dev
- // channel. Chrome 12 beta and release users will jump from 35 to 37
- // directly getting the full benefits of the multi-valued merge as well as
- // the culling of bad data.
- case 37:
- *update_compatible_version = true;
- return MigrateToVersion37MergeAndCullOlderProfiles();
- case 51:
- // Combine migrations 50 and 51. The migration code from version 49 to 50
- // worked correctly for users with existing 'origin' columns, but failed
- // to create these columns for new users.
- return MigrateToVersion51AddOriginColumn();
case 54:
*update_compatible_version = true;
return MigrateToVersion54AddI18nFieldsAndRemoveDeprecatedFields();
@@ -1795,778 +1690,6 @@ bool AutofillTable::InitServerAddressesTable() {
return true;
}
-bool AutofillTable::MigrateToVersion22ClearAutofillEmptyValueElements() {
- if (!db_->DoesTableExist("autofill") &&
- (!db_->Execute("CREATE TABLE autofill ("
- " name VARCHAR,"
- " value VARCHAR,"
- " value_lower VARCHAR,"
- " pair_id INTEGER PRIMARY KEY,"
- " count INTEGER DEFAULT 1)") ||
- !db_->Execute("CREATE INDEX autofill_name ON autofill (name)") ||
- !db_->Execute("CREATE INDEX autofill_name_value_lower ON"
- " autofill (name, value_lower)") ||
- !db_->Execute("CREATE TABLE autofill_dates ("
- " pair_id INTEGER DEFAULT 0,"
- " date_created INTEGER DEFAULT 0)") ||
- !db_->Execute("CREATE INDEX autofill_dates_pair_id ON"
- " autofill (pair_id)")))
- return false;
-
-
- sql::Statement s(db_->GetUniqueStatement(
- "SELECT pair_id FROM autofill WHERE TRIM(value) = \"\""));
- if (!s.is_valid())
- return false;
-
- std::set<int64> ids;
- while (s.Step())
- ids.insert(s.ColumnInt64(0));
- if (!s.Succeeded())
- return false;
-
- if (!db_->Execute("DELETE FROM autofill WHERE TRIM(value) = \"\""))
- return false;
-
- for (std::set<int64>::const_iterator it = ids.begin(); it != ids.end();
- ++it) {
- sql::Statement s(db_->GetUniqueStatement(
- "DELETE FROM autofill_dates WHERE pair_id = ?"));
- s.BindInt64(0, *it);
- if (!s.Run())
- return false;
- }
-
- return true;
-}
-
-// Add the card_number_encrypted column if credit card table was not
-// created in this build (otherwise the column already exists).
-// WARNING: Do not change the order of the execution of the SQL
-// statements in this case! Profile corruption and data migration
-// issues WILL OCCUR. See http://crbug.com/10913
-//
-// The problem is that if a user has a profile which was created before
-// r37036, when the credit_cards table was added, and then failed to
-// update this profile between the credit card addition and the addition
-// of the "encrypted" columns (44963), the next data migration will put
-// the user's profile in an incoherent state: The user will update from
-// a data profile set to be earlier than 22, and therefore pass through
-// this update case. But because the user did not have a credit_cards
-// table before starting Chrome, it will have just been initialized
-// above, and so already have these columns -- and thus this data
-// update step will have failed.
-//
-// The false assumption in this case is that at this step in the
-// migration, the user has a credit card table, and that this
-// table does not include encrypted columns!
-// Because this case does not roll back the complete set of SQL
-// transactions properly in case of failure (that is, it does not
-// roll back the table initialization done above), the incoherent
-// profile will now see itself as being at version 22 -- but include a
-// fully initialized credit_cards table. Every time Chrome runs, it
-// will try to update the web database and fail at this step, unless
-// we allow for the faulty assumption described above by checking for
-// the existence of the columns only AFTER we've executed the commands
-// to add them.
-bool AutofillTable::MigrateToVersion23AddCardNumberEncryptedColumn() {
- if (!db_->DoesTableExist("autofill_profiles") &&
- (!db_->Execute("CREATE TABLE autofill_profiles ( "
- "label VARCHAR, "
- "unique_id INTEGER PRIMARY KEY, "
- "first_name VARCHAR, "
- "middle_name VARCHAR, "
- "last_name VARCHAR, "
- "email VARCHAR, "
- "company_name VARCHAR, "
- "address_line_1 VARCHAR, "
- "address_line_2 VARCHAR, "
- "city VARCHAR, "
- "state VARCHAR, "
- "zipcode VARCHAR, "
- "country VARCHAR, "
- "phone VARCHAR, "
- "fax VARCHAR)") ||
- !db_->Execute("CREATE INDEX autofill_profiles_label_index"
- " ON autofill_profiles (label)")))
- return false;
-
- if (!db_->DoesTableExist("credit_cards") &&
- (!db_->Execute("CREATE TABLE credit_cards ( "
- "label VARCHAR, "
- "unique_id INTEGER PRIMARY KEY, "
- "name_on_card VARCHAR, "
- "type VARCHAR, "
- "card_number VARCHAR, "
- "expiration_month INTEGER, "
- "expiration_year INTEGER, "
- "verification_code VARCHAR, "
- "billing_address VARCHAR, "
- "shipping_address VARCHAR)") ||
- !db_->Execute("CREATE INDEX credit_cards_label_index"
- " ON credit_cards (label)")))
- return false;
-
- if (!db_->DoesColumnExist("credit_cards", "card_number_encrypted")) {
- if (!db_->Execute("ALTER TABLE credit_cards ADD COLUMN "
- "card_number_encrypted BLOB DEFAULT NULL")) {
- return false;
- }
- }
-
- if (!db_->DoesColumnExist("credit_cards", "verification_code_encrypted")) {
- if (!db_->Execute("ALTER TABLE credit_cards ADD COLUMN "
- "verification_code_encrypted BLOB DEFAULT NULL")) {
- return false;
- }
- }
-
- return true;
-}
-
-// One-time cleanup for http://crbug.com/38364 - In the presence of
-// multi-byte UTF-8 characters, that bug could cause Autofill strings
-// to grow larger and more corrupt with each save. The cleanup removes
-// any row with a string field larger than a reasonable size. The string
-// fields examined here are precisely the ones that were subject to
-// corruption by the original bug.
-bool AutofillTable::MigrateToVersion24CleanupOversizedStringFields() {
- const std::string autofill_is_too_big =
- "max(length(name), length(value)) > 500";
-
- const std::string credit_cards_is_too_big =
- "max(length(label), length(name_on_card), length(type), "
- " length(expiration_month), length(expiration_year), "
- " length(billing_address), length(shipping_address) "
- ") > 500";
-
- const std::string autofill_profiles_is_too_big =
- "max(length(label), length(first_name), "
- " length(middle_name), length(last_name), length(email), "
- " length(company_name), length(address_line_1), "
- " length(address_line_2), length(city), length(state), "
- " length(zipcode), length(country), length(phone)) > 500";
-
- std::string query = "DELETE FROM autofill_dates WHERE pair_id IN ("
- "SELECT pair_id FROM autofill WHERE " + autofill_is_too_big + ")";
-
- if (!db_->Execute(query.c_str()))
- return false;
-
- query = "DELETE FROM autofill WHERE " + autofill_is_too_big;
-
- if (!db_->Execute(query.c_str()))
- return false;
-
- // Only delete from legacy credit card tables where specific columns exist.
- if (db_->DoesColumnExist("credit_cards", "label") &&
- db_->DoesColumnExist("credit_cards", "name_on_card") &&
- db_->DoesColumnExist("credit_cards", "type") &&
- db_->DoesColumnExist("credit_cards", "expiration_month") &&
- db_->DoesColumnExist("credit_cards", "expiration_year") &&
- db_->DoesColumnExist("credit_cards", "billing_address") &&
- db_->DoesColumnExist("credit_cards", "shipping_address") &&
- db_->DoesColumnExist("autofill_profiles", "label")) {
- query = "DELETE FROM credit_cards WHERE (" + credit_cards_is_too_big +
- ") OR label IN (SELECT label FROM autofill_profiles WHERE " +
- autofill_profiles_is_too_big + ")";
-
- if (!db_->Execute(query.c_str()))
- return false;
- }
-
- if (db_->DoesColumnExist("autofill_profiles", "label")) {
- query = "DELETE FROM autofill_profiles WHERE " +
- autofill_profiles_is_too_big;
-
- if (!db_->Execute(query.c_str()))
- return false;
- }
-
- return true;
-}
-
-// Change the credit_cards.billing_address column from a string to an
-// int. The stored string is the label of an address, so we have to
-// select the unique ID of this address using the label as a foreign
-// key into the |autofill_profiles| table.
-bool AutofillTable::MigrateToVersion27UpdateLegacyCreditCards() {
- // Only migrate from legacy credit card tables where specific columns
- // exist.
- if (!(db_->DoesColumnExist("credit_cards", "unique_id") &&
- db_->DoesColumnExist("credit_cards", "billing_address") &&
- db_->DoesColumnExist("autofill_profiles", "unique_id"))) {
- return true;
- }
-
- std::string stmt =
- "SELECT credit_cards.unique_id, autofill_profiles.unique_id "
- "FROM autofill_profiles, credit_cards "
- "WHERE credit_cards.billing_address = autofill_profiles.label";
- sql::Statement s(db_->GetUniqueStatement(stmt.c_str()));
-
- std::map<int, int> cc_billing_map;
- while (s.Step())
- cc_billing_map[s.ColumnInt(0)] = s.ColumnInt(1);
- if (!s.Succeeded())
- return false;
-
- // Windows already stores the IDs as strings in |billing_address|. Try
- // to convert those.
- if (cc_billing_map.empty()) {
- std::string stmt = "SELECT unique_id,billing_address FROM credit_cards";
- sql::Statement s(db_->GetUniqueStatement(stmt.c_str()));
-
- while (s.Step()) {
- int id = 0;
- if (base::StringToInt(s.ColumnString(1), &id))
- cc_billing_map[s.ColumnInt(0)] = id;
- }
- if (!s.Succeeded())
- return false;
- }
-
- if (!db_->Execute("CREATE TABLE credit_cards_temp ( "
- "label VARCHAR, "
- "unique_id INTEGER PRIMARY KEY, "
- "name_on_card VARCHAR, "
- "type VARCHAR, "
- "card_number VARCHAR, "
- "expiration_month INTEGER, "
- "expiration_year INTEGER, "
- "verification_code VARCHAR, "
- "billing_address INTEGER, "
- "shipping_address VARCHAR, "
- "card_number_encrypted BLOB, "
- "verification_code_encrypted BLOB)")) {
- return false;
- }
-
- if (!db_->Execute(
- "INSERT INTO credit_cards_temp "
- "SELECT label,unique_id,name_on_card,type,card_number,"
- "expiration_month,expiration_year,verification_code,0,"
- "shipping_address,card_number_encrypted,"
- "verification_code_encrypted FROM credit_cards")) {
- return false;
- }
-
- if (!db_->Execute("DROP TABLE credit_cards"))
- return false;
-
- if (!db_->Execute("ALTER TABLE credit_cards_temp RENAME TO credit_cards"))
- return false;
-
- for (std::map<int, int>::const_iterator iter = cc_billing_map.begin();
- iter != cc_billing_map.end(); ++iter) {
- sql::Statement s(db_->GetCachedStatement(
- SQL_FROM_HERE,
- "UPDATE credit_cards SET billing_address=? WHERE unique_id=?"));
- s.BindInt(0, (*iter).second);
- s.BindInt(1, (*iter).first);
-
- if (!s.Run())
- return false;
- }
-
- return true;
-}
-
-bool AutofillTable::MigrateToVersion30AddDateModifed() {
- // Add date_modified to autofill_profiles.
- if (!db_->DoesColumnExist("autofill_profiles", "date_modified")) {
- if (!db_->Execute("ALTER TABLE autofill_profiles ADD COLUMN "
- "date_modified INTEGER NON NULL DEFAULT 0")) {
- return false;
- }
-
- sql::Statement s(db_->GetUniqueStatement(
- "UPDATE autofill_profiles SET date_modified=?"));
- s.BindInt64(0, Time::Now().ToTimeT());
-
- if (!s.Run())
- return false;
- }
-
- // Add date_modified to credit_cards.
- if (!db_->DoesColumnExist("credit_cards", "date_modified")) {
- if (!db_->Execute("ALTER TABLE credit_cards ADD COLUMN "
- "date_modified INTEGER NON NULL DEFAULT 0")) {
- return false;
- }
-
- sql::Statement s(db_->GetUniqueStatement(
- "UPDATE credit_cards SET date_modified=?"));
- s.BindInt64(0, Time::Now().ToTimeT());
-
- if (!s.Run())
- return false;
- }
-
- return true;
-}
-
-bool AutofillTable::MigrateToVersion31AddGUIDToCreditCardsAndProfiles() {
- // Note that we need to check for the guid column's existence due to the
- // fact that for a version 22 database the |autofill_profiles| table
- // gets created fresh with |InitAutofillProfilesTable|.
- if (!db_->DoesColumnExist("autofill_profiles", "guid")) {
- if (!db_->Execute("ALTER TABLE autofill_profiles ADD COLUMN "
- "guid VARCHAR NOT NULL DEFAULT \"\"")) {
- return false;
- }
-
- // Set all the |guid| fields to valid values.
-
- sql::Statement s(db_->GetUniqueStatement("SELECT unique_id "
- "FROM autofill_profiles"));
-
- while (s.Step()) {
- sql::Statement update_s(
- db_->GetUniqueStatement("UPDATE autofill_profiles "
- "SET guid=? WHERE unique_id=?"));
- update_s.BindString(0, base::GenerateGUID());
- update_s.BindInt(1, s.ColumnInt(0));
-
- if (!update_s.Run())
- return false;
- }
- if (!s.Succeeded())
- return false;
- }
-
- // Note that we need to check for the guid column's existence due to the
- // fact that for a version 22 database the |autofill_profiles| table
- // gets created fresh with |InitAutofillProfilesTable|.
- if (!db_->DoesColumnExist("credit_cards", "guid")) {
- if (!db_->Execute("ALTER TABLE credit_cards ADD COLUMN "
- "guid VARCHAR NOT NULL DEFAULT \"\"")) {
- return false;
- }
-
- // Set all the |guid| fields to valid values.
-
- sql::Statement s(db_->GetUniqueStatement("SELECT unique_id "
- "FROM credit_cards"));
-
- while (s.Step()) {
- sql::Statement update_s(
- db_->GetUniqueStatement("UPDATE credit_cards "
- "set guid=? WHERE unique_id=?"));
- update_s.BindString(0, base::GenerateGUID());
- update_s.BindInt(1, s.ColumnInt(0));
-
- if (!update_s.Run())
- return false;
- }
- if (!s.Succeeded())
- return false;
- }
-
- return true;
-}
-
-bool AutofillTable::MigrateToVersion32UpdateProfilesAndCreditCards() {
- if (db_->DoesColumnExist("autofill_profiles", "unique_id")) {
- if (!db_->Execute("CREATE TABLE autofill_profiles_temp ( "
- "guid VARCHAR PRIMARY KEY, "
- "label VARCHAR, "
- "first_name VARCHAR, "
- "middle_name VARCHAR, "
- "last_name VARCHAR, "
- "email VARCHAR, "
- "company_name VARCHAR, "
- "address_line_1 VARCHAR, "
- "address_line_2 VARCHAR, "
- "city VARCHAR, "
- "state VARCHAR, "
- "zipcode VARCHAR, "
- "country VARCHAR, "
- "phone VARCHAR, "
- "date_modified INTEGER NOT NULL DEFAULT 0)")) {
- return false;
- }
-
- if (!db_->Execute(
- "INSERT INTO autofill_profiles_temp "
- "SELECT guid, label, first_name, middle_name, last_name, email, "
- "company_name, address_line_1, address_line_2, city, state, "
- "zipcode, country, phone, date_modified "
- "FROM autofill_profiles")) {
- return false;
- }
-
- if (!db_->Execute("DROP TABLE autofill_profiles"))
- return false;
-
- if (!db_->Execute(
- "ALTER TABLE autofill_profiles_temp RENAME TO autofill_profiles")) {
- return false;
- }
- }
-
- if (db_->DoesColumnExist("credit_cards", "unique_id")) {
- if (!db_->Execute("CREATE TABLE credit_cards_temp ( "
- "guid VARCHAR PRIMARY KEY, "
- "label VARCHAR, "
- "name_on_card VARCHAR, "
- "expiration_month INTEGER, "
- "expiration_year INTEGER, "
- "card_number_encrypted BLOB, "
- "date_modified INTEGER NOT NULL DEFAULT 0)")) {
- return false;
- }
-
- if (!db_->Execute(
- "INSERT INTO credit_cards_temp "
- "SELECT guid, label, name_on_card, expiration_month, "
- "expiration_year, card_number_encrypted, date_modified "
- "FROM credit_cards")) {
- return false;
- }
-
- if (!db_->Execute("DROP TABLE credit_cards"))
- return false;
-
- if (!db_->Execute("ALTER TABLE credit_cards_temp RENAME TO credit_cards"))
- return false;
- }
-
- return true;
-}
-
-// Test the existence of the |first_name| column as an indication that
-// we need a migration. It is possible that the new |autofill_profiles|
-// schema is in place because the table was newly created when migrating
-// from a pre-version-22 database.
-bool AutofillTable::MigrateToVersion33ProfilesBasedOnFirstName() {
- if (!db_->DoesTableExist("autofill_profile_names") &&
- !db_->Execute("CREATE TABLE autofill_profile_names ( "
- "guid VARCHAR, "
- "first_name VARCHAR, "
- "middle_name VARCHAR, "
- "last_name VARCHAR)"))
- return false;
-
- if (!db_->DoesTableExist("autofill_profile_emails") &&
- !db_->Execute("CREATE TABLE autofill_profile_emails ( "
- "guid VARCHAR, "
- "email VARCHAR)"))
- return false;
-
- if (!db_->DoesTableExist("autofill_profile_phones") &&
- !db_->Execute("CREATE TABLE autofill_profile_phones ( "
- "guid VARCHAR, "
- "type INTEGER DEFAULT 0, "
- "number VARCHAR)"))
- return false;
-
- if (db_->DoesColumnExist("autofill_profiles", "first_name")) {
- // Create autofill_profiles_temp table that will receive the data.
- if (!db_->DoesTableExist("autofill_profiles_temp")) {
- if (!db_->Execute("CREATE TABLE autofill_profiles_temp ( "
- "guid VARCHAR PRIMARY KEY, "
- "company_name VARCHAR, "
- "address_line_1 VARCHAR, "
- "address_line_2 VARCHAR, "
- "city VARCHAR, "
- "state VARCHAR, "
- "zipcode VARCHAR, "
- "country VARCHAR, "
- "date_modified INTEGER NOT NULL DEFAULT 0)")) {
- return false;
- }
- }
-
- sql::Statement s(db_->GetUniqueStatement(
- "SELECT guid, first_name, middle_name, last_name, email, "
- "company_name, address_line_1, address_line_2, city, state, "
- "zipcode, country, phone, date_modified "
- "FROM autofill_profiles"));
-
- while (s.Step()) {
- AutofillProfile profile;
- int index = 0;
- profile.set_guid(s.ColumnString(index++));
- DCHECK(base::IsValidGUID(profile.guid()));
-
- profile.SetRawInfo(NAME_FIRST, s.ColumnString16(index++));
- profile.SetRawInfo(NAME_MIDDLE, s.ColumnString16(index++));
- profile.SetRawInfo(NAME_LAST, s.ColumnString16(index++));
- profile.SetRawInfo(EMAIL_ADDRESS, s.ColumnString16(index++));
- profile.SetRawInfo(COMPANY_NAME, s.ColumnString16(index++));
- profile.SetRawInfo(ADDRESS_HOME_LINE1, s.ColumnString16(index++));
- profile.SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(index++));
- profile.SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(index++));
- profile.SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(index++));
- profile.SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(index++));
- profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY),
- s.ColumnString16(index++), app_locale_);
- profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(index++));
- int64 date_modified = s.ColumnInt64(index++);
-
- sql::Statement s_insert(db_->GetUniqueStatement(
- "INSERT INTO autofill_profiles_temp"
- "(guid, company_name, address_line_1, address_line_2, city,"
- " state, zipcode, country, date_modified)"
- "VALUES (?,?,?,?,?,?,?,?,?)"));
- index = 0;
- s_insert.BindString(index++, profile.guid());
- s_insert.BindString16(index++, profile.GetRawInfo(COMPANY_NAME));
- s_insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_LINE1));
- s_insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_LINE2));
- s_insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_CITY));
- s_insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_STATE));
- s_insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_ZIP));
- s_insert.BindString16(index++, profile.GetRawInfo(ADDRESS_HOME_COUNTRY));
- s_insert.BindInt64(index++, date_modified);
-
- if (!s_insert.Run())
- return false;
-
- // Add the other bits: names, emails, and phone numbers.
- if (!AddAutofillProfileNamesForVersion3x(profile, db_) ||
- !AddAutofillProfileEmails(profile, db_) ||
- !AddAutofillProfilePhones(profile, db_)) {
- return false;
- }
- } // endwhile
- if (!s.Succeeded())
- return false;
-
- if (!db_->Execute("DROP TABLE autofill_profiles"))
- return false;
-
- if (!db_->Execute(
- "ALTER TABLE autofill_profiles_temp RENAME TO autofill_profiles")) {
- return false;
- }
- }
-
- // Remove the labels column from the credit_cards table.
- if (db_->DoesColumnExist("credit_cards", "label")) {
- if (!db_->Execute("CREATE TABLE credit_cards_temp ( "
- "guid VARCHAR PRIMARY KEY, "
- "name_on_card VARCHAR, "
- "expiration_month INTEGER, "
- "expiration_year INTEGER, "
- "card_number_encrypted BLOB, "
- "date_modified INTEGER NOT NULL DEFAULT 0)")) {
- return false;
- }
-
- if (!db_->Execute(
- "INSERT INTO credit_cards_temp "
- "SELECT guid, name_on_card, expiration_month, "
- "expiration_year, card_number_encrypted, date_modified "
- "FROM credit_cards")) {
- return false;
- }
-
- if (!db_->Execute("DROP TABLE credit_cards"))
- return false;
-
- if (!db_->Execute("ALTER TABLE credit_cards_temp RENAME TO credit_cards"))
- return false;
- }
-
- return true;
-}
-
-// Test the existence of the |country_code| column as an indication that
-// we need a migration. It is possible that the new |autofill_profiles|
-// schema is in place because the table was newly created when migrating
-// from a pre-version-22 database.
-bool AutofillTable::MigrateToVersion34ProfilesBasedOnCountryCode() {
- if (!db_->DoesColumnExist("autofill_profiles", "country_code")) {
- if (!db_->Execute("ALTER TABLE autofill_profiles ADD COLUMN "
- "country_code VARCHAR")) {
- return false;
- }
-
- // Set all the |country_code| fields to match existing |country| values.
- sql::Statement s(db_->GetUniqueStatement("SELECT guid, country "
- "FROM autofill_profiles"));
-
- while (s.Step()) {
- sql::Statement update_s(
- db_->GetUniqueStatement("UPDATE autofill_profiles "
- "SET country_code=? WHERE guid=?"));
-
- base::string16 country = s.ColumnString16(1);
- update_s.BindString(0, AutofillCountry::GetCountryCode(country,
- app_locale_));
- update_s.BindString(1, s.ColumnString(0));
-
- if (!update_s.Run())
- return false;
- }
- if (!s.Succeeded())
- return false;
- }
-
- return true;
-}
-
-// Correct all country codes with value "UK" to be "GB". This data
-// was mistakenly introduced in build 686.0. This migration is to clean
-// it up. See http://crbug.com/74511 for details.
-bool AutofillTable::MigrateToVersion35GreatBritainCountryCodes() {
- sql::Statement s(db_->GetUniqueStatement(
- "UPDATE autofill_profiles SET country_code=\"GB\" "
- "WHERE country_code=\"UK\""));
-
- return s.Run();
-}
-
-// Merge and cull older profiles where possible.
-bool AutofillTable::MigrateToVersion37MergeAndCullOlderProfiles() {
- if (!db_->DoesTableExist("autofill_profiles_trash") &&
- !db_->Execute("CREATE TABLE autofill_profiles_trash (guid VARCHAR)"))
- return false;
-
- sql::Statement s(db_->GetUniqueStatement(
- "SELECT guid, date_modified FROM autofill_profiles"));
-
- // Accumulate the good profiles.
- std::vector<AutofillProfile> accumulated_profiles;
- std::vector<AutofillProfile*> accumulated_profiles_p;
- std::map<std::string, int64> modification_map;
- while (s.Step()) {
- std::string guid = s.ColumnString(0);
- int64 date_modified = s.ColumnInt64(1);
- modification_map.insert(
- std::pair<std::string, int64>(guid, date_modified));
-
- sql::Statement s(db_->GetUniqueStatement(
- "SELECT guid, company_name, address_line_1, address_line_2, city, "
- " state, zipcode, country, country_code, date_modified "
- "FROM autofill_profiles "
- "WHERE guid=?"));
- s.BindString(0, guid);
-
- if (!s.Step())
- return false;
-
- scoped_ptr<AutofillProfile> profile(new AutofillProfile);
- int index = 0;
- profile->set_guid(s.ColumnString(index++));
- DCHECK(base::IsValidGUID(profile->guid()));
-
- profile->SetRawInfo(COMPANY_NAME, s.ColumnString16(index++));
- profile->SetRawInfo(ADDRESS_HOME_LINE1, s.ColumnString16(index++));
- profile->SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(index++));
- profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(index++));
- profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(index++));
- profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(index++));
- // Intentionally skip column 7, which stores the localized country name.
- index++;
- profile->SetRawInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(index++));
- profile->set_modification_date(
- base::Time::FromTimeT(s.ColumnInt64(index++)));
- profile->set_origin(s.ColumnString(index++));
-
- // Get associated name info.
- AddAutofillProfileNamesToProfileForVersion37(db_, profile.get());
-
- // Get associated email info.
- AddAutofillProfileEmailsToProfile(db_, profile.get());
-
- // Get associated phone info.
- AddAutofillProfilePhonesToProfile(db_, profile.get());
-
- if (PersonalDataManager::IsValidLearnableProfile(*profile, app_locale_)) {
- std::vector<AutofillProfile> merged_profiles;
- std::string merged_guid = PersonalDataManager::MergeProfile(
- *profile, accumulated_profiles_p, app_locale_, &merged_profiles);
-
- std::swap(accumulated_profiles, merged_profiles);
-
- accumulated_profiles_p.clear();
- accumulated_profiles_p.resize(accumulated_profiles.size());
- std::transform(accumulated_profiles.begin(),
- accumulated_profiles.end(),
- accumulated_profiles_p.begin(),
- address_of<AutofillProfile>);
-
- // If the profile got merged trash the original.
- if (merged_guid != profile->guid())
- AddAutofillGUIDToTrash(profile->guid());
- } else {
- // An invalid profile, so trash it.
- AddAutofillGUIDToTrash(profile->guid());
- }
- } // endwhile
- if (!s.Succeeded())
- return false;
-
- // Drop the current profiles.
- if (!ClearAutofillProfiles())
- return false;
-
- // Add the newly merged profiles back in.
- for (std::vector<AutofillProfile>::const_iterator
- iter = accumulated_profiles.begin();
- iter != accumulated_profiles.end();
- ++iter) {
- // Save the profile with its original modification date.
- std::map<std::string, int64>::const_iterator date_item =
- modification_map.find(iter->guid());
- if (date_item == modification_map.end())
- return false;
-
- sql::Statement s(db_->GetUniqueStatement(
- "INSERT INTO autofill_profiles"
- "(guid, company_name, address_line_1, address_line_2, city, state,"
- " zipcode, country, country_code, date_modified)"
- "VALUES (?,?,?,?,?,?,?,?,?,?)"));
- int index = 0;
- s.BindString(index++, iter->guid());
- s.BindString16(index++, GetInfo(*iter, COMPANY_NAME));
- s.BindString16(index++, GetInfo(*iter, ADDRESS_HOME_LINE1));
- s.BindString16(index++, GetInfo(*iter, ADDRESS_HOME_LINE2));
- s.BindString16(index++, GetInfo(*iter, ADDRESS_HOME_CITY));
- s.BindString16(index++, GetInfo(*iter, ADDRESS_HOME_STATE));
- s.BindString16(index++, GetInfo(*iter, ADDRESS_HOME_ZIP));
- s.BindString16(index++, base::string16()); // This column is deprecated.
- s.BindString16(index++, GetInfo(*iter, ADDRESS_HOME_COUNTRY));
- s.BindInt64(index++, date_item->second);
-
- if (!s.Run())
- return false;
-
- if (!AddAutofillProfileNamesForVersion3x(*iter, db_) ||
- !AddAutofillProfileEmails(*iter, db_) ||
- !AddAutofillProfilePhones(*iter, db_)) {
- return false;
- }
- }
-
- return true;
-}
-
-bool AutofillTable::MigrateToVersion51AddOriginColumn() {
- sql::Transaction transaction(db_);
- if (!transaction.Begin())
- return false;
-
- // Add origin to autofill_profiles.
- if (!db_->DoesColumnExist("autofill_profiles", "origin") &&
- !db_->Execute("ALTER TABLE autofill_profiles "
- "ADD COLUMN origin VARCHAR DEFAULT ''")) {
- return false;
- }
-
- // Add origin to credit_cards.
- if (!db_->DoesColumnExist("credit_cards", "origin") &&
- !db_->Execute("ALTER TABLE credit_cards "
- "ADD COLUMN origin VARCHAR DEFAULT ''")) {
- return false;
- }
-
- return transaction.Commit();
-}
-
bool AutofillTable::MigrateToVersion54AddI18nFieldsAndRemoveDeprecatedFields() {
sql::Transaction transaction(db_);
if (!transaction.Begin())
diff --git a/components/autofill/core/browser/webdata/autofill_table.h b/components/autofill/core/browser/webdata/autofill_table.h
index a25006a..bd1744a 100644
--- a/components/autofill/core/browser/webdata/autofill_table.h
+++ b/components/autofill/core/browser/webdata/autofill_table.h
@@ -358,20 +358,6 @@ class AutofillTable : public WebDatabaseTable {
bool ClearAutofillProfiles();
// Table migration functions.
- // Removes empty values for autofill that were incorrectly stored in the DB
- // See bug http://crbug.com/6111
- bool MigrateToVersion22ClearAutofillEmptyValueElements();
- bool MigrateToVersion23AddCardNumberEncryptedColumn();
- bool MigrateToVersion24CleanupOversizedStringFields();
- bool MigrateToVersion27UpdateLegacyCreditCards();
- bool MigrateToVersion30AddDateModifed();
- bool MigrateToVersion31AddGUIDToCreditCardsAndProfiles();
- bool MigrateToVersion32UpdateProfilesAndCreditCards();
- bool MigrateToVersion33ProfilesBasedOnFirstName();
- bool MigrateToVersion34ProfilesBasedOnCountryCode();
- bool MigrateToVersion35GreatBritainCountryCodes();
- bool MigrateToVersion37MergeAndCullOlderProfiles();
- bool MigrateToVersion51AddOriginColumn();
bool MigrateToVersion54AddI18nFieldsAndRemoveDeprecatedFields();
bool MigrateToVersion55MergeAutofillDatesTable();
bool MigrateToVersion56AddProfileLanguageCodeForFormatting();
diff --git a/components/search_engines/keyword_table.cc b/components/search_engines/keyword_table.cc
index 08dea92..59dff73 100644
--- a/components/search_engines/keyword_table.cc
+++ b/components/search_engines/keyword_table.cc
@@ -193,45 +193,6 @@ bool KeywordTable::MigrateToVersion(int version,
bool* update_compatible_version) {
// Migrate if necessary.
switch (version) {
- case 21:
- *update_compatible_version = true;
- return MigrateToVersion21AutoGenerateKeywordColumn();
- case 25:
- *update_compatible_version = true;
- return MigrateToVersion25AddLogoIDColumn();
- case 26:
- *update_compatible_version = true;
- return MigrateToVersion26AddCreatedByPolicyColumn();
- case 28:
- *update_compatible_version = true;
- return MigrateToVersion28SupportsInstantColumn();
- case 29:
- *update_compatible_version = true;
- return MigrateToVersion29InstantURLToSupportsInstant();
- case 38:
- *update_compatible_version = true;
- return MigrateToVersion38AddLastModifiedColumn();
- case 39:
- *update_compatible_version = true;
- return MigrateToVersion39AddSyncGUIDColumn();
- case 44:
- *update_compatible_version = true;
- return MigrateToVersion44AddDefaultSearchProviderBackup();
- case 45:
- *update_compatible_version = true;
- return MigrateToVersion45RemoveLogoIDAndAutogenerateColumns();
- case 47:
- *update_compatible_version = true;
- return MigrateToVersion47AddAlternateURLsColumn();
- case 48:
- *update_compatible_version = true;
- return MigrateToVersion48RemoveKeywordsBackup();
- case 49:
- *update_compatible_version = true;
- return MigrateToVersion49AddSearchTermsReplacementKeyColumn();
- case 52:
- *update_compatible_version = true;
- return MigrateToVersion52AddImageSearchAndPOSTSupport();
case 53:
*update_compatible_version = true;
return MigrateToVersion53AddNewTabURLColumn();
@@ -315,140 +276,6 @@ std::string KeywordTable::GetKeywordColumns() {
return ColumnsForVersion(WebDatabase::kCurrentVersionNumber, false);
}
-bool KeywordTable::MigrateToVersion21AutoGenerateKeywordColumn() {
- return db_->Execute("ALTER TABLE keywords ADD COLUMN autogenerate_keyword "
- "INTEGER DEFAULT 0");
-}
-
-bool KeywordTable::MigrateToVersion25AddLogoIDColumn() {
- return db_->Execute(
- "ALTER TABLE keywords ADD COLUMN logo_id INTEGER DEFAULT 0");
-}
-
-bool KeywordTable::MigrateToVersion26AddCreatedByPolicyColumn() {
- return db_->Execute("ALTER TABLE keywords ADD COLUMN created_by_policy "
- "INTEGER DEFAULT 0");
-}
-
-bool KeywordTable::MigrateToVersion28SupportsInstantColumn() {
- return db_->Execute("ALTER TABLE keywords ADD COLUMN supports_instant "
- "INTEGER DEFAULT 0");
-}
-
-bool KeywordTable::MigrateToVersion29InstantURLToSupportsInstant() {
- sql::Transaction transaction(db_);
- return transaction.Begin() &&
- db_->Execute("ALTER TABLE keywords ADD COLUMN instant_url VARCHAR") &&
- db_->Execute("CREATE TABLE keywords_temp ("
- "id INTEGER PRIMARY KEY,"
- "short_name VARCHAR NOT NULL,"
- "keyword VARCHAR NOT NULL,"
- "favicon_url VARCHAR NOT NULL,"
- "url VARCHAR NOT NULL,"
- "safe_for_autoreplace INTEGER,"
- "originating_url VARCHAR,"
- "date_created INTEGER DEFAULT 0,"
- "usage_count INTEGER DEFAULT 0,"
- "input_encodings VARCHAR,"
- "show_in_default_list INTEGER,"
- "suggest_url VARCHAR,"
- "prepopulate_id INTEGER DEFAULT 0,"
- "autogenerate_keyword INTEGER DEFAULT 0,"
- "logo_id INTEGER DEFAULT 0,"
- "created_by_policy INTEGER DEFAULT 0,"
- "instant_url VARCHAR)") &&
- db_->Execute("INSERT INTO keywords_temp SELECT id, short_name, keyword, "
- "favicon_url, url, safe_for_autoreplace, originating_url, "
- "date_created, usage_count, input_encodings, "
- "show_in_default_list, suggest_url, prepopulate_id, "
- "autogenerate_keyword, logo_id, created_by_policy, "
- "instant_url FROM keywords") &&
- db_->Execute("DROP TABLE keywords") &&
- db_->Execute("ALTER TABLE keywords_temp RENAME TO keywords") &&
- transaction.Commit();
-}
-
-bool KeywordTable::MigrateToVersion38AddLastModifiedColumn() {
- return db_->Execute(
- "ALTER TABLE keywords ADD COLUMN last_modified INTEGER DEFAULT 0");
-}
-
-bool KeywordTable::MigrateToVersion39AddSyncGUIDColumn() {
- return db_->Execute("ALTER TABLE keywords ADD COLUMN sync_guid VARCHAR");
-}
-
-bool KeywordTable::MigrateToVersion44AddDefaultSearchProviderBackup() {
- std::string query("CREATE TABLE keywords_backup AS SELECT " +
- ColumnsForVersion(44, false) + " FROM keywords ORDER BY id ASC");
- sql::Transaction transaction(db_);
- return transaction.Begin() &&
- meta_table_->SetValue("Default Search Provider ID Backup",
- GetDefaultSearchProviderID()) &&
- (!db_->DoesTableExist("keywords_backup") ||
- db_->Execute("DROP TABLE keywords_backup")) &&
- db_->Execute(query.c_str()) &&
- transaction.Commit();
-}
-
-bool KeywordTable::MigrateToVersion45RemoveLogoIDAndAutogenerateColumns() {
- sql::Transaction transaction(db_);
- if (!transaction.Begin())
- return false;
-
- // The version 43 migration should have been written to do this, but since it
- // wasn't, we'll do it now. Unfortunately a previous change deleted this for
- // some users, so we can't be sure this will succeed (so don't bail on error).
- meta_table_->DeleteKey("Default Search Provider Backup");
-
- return MigrateKeywordsTableForVersion45("keywords") &&
- MigrateKeywordsTableForVersion45("keywords_backup") &&
- meta_table_->SetValue("Default Search Provider ID Backup Signature",
- std::string()) &&
- transaction.Commit();
-}
-
-bool KeywordTable::MigrateToVersion47AddAlternateURLsColumn() {
- sql::Transaction transaction(db_);
- return transaction.Begin() &&
- db_->Execute("ALTER TABLE keywords ADD COLUMN "
- "alternate_urls VARCHAR DEFAULT ''") &&
- db_->Execute("ALTER TABLE keywords_backup ADD COLUMN "
- "alternate_urls VARCHAR DEFAULT ''") &&
- meta_table_->SetValue("Default Search Provider ID Backup Signature",
- std::string()) &&
- transaction.Commit();
-}
-
-bool KeywordTable::MigrateToVersion48RemoveKeywordsBackup() {
- sql::Transaction transaction(db_);
- return transaction.Begin() &&
- meta_table_->DeleteKey("Default Search Provider ID Backup") &&
- meta_table_->DeleteKey("Default Search Provider ID Backup Signature") &&
- db_->Execute("DROP TABLE keywords_backup") &&
- transaction.Commit();
-}
-
-bool KeywordTable::MigrateToVersion49AddSearchTermsReplacementKeyColumn() {
- return db_->Execute("ALTER TABLE keywords ADD COLUMN "
- "search_terms_replacement_key VARCHAR DEFAULT ''");
-}
-
-bool KeywordTable::MigrateToVersion52AddImageSearchAndPOSTSupport() {
- sql::Transaction transaction(db_);
- return transaction.Begin() &&
- db_->Execute("ALTER TABLE keywords ADD COLUMN image_url "
- "VARCHAR DEFAULT ''") &&
- db_->Execute("ALTER TABLE keywords ADD COLUMN search_url_post_params "
- "VARCHAR DEFAULT ''") &&
- db_->Execute("ALTER TABLE keywords ADD COLUMN suggest_url_post_params "
- "VARCHAR DEFAULT ''") &&
- db_->Execute("ALTER TABLE keywords ADD COLUMN instant_url_post_params "
- "VARCHAR DEFAULT ''") &&
- db_->Execute("ALTER TABLE keywords ADD COLUMN image_url_post_params "
- "VARCHAR DEFAULT ''") &&
- transaction.Commit();
-}
-
bool KeywordTable::MigrateToVersion53AddNewTabURLColumn() {
return db_->Execute("ALTER TABLE keywords ADD COLUMN new_tab_url "
"VARCHAR DEFAULT ''");
diff --git a/components/search_engines/keyword_table.h b/components/search_engines/keyword_table.h
index 62e7e79..ef45694 100644
--- a/components/search_engines/keyword_table.h
+++ b/components/search_engines/keyword_table.h
@@ -126,19 +126,6 @@ class KeywordTable : public WebDatabaseTable {
static std::string GetKeywordColumns();
// Table migration functions.
- bool MigrateToVersion21AutoGenerateKeywordColumn();
- bool MigrateToVersion25AddLogoIDColumn();
- bool MigrateToVersion26AddCreatedByPolicyColumn();
- bool MigrateToVersion28SupportsInstantColumn();
- bool MigrateToVersion29InstantURLToSupportsInstant();
- bool MigrateToVersion38AddLastModifiedColumn();
- bool MigrateToVersion39AddSyncGUIDColumn();
- bool MigrateToVersion44AddDefaultSearchProviderBackup();
- bool MigrateToVersion45RemoveLogoIDAndAutogenerateColumns();
- bool MigrateToVersion47AddAlternateURLsColumn();
- bool MigrateToVersion48RemoveKeywordsBackup();
- bool MigrateToVersion49AddSearchTermsReplacementKeyColumn();
- bool MigrateToVersion52AddImageSearchAndPOSTSupport();
bool MigrateToVersion53AddNewTabURLColumn();
bool MigrateToVersion59RemoveExtensionKeywords();
diff --git a/components/test/data/web_database/version_20.sql b/components/test/data/web_database/version_20.sql
deleted file mode 100644
index c3913ef..0000000
--- a/components/test/data/web_database/version_20.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','20');
-INSERT INTO "meta" VALUES('last_compatible_version','20');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','27');
-INSERT INTO "meta" VALUES('Default Search Provider ID','7');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL, keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1);
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2);
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3);
-INSERT INTO "keywords" VALUES(5,'Wikipedia (en)','en.wikipedia.org','','http://en.wikipedia.org/w/index.php?title=Special:Search&search={searchTerms}',1,0,'',1283287335,0,'','',0);
-INSERT INTO "keywords" VALUES(6,'NYTimes','query.nytimes.com','','http://query.nytimes.com/gst/handler.html?query={searchTerms}&opensearch=1',1,0,'',1283287335,0,'','',0);
-INSERT INTO "keywords" VALUES(7,'eBay','rover.ebay.com','','http://rover.ebay.com/rover/1/711-43047-14818-1/4?satitle={searchTerms}',1,0,'',1283287335,0,'','',0);
-INSERT INTO "keywords" VALUES(8,'ff','ff','','http://ff{searchTerms}',0,0,'',1283287356,0,'','',0);
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR,signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE ie7_logins (url_hash VARCHAR NOT NULL, password_value BLOB, date_created INTEGER NOT NULL,UNIQUE (url_hash));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX ie7_logins_hash ON ie7_logins (url_hash);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-COMMIT;
diff --git a/components/test/data/web_database/version_21.sql b/components/test/data/web_database/version_21.sql
deleted file mode 100644
index a77ab7e..0000000
--- a/components/test/data/web_database/version_21.sql
+++ /dev/null
@@ -1,40 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','21');
-INSERT INTO "meta" VALUES('last_compatible_version','21');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','27');
-INSERT INTO "meta" VALUES('Default Search Provider ID','7');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL, keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1);
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0);
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0);
-INSERT INTO "keywords" VALUES(5,'Wikipedia (en)','en.wikipedia.org','','http://en.wikipedia.org/w/index.php?title=Special:Search&search={searchTerms}',1,0,'',1283287335,0,'','',0,0);
-INSERT INTO "keywords" VALUES(6,'NYTimes','query.nytimes.com','','http://query.nytimes.com/gst/handler.html?query={searchTerms}&opensearch=1',1,0,'',1283287335,0,'','',0,0);
-INSERT INTO "keywords" VALUES(7,'eBay','rover.ebay.com','','http://rover.ebay.com/rover/1/711-43047-14818-1/4?satitle={searchTerms}',1,0,'',1283287335,0,'','',0,0);
-INSERT INTO "keywords" VALUES(8,'ff','ff','','http://ff{searchTerms}',0,0,'',1283287356,0,'','',0,0);
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR,signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE ie7_logins (url_hash VARCHAR NOT NULL, password_value BLOB, date_created INTEGER NOT NULL,UNIQUE (url_hash));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-INSERT INTO "autofill" VALUES('Name','John Doe','john doe',10,1);
-INSERT INTO "autofill" VALUES('Name','','',11,1);
-INSERT INTO "autofill" VALUES('Email','jane@example.com','jane@example.com',20,3);
-INSERT INTO "autofill" VALUES('Email','','',21,4);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0,date_created INTEGER DEFAULT 0);
-INSERT INTO "autofill_dates" VALUES(10,1384299100);
-INSERT INTO "autofill_dates" VALUES(11,1384299200);
-INSERT INTO "autofill_dates" VALUES(20,1384299300);
-INSERT INTO "autofill_dates" VALUES(20,1384299301);
-INSERT INTO "autofill_dates" VALUES(21,1384299401);
-INSERT INTO "autofill_dates" VALUES(21,1384299400);
-INSERT INTO "autofill_dates" VALUES(21,1384299403);
-INSERT INTO "autofill_dates" VALUES(21,1384299402);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX ie7_logins_hash ON ie7_logins (url_hash);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
diff --git a/components/test/data/web_database/version_22.sql b/components/test/data/web_database/version_22.sql
deleted file mode 100644
index c7cc8b5..0000000
--- a/components/test/data/web_database/version_22.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','22');
-INSERT INTO "meta" VALUES('last_compatible_version','21');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','27');
-INSERT INTO "meta" VALUES('Default Search Provider ID','7');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL, keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1);
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0);
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0);
-INSERT INTO "keywords" VALUES(5,'Wikipedia (en)','en.wikipedia.org','','http://en.wikipedia.org/w/index.php?title=Special:Search&search={searchTerms}',1,0,'',1283287335,0,'','',0,0);
-INSERT INTO "keywords" VALUES(6,'NYTimes','query.nytimes.com','','http://query.nytimes.com/gst/handler.html?query={searchTerms}&opensearch=1',1,0,'',1283287335,0,'','',0,0);
-INSERT INTO "keywords" VALUES(7,'eBay','rover.ebay.com','','http://rover.ebay.com/rover/1/711-43047-14818-1/4?satitle={searchTerms}',1,0,'',1283287335,0,'','',0,0);
-INSERT INTO "keywords" VALUES(8,'ff','ff','','http://ff{searchTerms}',0,0,'',1283287356,0,'','',0,0);
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR,signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE ie7_logins (url_hash VARCHAR NOT NULL, password_value BLOB, date_created INTEGER NOT NULL,UNIQUE (url_hash));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0,date_created INTEGER DEFAULT 0);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX ie7_logins_hash ON ie7_logins (url_hash);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
diff --git a/components/test/data/web_database/version_22_corrupt.sql b/components/test/data/web_database/version_22_corrupt.sql
deleted file mode 100644
index 82d9b3f..0000000
--- a/components/test/data/web_database/version_22_corrupt.sql
+++ /dev/null
@@ -1,32 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','22');
-INSERT INTO "meta" VALUES('last_compatible_version','21');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','29');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1);
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0);
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0);
-INSERT INTO "keywords" VALUES(5,'Wikipedia (en)','en.wikipedia.org','','http://en.wikipedia.org/w/index.php?title=Special:Search&search={searchTerms}',1,0,'',1283287335,0,'','',0,0);
-INSERT INTO "keywords" VALUES(6,'NYTimes','query.nytimes.com','','http://query.nytimes.com/gst/handler.html?query={searchTerms}&opensearch=1',1,0,'',1283287335,0,'','',0,0);
-INSERT INTO "keywords" VALUES(7,'eBay','rover.ebay.com','','http://rover.ebay.com/rover/1/711-43047-14818-1/4?satitle={searchTerms}',1,0,'',1283287335,0,'','',0,0);
-INSERT INTO "keywords" VALUES(8,'ff','ff','','http://ff{searchTerms}',0,0,'',1283287356,0,'','',0,0);
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL, ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL, date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL, scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE ie7_logins (url_hash VARCHAR NOT NULL, password_value BLOB,date_created INTEGER NOT NULL,UNIQUE (url_hash));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0,date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( label VARCHAR, unique_id INTEGER PRIMARY KEY, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, email VARCHAR, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, phone VARCHAR, fax VARCHAR);
-CREATE TABLE credit_cards ( label VARCHAR, unique_id INTEGER PRIMARY KEY, name_on_card VARCHAR, type VARCHAR,card_number VARCHAR, expiration_month INTEGER, expiration_year INTEGER, verification_code VARCHAR, billing_address VARCHAR, shipping_address VARCHAR, card_number_encrypted BLOB, verification_code_encrypted BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX ie7_logins_hash ON ie7_logins (url_hash);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX autofill_profiles_label_index ON autofill_profiles (label);
-CREATE INDEX credit_cards_label_index ON credit_cards (label);
-COMMIT;
diff --git a/components/test/data/web_database/version_25.sql b/components/test/data/web_database/version_25.sql
deleted file mode 100644
index 986ca9f..0000000
--- a/components/test/data/web_database/version_25.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','25');
-INSERT INTO "meta" VALUES('last_compatible_version','25');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','29');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0);
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR,username_element VARCHAR, username_value VARCHAR,password_element VARCHAR, password_value BLOB, submit_element VARCHAR,signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element,username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR,pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0,date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( label VARCHAR,unique_id INTEGER PRIMARY KEY, first_name VARCHAR,middle_name VARCHAR, last_name VARCHAR, email VARCHAR,company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR,city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR,phone VARCHAR, fax VARCHAR);
-CREATE TABLE credit_cards ( label VARCHAR, unique_id INTEGER PRIMARY KEY,name_on_card VARCHAR, type VARCHAR, card_number VARCHAR,expiration_month INTEGER, expiration_year INTEGER,verification_code VARCHAR, billing_address VARCHAR,shipping_address VARCHAR, card_number_encrypted BLOB,verification_code_encrypted BLOB);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX autofill_profiles_label_index ON autofill_profiles (label);
-CREATE INDEX credit_cards_label_index ON credit_cards (label);
-COMMIT;
diff --git a/components/test/data/web_database/version_26.sql b/components/test/data/web_database/version_26.sql
deleted file mode 100644
index 5cf1a97..0000000
--- a/components/test/data/web_database/version_26.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','26');
-INSERT INTO "meta" VALUES('last_compatible_version','26');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','29');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0);
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR,username_element VARCHAR, username_value VARCHAR,password_element VARCHAR, password_value BLOB, submit_element VARCHAR,signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element,username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR,pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0,date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( label VARCHAR,unique_id INTEGER PRIMARY KEY, first_name VARCHAR,middle_name VARCHAR, last_name VARCHAR, email VARCHAR,company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR,city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR,phone VARCHAR, fax VARCHAR);
-CREATE TABLE credit_cards ( label VARCHAR, unique_id INTEGER PRIMARY KEY,name_on_card VARCHAR, type VARCHAR, card_number VARCHAR,expiration_month INTEGER, expiration_year INTEGER,verification_code VARCHAR, billing_address VARCHAR,shipping_address VARCHAR, card_number_encrypted BLOB,verification_code_encrypted BLOB);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX autofill_profiles_label_index ON autofill_profiles (label);
-CREATE INDEX credit_cards_label_index ON credit_cards (label);
-COMMIT;
diff --git a/components/test/data/web_database/version_27.sql b/components/test/data/web_database/version_27.sql
deleted file mode 100644
index 4733afa..0000000
--- a/components/test/data/web_database/version_27.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','27');
-INSERT INTO "meta" VALUES('last_compatible_version','27');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','29');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6245,0);
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE ie7_logins (url_hash VARCHAR NOT NULL, password_value BLOB, date_created INTEGER NOT NULL,UNIQUE (url_hash));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( label VARCHAR, unique_id INTEGER PRIMARY KEY, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, email VARCHAR, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, phone VARCHAR, fax VARCHAR);
-CREATE TABLE credit_cards ( label VARCHAR, unique_id INTEGER PRIMARY KEY, name_on_card VARCHAR, type VARCHAR, card_number VARCHAR, expiration_month INTEGER, expiration_year INTEGER, verification_code VARCHAR, billing_address VARCHAR, shipping_address VARCHAR, card_number_encrypted BLOB, verification_code_encrypted BLOB);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX ie7_logins_hash ON ie7_logins (url_hash);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX autofill_profiles_label_index ON autofill_profiles (label);
-CREATE INDEX credit_cards_label_index ON credit_cards (label);
-COMMIT;
diff --git a/components/test/data/web_database/version_29.sql b/components/test/data/web_database/version_29.sql
deleted file mode 100644
index ab03275..0000000
--- a/components/test/data/web_database/version_29.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','29');
-INSERT INTO "meta" VALUES('last_compatible_version','29');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','29');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6245,0,'{google:baseURL}search?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&q={searchTerms}');
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0,6262,0,'');
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0,6239,0,'');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( label VARCHAR, unique_id INTEGER PRIMARY KEY, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, email VARCHAR, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, phone VARCHAR, fax VARCHAR);
-INSERT INTO "autofill_profiles" VALUES('Santa Claus, 1 Reindeer Lane',1,'Santa','','Claus','','','1 Reindeer Lane','P.O. Box 56009','North Pole','','H0H 0H0','CANADA','','');
-CREATE TABLE credit_cards ( label VARCHAR, unique_id INTEGER PRIMARY KEY, name_on_card VARCHAR, type VARCHAR, card_number VARCHAR, expiration_month INTEGER, expiration_year INTEGER, verification_code VARCHAR, billing_address VARCHAR, shipping_address VARCHAR, card_number_encrypted BLOB, verification_code_encrypted BLOB);
-INSERT INTO "credit_cards" VALUES('',2,'Kris Kringle','','',12,2020,'','1','',X'',X'');
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX autofill_profiles_label_index ON autofill_profiles (label);
-CREATE INDEX credit_cards_label_index ON credit_cards (label);
-COMMIT;
diff --git a/components/test/data/web_database/version_30.sql b/components/test/data/web_database/version_30.sql
deleted file mode 100644
index 698605c..0000000
--- a/components/test/data/web_database/version_30.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','30');
-INSERT INTO "meta" VALUES('last_compatible_version','30');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','30');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6245,0,'{google:baseURL}search?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&q={searchTerms}');
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0,6262,0,'');
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0,6239,0,'');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( label VARCHAR, unique_id INTEGER PRIMARY KEY, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, email VARCHAR, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, phone VARCHAR, fax VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-INSERT INTO "autofill_profiles" VALUES('Jim Johnson, 789 4th Street',1,'Jim','','Johnson','jim@acme.com','Acme Inc.','789 4th Street','Apt. #4','San Francisco','CA','94102','USA','4155512255','4155512233',1287508123);
-INSERT INTO "autofill_profiles" VALUES('Billy Jean, 1 Ghost Blvd.',3,'Billy','','Jean','billy@thriller.com','Thriller Inc.','1 Ghost Blvd.','','Santa Monica','CA','98990','USA','4431110000','',1287508123);
-CREATE TABLE credit_cards ( label VARCHAR, unique_id INTEGER PRIMARY KEY, name_on_card VARCHAR, type VARCHAR, card_number VARCHAR, expiration_month INTEGER, expiration_year INTEGER, verification_code VARCHAR, billing_address VARCHAR, shipping_address VARCHAR, card_number_encrypted BLOB, verification_code_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-INSERT INTO "credit_cards" VALUES('',2,'Jim X Johnson','','',1,2011,'','1','',X'763130B83A1BEE0CFD7C447C270685B5E2BFF5EC0BC700B38F4C4DD60CDD5D8D66EB09',X'',1287508123);
-INSERT INTO "credit_cards" VALUES('2',4,'Billy X Jean','','',7,2017,'','3','',X'763130EB3DC27FA61AAC9EAC92B303978DD7B62E901B4D9DFB459905E09AAAE7AE7BA1',X'',1287508123);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX autofill_profiles_label_index ON autofill_profiles (label);
-CREATE INDEX credit_cards_label_index ON credit_cards (label);
-COMMIT;
diff --git a/components/test/data/web_database/version_31.sql b/components/test/data/web_database/version_31.sql
deleted file mode 100644
index bfa7443..0000000
--- a/components/test/data/web_database/version_31.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','31');
-INSERT INTO "meta" VALUES('last_compatible_version','31');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','32');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6247,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}');
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0,6264,0,'');
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0,6241,0,'');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( label VARCHAR, unique_id INTEGER PRIMARY KEY, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, email VARCHAR, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, phone VARCHAR, fax VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0, guid VARCHAR NOT NULL DEFAULT "");
-INSERT INTO "autofill_profiles" VALUES('Elvis Presley, 1122 PBJ Lane',1,'Elvis','','Presley','elvis@elvis.com','Hip Shake Inc.','1122 PBJ Lane','Suite 1','Memphis','TN','38116','UK','9013323322','',1288642516,'A4FF32F6-EF3F-379A-87F2-40A8811182A7');
-CREATE TABLE credit_cards ( label VARCHAR, unique_id INTEGER PRIMARY KEY, name_on_card VARCHAR, type VARCHAR, card_number VARCHAR, expiration_month INTEGER, expiration_year INTEGER, verification_code VARCHAR, billing_address VARCHAR, shipping_address VARCHAR, card_number_encrypted BLOB, verification_code_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0, guid VARCHAR NOT NULL DEFAULT "");
-INSERT INTO "credit_cards" VALUES('',2,'Jim J Jones','','',1,2011,'','0','',X'7631309863E9F1F33C2BDBFBFC86708448BDD8B37A495B628C8459A60D0CCD1047E69F',X'',1288642516,'B77F749C-8B0E-44B2-D299-3C80A95E0ADD');
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX autofill_profiles_label_index ON autofill_profiles (label);
-CREATE INDEX credit_cards_label_index ON credit_cards (label);
-COMMIT;
diff --git a/components/test/data/web_database/version_32.sql b/components/test/data/web_database/version_32.sql
deleted file mode 100644
index 7030608..0000000
--- a/components/test/data/web_database/version_32.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','32');
-INSERT INTO "meta" VALUES('last_compatible_version','32');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6256,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1');
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0,6273,0,'');
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0,6250,0,'');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, label VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, email VARCHAR, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, phone VARCHAR, fax VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-INSERT INTO "autofill_profiles" VALUES('00580526-FF81-EE2A-0546-1AC593A32E2F','John Doe, 1 Main St','John','','Doe','john@doe.com','Doe Enterprises','1 Main St','Apt 1','Los Altos','CA','94022','USA','4151112222','4153334444',1297882100);
-INSERT INTO "autofill_profiles" VALUES('589636FD-9037-3053-200C-80ABC97D7344','John P. Doe, 1 Main St','John','P.','Doe','john@doe.com','Doe Enterprises','1 Main St','Apt 1','Los Altos','CA','94022','USA','4151112222','4153334444',1297882100);
-INSERT INTO "autofill_profiles" VALUES('4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396','Dave Smith, 2 Main Street','Dave','','Smith','','','2 Main Street','','Los Altos','CA','94022','USA','','',1297882100);
-INSERT INTO "autofill_profiles" VALUES('722DF5C4-F74A-294A-46F0-31FFDED0D635','Dave Smith, 2 Main St','Dave','','Smith','','','2 Main St','','Los Altos','CA','94022','USA','','',1297882100);
-INSERT INTO "autofill_profiles" VALUES('584282AC-5D21-8D73-A2DB-4F892EF61F3F','Alfred E Newman, a@e.com','Alfred','E','Newman','a@e.com','','','','','','','','','',1297882100);
-INSERT INTO "autofill_profiles" VALUES('9E5FE298-62C7-83DF-6293-381BC589183F','3 Main St, Los Altos','','','','','','3 Main St','','Los Altos','CA','94022','USA','','',1297882100);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, label VARCHAR, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX autofill_profiles_label_index ON autofill_profiles (label);
-CREATE INDEX credit_cards_label_index ON credit_cards (label);
-COMMIT;
diff --git a/components/test/data/web_database/version_33.sql b/components/test/data/web_database/version_33.sql
deleted file mode 100644
index a5eb2ae..0000000
--- a/components/test/data/web_database/version_33.sql
+++ /dev/null
@@ -1,32 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','33');
-INSERT INTO "meta" VALUES('last_compatible_version','33');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6256,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1');
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0,6273,0,'');
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0,6250,0,'');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-INSERT INTO "autofill_profiles" VALUES('45285F35-4A04-5F47-DBCC-CA8C2F2A5944','Hip Shake Inc.','1122 PBJ Lane','Suite 1','Memphis','TN','38116','United States',1298621949);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-INSERT INTO "autofill_profile_names" VALUES('45285F35-4A04-5F47-DBCC-CA8C2F2A5944','Elvis','','Presley');
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-INSERT INTO "autofill_profile_emails" VALUES('45285F35-4A04-5F47-DBCC-CA8C2F2A5944','elvis@elvis.com');
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-INSERT INTO "autofill_profile_phones" VALUES('45285F35-4A04-5F47-DBCC-CA8C2F2A5944',0,'9013323322');
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
diff --git a/components/test/data/web_database/version_34.sql b/components/test/data/web_database/version_34.sql
deleted file mode 100644
index 8a29a95..0000000
--- a/components/test/data/web_database/version_34.sql
+++ /dev/null
@@ -1,54 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
-INSERT INTO "meta" VALUES('version','34');
-INSERT INTO "meta" VALUES('last_compatible_version','34');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6256,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1');
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0,6273,0,'');
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0,6250,0,'');
-INSERT INTO "keywords" VALUES(5,'Search the web (Babylon)','search.babylon.com','','http://search.babylon.com/web/{searchTerms}?babsrc=browsersearch',1,0,'',1299093361,0,'','',0,0,0,0,'');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE ie7_logins (url_hash VARCHAR NOT NULL, password_value BLOB, date_created INTEGER NOT NULL,UNIQUE (url_hash));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-INSERT INTO "autofill" VALUES('firstname','David','david',1,1);
-INSERT INTO "autofill" VALUES('lastname','Holloway','holloway',2,1);
-INSERT INTO "autofill" VALUES('email','d@gmail.com','d@gmail.com',3,1);
-INSERT INTO "autofill" VALUES('phone','415-551-2222','415-551-2222',4,1);
-INSERT INTO "autofill" VALUES('fax','415-551-2222','415-551-2222',5,1);
-INSERT INTO "autofill" VALUES('address','1122 Boogie Boogie Avenue','1122 boogie boogie avenue',6,1);
-INSERT INTO "autofill" VALUES('city','San Francisco','san francisco',7,1);
-INSERT INTO "autofill" VALUES('zipcode','11001','11001',8,1);
-INSERT INTO "autofill" VALUES('country','UK','uk',9,1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-INSERT INTO "autofill_dates" VALUES(1,1299093389);
-INSERT INTO "autofill_dates" VALUES(2,1299093389);
-INSERT INTO "autofill_dates" VALUES(3,1299093389);
-INSERT INTO "autofill_dates" VALUES(4,1299093389);
-INSERT INTO "autofill_dates" VALUES(5,1299093389);
-INSERT INTO "autofill_dates" VALUES(6,1299093389);
-INSERT INTO "autofill_dates" VALUES(7,1299093389);
-INSERT INTO "autofill_dates" VALUES(8,1299093389);
-INSERT INTO "autofill_dates" VALUES(9,1299093389);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0, country_code VARCHAR);
-INSERT INTO "autofill_profiles" VALUES('F19484ED-363F-4506-997E-E0F23EA834AB','','1122 Boogie Boogie Avenue','','San Francisco','?','11001','UK',1299093389,'UK');
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-INSERT INTO "autofill_profile_names" VALUES('F19484ED-363F-4506-997E-E0F23EA834AB','David','','Holloway');
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-INSERT INTO "autofill_profile_emails" VALUES('F19484ED-363F-4506-997E-E0F23EA834AB','d@gmail.com');
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-INSERT INTO "autofill_profile_phones" VALUES('F19484ED-363F-4506-997E-E0F23EA834AB',0,'4155512222');
-INSERT INTO "autofill_profile_phones" VALUES('F19484ED-363F-4506-997E-E0F23EA834AB',1,'4155512222');
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX ie7_logins_hash ON ie7_logins (url_hash);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
diff --git a/components/test/data/web_database/version_35.sql b/components/test/data/web_database/version_35.sql
deleted file mode 100644
index 2c0738c..0000000
--- a/components/test/data/web_database/version_35.sql
+++ /dev/null
@@ -1,59 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','35');
-INSERT INTO "meta" VALUES('last_compatible_version','35');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6262,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1');
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,1,'',0,0,'UTF-8','http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0,6279,0,'');
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,1,'',0,0,'UTF-8','http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0,6256,0,'');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-
-/* A "John Doe" profile with all-valid fields. */
-INSERT INTO "autofill_profiles" VALUES('00000000-0000-0000-0000-000000000001','Acme Inc.','1 Main Street','Apt 2','San Francisco','CA','94102','United States','US',1300131704);
-INSERT INTO "autofill_profile_names" VALUES('00000000-0000-0000-0000-000000000001','John','','Doe');
-INSERT INTO "autofill_profile_emails" VALUES('00000000-0000-0000-0000-000000000001','john@doe.com');
-INSERT INTO "autofill_profile_phones" VALUES('00000000-0000-0000-0000-000000000001',0,'4151112222');
-INSERT INTO "autofill_profile_phones" VALUES('00000000-0000-0000-0000-000000000001',1,'4151110000');
-
-/* A subset of "John Doe". Should get discarded. */
-INSERT INTO "autofill_profiles" VALUES('00000000-0000-0000-0000-000000000002','','1 Main Street','Apt 2','San Francisco','CA','94102','United States','US',1300131704);
-INSERT INTO "autofill_profile_names" VALUES('00000000-0000-0000-0000-000000000002','John','','Doe');
-INSERT INTO "autofill_profile_emails" VALUES('00000000-0000-0000-0000-000000000002','john@doe.com');
-INSERT INTO "autofill_profile_phones" VALUES('00000000-0000-0000-0000-000000000002',0,'4151112222');
-INSERT INTO "autofill_profile_phones" VALUES('00000000-0000-0000-0000-000000000002',1,'4151110000');
-
-/* A profile with incomplete address. Should get discarded. */
-INSERT INTO "autofill_profiles" VALUES('00000000-0000-0000-0000-000000000003','','','Apt 3','San Francisco','CA','94102','United States','US',1300131704);
-INSERT INTO "autofill_profile_names" VALUES('00000000-0000-0000-0000-000000000003','Jim','','Smith');
-
-/* A profile with bad email. Should get discarded. */
-INSERT INTO "autofill_profiles" VALUES('00000000-0000-0000-0000-000000000004','Acme Inc.','4 Main Street','Apt 2','San Francisco','CA','94102','United States','US',1300131704);
-INSERT INTO "autofill_profile_emails" VALUES('00000000-0000-0000-0000-000000000004','bademail');
-
-/* A profile with bad State (country == US). Should get discarded. */
-INSERT INTO "autofill_profiles" VALUES('00000000-0000-0000-0000-000000000005','Acme Inc.','6 Main Street','Apt 2','San Francisco','BS','94102','United States','US',1300131704);
-INSERT INTO "autofill_profile_names" VALUES('00000000-0000-0000-0000-000000000006','John','','Doe');
-
-/* A profile with bad zip (country == US). Should get discarded. */
-INSERT INTO "autofill_profiles" VALUES('00000000-0000-0000-0000-000000000006','Acme Inc.','7 Main Street','Apt 2','San Francisco','CA','bogus','United States','US',1300131704);
-INSERT INTO "autofill_profile_names" VALUES('00000000-0000-0000-0000-000000000007','John','','Doe');
-
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
diff --git a/components/test/data/web_database/version_37.sql b/components/test/data/web_database/version_37.sql
deleted file mode 100644
index 045450c..0000000
--- a/components/test/data/web_database/version_37.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','37');
-INSERT INTO "meta" VALUES('last_compatible_version','37');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6262,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
diff --git a/components/test/data/web_database/version_38.sql b/components/test/data/web_database/version_38.sql
deleted file mode 100644
index 679ad98..0000000
--- a/components/test/data/web_database/version_38.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','38');
-INSERT INTO "meta" VALUES('last_compatible_version','38');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6262,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1',0);
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
diff --git a/components/test/data/web_database/version_39.sql b/components/test/data/web_database/version_39.sql
deleted file mode 100644
index d8f4c9f..0000000
--- a/components/test/data/web_database/version_39.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','39');
-INSERT INTO "meta" VALUES('last_compatible_version','39');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0, sync_guid VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6262,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1',0,'{1234-5678-90AB-CDEF}');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
diff --git a/components/test/data/web_database/version_40.sql b/components/test/data/web_database/version_40.sql
deleted file mode 100644
index 5eee626..0000000
--- a/components/test/data/web_database/version_40.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','40');
-INSERT INTO "meta" VALUES('last_compatible_version','40');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0, sync_guid VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6262,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1',0,'{1234-5678-90AB-CDEF}');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
-
diff --git a/components/test/data/web_database/version_41.sql b/components/test/data/web_database/version_41.sql
deleted file mode 100644
index 4804d16..0000000
--- a/components/test/data/web_database/version_41.sql
+++ /dev/null
@@ -1,30 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','41');
-INSERT INTO "meta" VALUES('last_compatible_version','41');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0, sync_guid VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6262,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1',0,'{1234-5678-90AB-CDEF}');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
-
-
diff --git a/components/test/data/web_database/version_42.sql b/components/test/data/web_database/version_42.sql
deleted file mode 100644
index 01b9925..0000000
--- a/components/test/data/web_database/version_42.sql
+++ /dev/null
@@ -1,30 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','42');
-INSERT INTO "meta" VALUES('last_compatible_version','42');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
-INSERT INTO "meta" VALUES('Default Search Provider Backup','2Googlegoogle.comhttp://www.google.com/favicon.ico{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}100UTF-81{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}1162620{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=10{1234-5678-90AB-CDEF}');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','33');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0, sync_guid VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,6262,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1',0,'{1234-5678-90AB-CDEF}');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
-
diff --git a/components/test/data/web_database/version_43.sql b/components/test/data/web_database/version_43.sql
deleted file mode 100644
index e0bcd54..0000000
--- a/components/test/data/web_database/version_43.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','43');
-INSERT INTO "meta" VALUES('last_compatible_version','43');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup','3');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','37');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0, sync_guid VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,1234,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1',0,'{1234-5678-90AB-CDEF}');
-CREATE TABLE keywords_backup (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0, sync_guid VARCHAR);
-INSERT INTO "keywords_backup" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,1,'',0,0,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,1,1234,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}&nord=1',0,'{1234-5678-90AB-CDEF}');
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-COMMIT;
-
diff --git a/components/test/data/web_database/version_44.sql b/components/test/data/web_database/version_44.sql
deleted file mode 100644
index e36ffea..0000000
--- a/components/test/data/web_database/version_44.sql
+++ /dev/null
@@ -1,53 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','44');
-INSERT INTO "meta" VALUES('last_compatible_version','44');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup','0');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0,sync_guid VARCHAR);
-CREATE TABLE keywords_backup(
- id INT,
- short_name TEXT,
- keyword TEXT,
- favicon_url TEXT,
- url TEXT,
- safe_for_autoreplace INT,
- originating_url TEXT,
- date_created INT,
- usage_count INT,
- input_encodings TEXT,
- show_in_default_list INT,
- suggest_url TEXT,
- prepopulate_id INT,
- autogenerate_keyword INT,
- logo_id INT,
- created_by_policy INT,
- instant_url TEXT,
- last_modified INT,
- sync_guid TEXT
-);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE autofill_profiles_trash ( guid VARCHAR);
-CREATE TABLE logins (origin_url VARCHAR NOT NULL, action_url VARCHAR, username_element VARCHAR, username_value VARCHAR, password_element VARCHAR, password_value BLOB, submit_element VARCHAR, signon_realm VARCHAR NOT NULL,ssl_valid INTEGER NOT NULL,preferred INTEGER NOT NULL,date_created INTEGER NOT NULL,blacklisted_by_user INTEGER NOT NULL,scheme INTEGER NOT NULL,UNIQUE (origin_url, username_element, username_value, password_element, submit_element, signon_realm));
-CREATE TABLE ie7_logins (url_hash VARCHAR NOT NULL, password_value BLOB, date_created INTEGER NOT NULL,UNIQUE (url_hash));
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE TABLE web_intents (service_url LONGVARCHAR,action VARCHAR,type VARCHAR,title LONGVARCHAR,disposition VARCHAR,UNIQUE (service_url, action, type));
-CREATE TABLE web_intents_defaults (action VARCHAR,type VARCHAR,url_pattern LONGVARCHAR,user_date INTEGER,suppression INTEGER,service_url LONGVARCHAR,UNIQUE (action, type, url_pattern));
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX logins_signon ON logins (signon_realm);
-CREATE INDEX ie7_logins_hash ON ie7_logins (url_hash);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX web_intents_index ON web_intents (action);
-CREATE INDEX web_intents_default_index ON web_intents_defaults (action);
-COMMIT;
diff --git a/components/test/data/web_database/version_45.sql b/components/test/data/web_database/version_45.sql
deleted file mode 100644
index 4b1e70a..0000000
--- a/components/test/data/web_database/version_45.sql
+++ /dev/null
@@ -1,53 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('version','45');
-INSERT INTO "meta" VALUES('last_compatible_version','45');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','39');
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE autofill_profiles_trash ( guid VARCHAR);
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE TABLE web_intents (service_url LONGVARCHAR,action VARCHAR,type VARCHAR,title LONGVARCHAR,disposition VARCHAR,UNIQUE (service_url, action, type));
-CREATE TABLE web_intents_defaults (action VARCHAR,type VARCHAR,url_pattern LONGVARCHAR,user_date INTEGER,suppression INTEGER,service_url LONGVARCHAR,UNIQUE (action, type, url_pattern));
-CREATE TABLE "keywords" (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,show_in_default_list INTEGER,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0,sync_guid VARCHAR);
-CREATE TABLE keywords_backup(
- id INT,
- short_name TEXT,
- keyword TEXT,
- favicon_url TEXT,
- url TEXT,
- safe_for_autoreplace INT,
- originating_url TEXT,
- date_created INT,
- usage_count INT,
- input_encodings TEXT,
- show_in_default_list INT,
- suggest_url TEXT,
- prepopulate_id INT,
- created_by_policy INT,
- instant_url TEXT,
- last_modified INT,
- sync_guid TEXT
-);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX web_intents_index ON web_intents (action);
-CREATE INDEX web_intents_default_index ON web_intents_defaults (action);
--- following statements are required for testing migration to version 46
-INSERT INTO web_intents VALUES ('http://poodles.com/fuzzer', 'fuzz', 'poodle/*', 'Poodle Fuzzer', 'window');
-INSERT INTO web_intents_defaults VALUES ('fuzz', 'poodle/*', '', 0, 0, 'http://poodles.com/fuzzer');
-COMMIT;
-
diff --git a/components/test/data/web_database/version_45_compatible.sql b/components/test/data/web_database/version_45_compatible.sql
deleted file mode 100644
index 158c40d..0000000
--- a/components/test/data/web_database/version_45_compatible.sql
+++ /dev/null
@@ -1,50 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('version','40');
-INSERT INTO "meta" VALUES('last_compatible_version','45');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','39');
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE autofill_profiles_trash ( guid VARCHAR);
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE TABLE web_intents (service_url LONGVARCHAR,action VARCHAR,type VARCHAR,title LONGVARCHAR,disposition VARCHAR,UNIQUE (service_url, action, type));
-CREATE TABLE web_intents_defaults (action VARCHAR,type VARCHAR,url_pattern LONGVARCHAR,user_date INTEGER,suppression INTEGER,service_url LONGVARCHAR,UNIQUE (action, type, url_pattern));
-CREATE TABLE "keywords" (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,show_in_default_list INTEGER,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0,sync_guid VARCHAR);
-CREATE TABLE keywords_backup(
- id INT,
- short_name TEXT,
- keyword TEXT,
- favicon_url TEXT,
- url TEXT,
- safe_for_autoreplace INT,
- originating_url TEXT,
- date_created INT,
- usage_count INT,
- input_encodings TEXT,
- show_in_default_list INT,
- suggest_url TEXT,
- prepopulate_id INT,
- created_by_policy INT,
- instant_url TEXT,
- last_modified INT,
- sync_guid TEXT
-);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX web_intents_index ON web_intents (action);
-CREATE INDEX web_intents_default_index ON web_intents_defaults (action);
-COMMIT;
-
diff --git a/components/test/data/web_database/version_45_invalid.sql b/components/test/data/web_database/version_45_invalid.sql
deleted file mode 100644
index ff2b94b..0000000
--- a/components/test/data/web_database/version_45_invalid.sql
+++ /dev/null
@@ -1,50 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('version','45');
-INSERT INTO "meta" VALUES('last_compatible_version','45');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','39');
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE autofill_profiles_trash ( guid VARCHAR);
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE TABLE web_intents (INTEGER blabbity);
-CREATE TABLE web_intents_defaults (VARCHAR hammy);
-CREATE TABLE "keywords" (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,show_in_default_list INTEGER,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0,sync_guid VARCHAR);
-CREATE TABLE keywords_backup(
- id INT,
- short_name TEXT,
- keyword TEXT,
- favicon_url TEXT,
- url TEXT,
- safe_for_autoreplace INT,
- originating_url TEXT,
- date_created INT,
- usage_count INT,
- input_encodings TEXT,
- show_in_default_list INT,
- suggest_url TEXT,
- prepopulate_id INT,
- created_by_policy INT,
- instant_url TEXT,
- last_modified INT,
- sync_guid TEXT
-);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX web_apps_url_index ON web_apps (url);
--- following statements are required for testing migration to version 46
-INSERT INTO web_intents VALUES (11);
-INSERT INTO web_intents_defaults VALUES ('fuzz');
-COMMIT;
diff --git a/components/test/data/web_database/version_46.sql b/components/test/data/web_database/version_46.sql
deleted file mode 100644
index 8dcf7cb..0000000
--- a/components/test/data/web_database/version_46.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
-INSERT INTO "meta" VALUES('Default Search Provider ID','0');
-INSERT INTO "meta" VALUES('version','46');
-INSERT INTO "meta" VALUES('last_compatible_version','46');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup','0');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','39');
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE autofill_profiles_trash ( guid VARCHAR);
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE TABLE web_intents (service_url LONGVARCHAR,action VARCHAR,type VARCHAR,title LONGVARCHAR,disposition VARCHAR,scheme VARCHAR,UNIQUE (service_url, action, type));
-CREATE TABLE web_intents_defaults (action VARCHAR,type VARCHAR,url_pattern LONGVARCHAR,user_date INTEGER,suppression INTEGER,service_url LONGVARCHAR,scheme VARCHAR,UNIQUE (action, type, url_pattern));
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,show_in_default_list INTEGER,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0,sync_guid VARCHAR);
-CREATE TABLE keywords_backup(id INT,short_name TEXT,keyword TEXT,favicon_url TEXT,url TEXT,safe_for_autoreplace INT,originating_url TEXT,date_created INT,usage_count INT,input_encodings TEXT,show_in_default_list INT,suggest_url TEXT,prepopulate_id INT,created_by_policy INT,instant_url TEXT,last_modified INT,sync_guid TEXT);
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX web_intents_index ON web_intents (action);
-CREATE INDEX web_intents_default_index ON web_intents_defaults (action);
-COMMIT;
diff --git a/components/test/data/web_database/version_47.sql b/components/test/data/web_database/version_47.sql
deleted file mode 100644
index aae06e8..0000000
--- a/components/test/data/web_database/version_47.sql
+++ /dev/null
@@ -1,50 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','47');
-INSERT INTO "meta" VALUES('last_compatible_version','47');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','46');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup','2');
-INSERT INTO "meta" VALUES('Default Search Provider ID Backup Signature','');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,show_in_default_list INTEGER,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0,sync_guid VARCHAR,alternate_urls VARCHAR);
-CREATE TABLE keywords_backup(
- id INT,
- short_name TEXT,
- keyword TEXT,
- favicon_url TEXT,
- url TEXT,
- safe_for_autoreplace INT,
- originating_url TEXT,
- date_created INT,
- usage_count INT,
- input_encodings TEXT,
- show_in_default_list INT,
- suggest_url TEXT,
- prepopulate_id INT,
- created_by_policy INT,
- instant_url TEXT,
- last_modified INT,
- sync_guid TEXT,
- alternate_urls TEXT
-);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE autofill_profiles_trash ( guid VARCHAR);
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE TABLE web_intents ( service_url LONGVARCHAR, action VARCHAR, type VARCHAR, title LONGVARCHAR, disposition VARCHAR, scheme VARCHAR, UNIQUE (service_url, action, scheme, type));
-CREATE TABLE web_intents_defaults ( action VARCHAR, type VARCHAR, url_pattern LONGVARCHAR, user_date INTEGER, suppression INTEGER, service_url LONGVARCHAR, scheme VARCHAR, UNIQUE (action, scheme, type, url_pattern));
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX web_intents_index ON web_intents (action);
-CREATE INDEX web_intents_default_index ON web_intents_defaults (action);
-COMMIT;
diff --git a/components/test/data/web_database/version_48.sql b/components/test/data/web_database/version_48.sql
deleted file mode 100644
index 53a9ed7..0000000
--- a/components/test/data/web_database/version_48.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','48');
-INSERT INTO "meta" VALUES('last_compatible_version','48');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','48');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,show_in_default_list INTEGER,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0,sync_guid VARCHAR,alternate_urls VARCHAR);
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE autofill_profiles_trash ( guid VARCHAR);
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE TABLE web_intents ( service_url LONGVARCHAR, action VARCHAR, type VARCHAR, title LONGVARCHAR, disposition VARCHAR, scheme VARCHAR, UNIQUE (service_url, action, scheme, type));
-CREATE TABLE web_intents_defaults ( action VARCHAR, type VARCHAR, url_pattern LONGVARCHAR, user_date INTEGER, suppression INTEGER, service_url LONGVARCHAR, scheme VARCHAR, UNIQUE (action, scheme, type, url_pattern));
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX web_intents_index ON web_intents (action);
-CREATE INDEX web_intents_default_index ON web_intents_defaults (action);
-COMMIT;
diff --git a/components/test/data/web_database/version_49.sql b/components/test/data/web_database/version_49.sql
deleted file mode 100644
index 02a4fd9..0000000
--- a/components/test/data/web_database/version_49.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
-INSERT INTO "meta" VALUES('version','49');
-INSERT INTO "meta" VALUES('last_compatible_version','48');
-INSERT INTO "meta" VALUES('Builtin Keyword Version','54');
-INSERT INTO "meta" VALUES('Default Search Provider ID','2');
-CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, pair_id INTEGER PRIMARY KEY, count INTEGER DEFAULT 1);
-CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_dates ( pair_id INTEGER DEFAULT 0, date_created INTEGER DEFAULT 0);
-CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, country VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0);
-CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR);
-CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR);
-CREATE TABLE autofill_profile_phones ( guid VARCHAR, type INTEGER DEFAULT 0, number VARCHAR);
-CREATE TABLE autofill_profiles_trash ( guid VARCHAR);
-CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,show_in_default_list INTEGER,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0,sync_guid VARCHAR,alternate_urls VARCHAR,search_terms_replacement_key VARCHAR);
-INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?q={searchTerms}&{google:RLZ}{google:originalQueryForSuggestion}{google:assistedQueryStats}{google:searchFieldtrialParameter}{google:searchClient}{google:sourceId}{google:instantExtendedEnabledParameter}ie={inputEncoding}',1,'',0,0,'UTF-8',1,'{google:baseSuggestURL}search?{google:searchFieldtrialParameter}client=chrome&q={searchTerms}&{google:cursorPosition}sugkey={google:suggestAPIKeyParameter}',1,0,'{google:baseURL}webhp?sourceid=chrome-instant&{google:RLZ}{google:instantEnabledParameter}{google:instantExtendedEnabledParameter}{google:ntpIsThemedParameter}{google:omniboxStartMarginParameter}ie={inputEncoding}',0,'711AEC98-A563-FD8B-87D5-427C60828A43','["{google:baseURL}#q={searchTerms}","{google:baseURL}search#q={searchTerms}","{google:baseURL}webhp#q={searchTerms}"]','espv');
-INSERT INTO "keywords" VALUES(3,'Yahoo!','yahoo.com','http://search.yahoo.com/favicon.ico','http://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,'',0,0,'UTF-8',1,'http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}',2,0,'',0,'7A35F8C9-ADD7-2C08-475E-B51151C79514','[]','');
-INSERT INTO "keywords" VALUES(4,'Bing','bing.com','http://www.bing.com/s/wlflag.ico','http://www.bing.com/search?setmkt=en-US&q={searchTerms}',1,'',0,0,'UTF-8',1,'http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}',3,0,'',0,'94DA8067-BC2D-9033-0EDD-2F667874C223','[]','');
-CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB);
-CREATE TABLE web_app_icons (url LONGVARCHAR,width int,height int,image BLOB, UNIQUE (url, width, height));
-CREATE TABLE web_apps (url LONGVARCHAR UNIQUE,has_all_images INTEGER NOT NULL);
-CREATE TABLE web_intents ( service_url LONGVARCHAR, action VARCHAR, type VARCHAR, title LONGVARCHAR, disposition VARCHAR, scheme VARCHAR, UNIQUE (service_url, action, scheme, type));
-CREATE TABLE web_intents_defaults ( action VARCHAR, type VARCHAR, url_pattern LONGVARCHAR, user_date INTEGER, suppression INTEGER, service_url LONGVARCHAR, scheme VARCHAR, UNIQUE (action, scheme, type, url_pattern));
-CREATE INDEX autofill_name ON autofill (name);
-CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower);
-CREATE INDEX autofill_dates_pair_id ON autofill_dates (pair_id);
-CREATE INDEX web_apps_url_index ON web_apps (url);
-CREATE INDEX web_intents_index ON web_intents (action);
-CREATE INDEX web_intents_default_index ON web_intents_defaults (action);
-COMMIT;
diff --git a/components/webdata/common/web_database.cc b/components/webdata/common/web_database.cc
index 018663d..42837718 100644
--- a/components/webdata/common/web_database.cc
+++ b/components/webdata/common/web_database.cc
@@ -16,6 +16,8 @@
// static
const int WebDatabase::kCurrentVersionNumber = 62;
+const int WebDatabase::kDeprecatedVersionNumber = 51;
+
namespace {
const int kCompatibleVersionNumber = 61;
@@ -87,7 +89,13 @@ sql::InitStatus WebDatabase::Init(const base::FilePath& db_name) {
if (!db_.Open(db_name))
return sql::INIT_FAILURE;
- // Initialize various tables
+ // Clobber really old databases.
+ static_assert(kDeprecatedVersionNumber < kCurrentVersionNumber,
+ "Deprecation version must be less than current");
+ sql::MetaTable::RazeIfDeprecated(&db_, kDeprecatedVersionNumber);
+
+ // Scope initialization in a transaction so we can't be partially
+ // initialized.
sql::Transaction transaction(&db_);
if (!transaction.Begin())
return sql::INIT_FAILURE;
@@ -135,22 +143,7 @@ sql::InitStatus WebDatabase::MigrateOldVersionsAsNeeded() {
if (current_version > meta_table_.GetVersionNumber())
ChangeVersion(&meta_table_, current_version, false);
- if (current_version < 20) {
- // Versions 1 - 19 are unhandled. Version numbers greater than
- // kCurrentVersionNumber should have already been weeded out by the caller.
- //
- // When the version is too old, we return failure error code. The schema
- // is too out of date to migrate.
- //
- // There should not be a released product that makes a database too old to
- // migrate. If we do encounter such a legacy database, we will need a
- // better solution to handle it (i.e., pop up a dialog to tell the user,
- // erase all their prefs and start over, etc.).
- LOG(WARNING) << "Web database version " << current_version
- << " is too old to handle.";
- NOTREACHED();
- return sql::INIT_FAILURE;
- }
+ DCHECK_GT(current_version, kDeprecatedVersionNumber);
for (int next_version = current_version + 1;
next_version <= kCurrentVersionNumber;
diff --git a/components/webdata/common/web_database.h b/components/webdata/common/web_database.h
index 22730fe..c6d0c1d 100644
--- a/components/webdata/common/web_database.h
+++ b/components/webdata/common/web_database.h
@@ -27,6 +27,8 @@ class WEBDATA_EXPORT WebDatabase {
};
// Exposed publicly so the keyword table can access it.
static const int kCurrentVersionNumber;
+ // The newest version of the database Chrome will NOT try to migrate.
+ static const int kDeprecatedVersionNumber;
WebDatabase();
virtual ~WebDatabase();
diff --git a/components/webdata/common/web_database_migration_unittest.cc b/components/webdata/common/web_database_migration_unittest.cc
index fbba5cd..ddbe506 100644
--- a/components/webdata/common/web_database_migration_unittest.cc
+++ b/components/webdata/common/web_database_migration_unittest.cc
@@ -38,122 +38,6 @@ using base::Time;
namespace {
-void AutofillProfile31FromStatement(const sql::Statement& s,
- AutofillProfile* profile,
- base::string16* label,
- int* unique_id,
- int64* date_modified) {
- DCHECK(profile);
- DCHECK(label);
- DCHECK(unique_id);
- DCHECK(date_modified);
- *label = s.ColumnString16(0);
- *unique_id = s.ColumnInt(1);
- profile->SetRawInfo(autofill::NAME_FIRST, s.ColumnString16(2));
- profile->SetRawInfo(autofill::NAME_MIDDLE, s.ColumnString16(3));
- profile->SetRawInfo(autofill::NAME_LAST, s.ColumnString16(4));
- profile->SetRawInfo(autofill::EMAIL_ADDRESS, s.ColumnString16(5));
- profile->SetRawInfo(autofill::COMPANY_NAME, s.ColumnString16(6));
- profile->SetRawInfo(autofill::ADDRESS_HOME_LINE1, s.ColumnString16(7));
- profile->SetRawInfo(autofill::ADDRESS_HOME_LINE2, s.ColumnString16(8));
- profile->SetRawInfo(autofill::ADDRESS_HOME_CITY, s.ColumnString16(9));
- profile->SetRawInfo(autofill::ADDRESS_HOME_STATE, s.ColumnString16(10));
- profile->SetRawInfo(autofill::ADDRESS_HOME_ZIP, s.ColumnString16(11));
- profile->SetInfo(
- autofill::AutofillType(autofill::ADDRESS_HOME_COUNTRY),
- s.ColumnString16(12), "en-US");
- profile->SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(13));
- *date_modified = s.ColumnInt64(15);
- profile->set_guid(s.ColumnString(16));
- EXPECT_TRUE(base::IsValidGUID(profile->guid()));
-}
-
-void AutofillProfile33FromStatement(const sql::Statement& s,
- AutofillProfile* profile,
- int64* date_modified) {
- DCHECK(profile);
- DCHECK(date_modified);
- profile->set_guid(s.ColumnString(0));
- EXPECT_TRUE(base::IsValidGUID(profile->guid()));
- profile->SetRawInfo(autofill::COMPANY_NAME, s.ColumnString16(1));
- profile->SetRawInfo(autofill::ADDRESS_HOME_STREET_ADDRESS,
- s.ColumnString16(2));
- profile->SetRawInfo(autofill::ADDRESS_HOME_CITY, s.ColumnString16(3));
- profile->SetRawInfo(autofill::ADDRESS_HOME_STATE, s.ColumnString16(4));
- profile->SetRawInfo(autofill::ADDRESS_HOME_ZIP, s.ColumnString16(5));
- profile->SetInfo(
- autofill::AutofillType(autofill::ADDRESS_HOME_COUNTRY),
- s.ColumnString16(6), "en-US");
- *date_modified = s.ColumnInt64(7);
-}
-
-void CreditCard31FromStatement(const sql::Statement& s,
- CreditCard* credit_card,
- base::string16* label,
- int* unique_id,
- std::string* encrypted_number,
- int64* date_modified) {
- DCHECK(credit_card);
- DCHECK(label);
- DCHECK(unique_id);
- DCHECK(encrypted_number);
- DCHECK(date_modified);
- *label = s.ColumnString16(0);
- *unique_id = s.ColumnInt(1);
- credit_card->SetRawInfo(autofill::CREDIT_CARD_NAME, s.ColumnString16(2));
- credit_card->SetRawInfo(autofill::CREDIT_CARD_TYPE, s.ColumnString16(3));
- credit_card->SetRawInfo(autofill::CREDIT_CARD_EXP_MONTH, s.ColumnString16(5));
- credit_card->SetRawInfo(
- autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR, s.ColumnString16(6));
- int encrypted_number_len = s.ColumnByteLength(10);
- if (encrypted_number_len) {
- encrypted_number->resize(encrypted_number_len);
- memcpy(&(*encrypted_number)[0], s.ColumnBlob(10), encrypted_number_len);
- }
- *date_modified = s.ColumnInt64(12);
- credit_card->set_guid(s.ColumnString(13));
- EXPECT_TRUE(base::IsValidGUID(credit_card->guid()));
-}
-
-void CreditCard32FromStatement(const sql::Statement& s,
- CreditCard* credit_card,
- std::string* encrypted_number,
- int64* date_modified) {
- DCHECK(credit_card);
- DCHECK(encrypted_number);
- DCHECK(date_modified);
- credit_card->set_guid(s.ColumnString(0));
- EXPECT_TRUE(base::IsValidGUID(credit_card->guid()));
- credit_card->SetRawInfo(autofill::CREDIT_CARD_NAME, s.ColumnString16(1));
- credit_card->SetRawInfo(autofill::CREDIT_CARD_EXP_MONTH, s.ColumnString16(2));
- credit_card->SetRawInfo(
- autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR, s.ColumnString16(3));
- int encrypted_number_len = s.ColumnByteLength(4);
- if (encrypted_number_len) {
- encrypted_number->resize(encrypted_number_len);
- memcpy(&(*encrypted_number)[0], s.ColumnBlob(4), encrypted_number_len);
- }
- *date_modified = s.ColumnInt64(5);
-}
-
-void CheckHasBackupData(sql::MetaTable* meta_table) {
- std::string value;
- EXPECT_TRUE(meta_table->GetValue(
- "Default Search Provider ID Backup", &value));
- EXPECT_TRUE(meta_table->GetValue(
- "Default Search Provider ID Backup Signature", &value));
-}
-
-void CheckNoBackupData(const sql::Connection& connection,
- sql::MetaTable* meta_table) {
- std::string value;
- EXPECT_FALSE(meta_table->GetValue(
- "Default Search Provider ID Backup", &value));
- EXPECT_FALSE(meta_table->GetValue(
- "Default Search Provider ID Backup Signature", &value));
- EXPECT_FALSE(connection.DoesTableExist("keywords_backup"));
-}
-
std::string RemoveQuotes(const std::string& has_quotes) {
std::string no_quotes;
// SQLite quotes: http://www.sqlite.org/lang_keywords.html
@@ -267,15 +151,23 @@ TEST_F(WebDatabaseMigrationTest, VersionXxSqlFilesAreGolden) {
sql::Connection connection;
ASSERT_TRUE(connection.Open(GetDatabasePath()));
const std::string& expected_schema = RemoveQuotes(connection.GetSchema());
- static const int kFirstVersion = 53;
- for (int i = kFirstVersion; i < kCurrentTestedVersionNumber; ++i) {
+ for (int i = WebDatabase::kDeprecatedVersionNumber + 1;
+ i < kCurrentTestedVersionNumber; ++i) {
+ // We don't test version 52 because there's a slight discrepancy in the
+ // initialization code and the migration code (relating to schema
+ // formatting). Fixing the bug is possible, but would require updating every
+ // version_nn.sql file.
+ if (i == 52)
+ continue;
+
connection.Raze();
const base::FilePath& file_name = base::FilePath::FromUTF8Unsafe(
"version_" + base::IntToString(i) + ".sql");
ASSERT_NO_FATAL_FAILURE(LoadDatabase(file_name.value()))
<< "Failed to load " << file_name.MaybeAsASCII();
DoMigration();
- EXPECT_EQ(expected_schema, RemoveQuotes(connection.GetSchema()));
+ EXPECT_EQ(expected_schema, RemoveQuotes(connection.GetSchema()))
+ << "For version " << i;
}
}
@@ -314,1851 +206,8 @@ TEST_F(WebDatabaseMigrationTest, MigrateEmptyToCurrent) {
}
}
-// Tests that absent Autofill tables do not create any problems when migrating
-// from a DB written by the earliest publicly released version of Chrome.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion20ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_20.sql")));
-
- // Verify pre-conditions.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- EXPECT_FALSE(connection.DoesTableExist("autofill"));
- EXPECT_FALSE(connection.DoesTableExist("autofill_profiles"));
- EXPECT_FALSE(connection.DoesTableExist("credit_cards"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // Mostly this test just verifies that no SQL errors occur during migration;
- // but might as well verify that the tables were created as well.
- EXPECT_TRUE(connection.DoesTableExist("autofill"));
- EXPECT_TRUE(connection.DoesTableExist("autofill_profiles"));
- EXPECT_TRUE(connection.DoesTableExist("credit_cards"));
- }
-}
-
-// Tests that rows with empty values get removed from the autofill tables.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion21ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_21.sql")));
-
- // Verify pre-conditions.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Both empty and non-empty values are allowed in a version 21 database.
- sql::Statement s_autofill(connection.GetUniqueStatement(
- "SELECT name, value, value_lower, pair_id, count FROM autofill"));
- sql::Statement s_dates(connection.GetUniqueStatement(
- "SELECT pair_id, date_created FROM autofill_dates"));
-
- // An entry with a non-empty value.
- ASSERT_TRUE(s_autofill.Step());
- EXPECT_EQ(ASCIIToUTF16("Name"), s_autofill.ColumnString16(0));
- EXPECT_EQ(ASCIIToUTF16("John Doe"), s_autofill.ColumnString16(1));
- EXPECT_EQ(ASCIIToUTF16("john doe"), s_autofill.ColumnString16(2));
- EXPECT_EQ(10, s_autofill.ColumnInt(3));
- EXPECT_EQ(1, s_autofill.ColumnInt(4));
- ASSERT_TRUE(s_dates.Step());
- EXPECT_EQ(10, s_dates.ColumnInt(0));
- EXPECT_EQ(1384299100, s_dates.ColumnInt64(1));
-
- // An entry with an empty value.
- ASSERT_TRUE(s_autofill.Step());
- EXPECT_EQ(ASCIIToUTF16("Name"), s_autofill.ColumnString16(0));
- EXPECT_EQ(base::string16(), s_autofill.ColumnString16(1));
- EXPECT_EQ(base::string16(), s_autofill.ColumnString16(2));
- EXPECT_EQ(11, s_autofill.ColumnInt(3));
- EXPECT_EQ(1, s_autofill.ColumnInt(4));
- ASSERT_TRUE(s_dates.Step());
- EXPECT_EQ(11, s_dates.ColumnInt(0));
- EXPECT_EQ(1384299200, s_dates.ColumnInt64(1));
-
- // Another entry with a non-empty value.
- ASSERT_TRUE(s_autofill.Step());
- EXPECT_EQ(ASCIIToUTF16("Email"), s_autofill.ColumnString16(0));
- EXPECT_EQ(ASCIIToUTF16("jane@example.com"), s_autofill.ColumnString16(1));
- EXPECT_EQ(ASCIIToUTF16("jane@example.com"), s_autofill.ColumnString16(2));
- EXPECT_EQ(20, s_autofill.ColumnInt(3));
- EXPECT_EQ(3, s_autofill.ColumnInt(4));
- ASSERT_TRUE(s_dates.Step());
- EXPECT_EQ(20, s_dates.ColumnInt(0));
- EXPECT_EQ(1384299300, s_dates.ColumnInt64(1));
- ASSERT_TRUE(s_dates.Step());
- EXPECT_EQ(20, s_dates.ColumnInt(0));
- EXPECT_EQ(1384299301, s_dates.ColumnInt64(1));
-
- // Another entry with an empty value.
- ASSERT_TRUE(s_autofill.Step());
- EXPECT_EQ(ASCIIToUTF16("Email"), s_autofill.ColumnString16(0));
- EXPECT_EQ(base::string16(), s_autofill.ColumnString16(1));
- EXPECT_EQ(base::string16(), s_autofill.ColumnString16(2));
- EXPECT_EQ(21, s_autofill.ColumnInt(3));
- EXPECT_EQ(4, s_autofill.ColumnInt(4));
- ASSERT_TRUE(s_dates.Step());
- EXPECT_EQ(21, s_dates.ColumnInt(0));
- EXPECT_EQ(1384299401, s_dates.ColumnInt64(1));
- ASSERT_TRUE(s_dates.Step());
- EXPECT_EQ(21, s_dates.ColumnInt(0));
- EXPECT_EQ(1384299400, s_dates.ColumnInt64(1));
- ASSERT_TRUE(s_dates.Step());
- EXPECT_EQ(21, s_dates.ColumnInt(0));
- EXPECT_EQ(1384299403, s_dates.ColumnInt64(1));
- ASSERT_TRUE(s_dates.Step());
- EXPECT_EQ(21, s_dates.ColumnInt(0));
- EXPECT_EQ(1384299402, s_dates.ColumnInt64(1));
-
- // No more entries expected.
- ASSERT_FALSE(s_autofill.Step());
- ASSERT_FALSE(s_dates.Step());
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // Entries with empty values should have been dropped. The remaining
- // entries should have been preserved.
- sql::Statement s(
- connection.GetUniqueStatement(
- "SELECT name, value, value_lower, date_created, date_last_used,"
- " count "
- "FROM autofill "
- "ORDER BY name, value ASC"));
-
- // "jane@example.com"
- ASSERT_TRUE(s.Step());
- EXPECT_EQ(ASCIIToUTF16("Email"), s.ColumnString16(0));
- EXPECT_EQ(ASCIIToUTF16("jane@example.com"), s.ColumnString16(1));
- EXPECT_EQ(ASCIIToUTF16("jane@example.com"), s.ColumnString16(2));
- EXPECT_EQ(1384299300, s.ColumnInt64(3));
- EXPECT_EQ(1384299301, s.ColumnInt64(4));
- EXPECT_EQ(3, s.ColumnInt(5));
-
- // "John Doe"
- ASSERT_TRUE(s.Step());
- EXPECT_EQ(ASCIIToUTF16("Name"), s.ColumnString16(0));
- EXPECT_EQ(ASCIIToUTF16("John Doe"), s.ColumnString16(1));
- EXPECT_EQ(ASCIIToUTF16("john doe"), s.ColumnString16(2));
- EXPECT_EQ(1384299100, s.ColumnInt64(3));
- EXPECT_EQ(1384299100, s.ColumnInt64(4));
- EXPECT_EQ(1, s.ColumnInt(5));
-
- // No more entries expected.
- ASSERT_FALSE(s.Step());
- }
-}
-
-// Tests that the |credit_card| table gets added to the schema for a version 22
-// database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion22ToCurrent) {
- // This schema is taken from a build prior to the addition of the
- // |credit_card| table. Version 22 of the schema. Contrast this with the
- // corrupt version below.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_22.sql")));
-
- // Verify pre-conditions.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // No |credit_card| table prior to version 23.
- ASSERT_FALSE(connection.DoesColumnExist("credit_cards", "guid"));
- ASSERT_FALSE(
- connection.DoesColumnExist("credit_cards", "card_number_encrypted"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // |credit_card| table now exists.
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "guid"));
- EXPECT_TRUE(
- connection.DoesColumnExist("credit_cards", "card_number_encrypted"));
- }
-}
-
-// Tests that the |credit_card| table gets added to the schema for a corrupt
-// version 22 database. The corruption is that the |credit_cards| table exists
-// but the schema version number was not set correctly to 23 or later. This
-// test exercises code introduced to fix bug http://crbug.com/50699 that
-// resulted from the corruption.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion22CorruptedToCurrent) {
- // This schema is taken from a build after the addition of the |credit_card|
- // table. Due to a bug in the migration logic the version is set incorrectly
- // to 22 (it should have been updated to 23 at least).
- ASSERT_NO_FATAL_FAILURE(
- LoadDatabase(FILE_PATH_LITERAL("version_22_corrupt.sql")));
-
- // Verify pre-conditions. These are expectations for corrupt version 22 of
- // the database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Columns existing and not existing before current version.
- ASSERT_TRUE(connection.DoesColumnExist("credit_cards", "unique_id"));
- ASSERT_TRUE(
- connection.DoesColumnExist("credit_cards", "card_number_encrypted"));
- ASSERT_TRUE(connection.DoesColumnExist("keywords", "id"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
-
- // Columns existing and not existing before version 25.
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "unique_id"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "guid"));
- EXPECT_TRUE(
- connection.DoesColumnExist("credit_cards", "card_number_encrypted"));
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "id"));
- }
-}
-
-// Tests that the |keywords| |created_by_policy| column gets added to the schema
-// for a version 25 database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion25ToCurrent) {
- // This schema is taken from a build prior to the addition of the |keywords|
- // |created_by_policy| column.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_25.sql")));
-
- // Verify pre-conditions. These are expectations for version 25 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // |keywords| |created_by_policy| column should have been added.
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "id"));
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "created_by_policy"));
- }
-}
-
-// Tests that the credit_cards.billing_address column is changed from a string
-// to an int whilst preserving the associated billing address. This version of
-// the test makes sure a stored label is converted to an ID.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion26ToCurrentStringLabels) {
- // This schema is taken from a build prior to the change of column type for
- // credit_cards.billing_address from string to int.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_26.sql")));
-
- // Verify pre-conditions. These are expectations for version 26 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Columns existing and not existing before current version.
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "billing_address"));
-
- std::string stmt = "INSERT INTO autofill_profiles"
- "(label, unique_id, first_name, middle_name, last_name, email,"
- " company_name, address_line_1, address_line_2, city, state, zipcode,"
- " country, phone, fax)"
- "VALUES ('Home',1,'','','','','','','','','','','','','')";
- sql::Statement s(connection.GetUniqueStatement(stmt.c_str()));
- ASSERT_TRUE(s.Run());
-
- // Insert a CC linked to an existing address.
- std::string stmt2 = "INSERT INTO credit_cards"
- "(label, unique_id, name_on_card, type, card_number,"
- " expiration_month, expiration_year, verification_code, billing_address,"
- " shipping_address, card_number_encrypted, verification_code_encrypted)"
- "VALUES ('label',2,'Jack','Visa','1234',2,2012,'','Home','','','')";
- sql::Statement s2(connection.GetUniqueStatement(stmt2.c_str()));
- ASSERT_TRUE(s2.Run());
-
- // |billing_address| is a string.
- std::string stmt3 = "SELECT billing_address FROM credit_cards";
- sql::Statement s3(connection.GetUniqueStatement(stmt3.c_str()));
- ASSERT_TRUE(s3.Step());
- EXPECT_EQ(s3.ColumnType(0), sql::COLUMN_TYPE_TEXT);
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "billing_address"));
-
- // Verify the credit card data is converted.
- sql::Statement s(connection.GetUniqueStatement(
- "SELECT guid, name_on_card, expiration_month, expiration_year, "
- "card_number_encrypted, date_modified "
- "FROM credit_cards"));
- ASSERT_TRUE(s.Step());
- EXPECT_EQ("Jack", s.ColumnString(1));
- EXPECT_EQ(2, s.ColumnInt(2));
- EXPECT_EQ(2012, s.ColumnInt(3));
- // Column 5 is encrypted number blob.
- // Column 6 is date_modified.
- }
-}
-
-// Tests that the credit_cards.billing_address column is changed from a string
-// to an int whilst preserving the associated billing address. This version of
-// the test makes sure a stored string ID is converted to an integer ID.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion26ToCurrentStringIDs) {
- // This schema is taken from a build prior to the change of column type for
- // credit_cards.billing_address from string to int.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_26.sql")));
-
- // Verify pre-conditions. These are expectations for version 26 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "billing_address"));
-
- std::string stmt = "INSERT INTO autofill_profiles"
- "(label, unique_id, first_name, middle_name, last_name, email,"
- " company_name, address_line_1, address_line_2, city, state, zipcode,"
- " country, phone, fax)"
- "VALUES ('Home',1,'','','','','','','','','','','','','')";
- sql::Statement s(connection.GetUniqueStatement(stmt.c_str()));
- ASSERT_TRUE(s.Run());
-
- // Insert a CC linked to an existing address.
- std::string stmt2 = "INSERT INTO credit_cards"
- "(label, unique_id, name_on_card, type, card_number,"
- " expiration_month, expiration_year, verification_code, billing_address,"
- " shipping_address, card_number_encrypted, verification_code_encrypted)"
- "VALUES ('label',2,'Jack','Visa','1234',2,2012,'','1','','','')";
- sql::Statement s2(connection.GetUniqueStatement(stmt2.c_str()));
- ASSERT_TRUE(s2.Run());
-
- // |billing_address| is a string.
- std::string stmt3 = "SELECT billing_address FROM credit_cards";
- sql::Statement s3(connection.GetUniqueStatement(stmt3.c_str()));
- ASSERT_TRUE(s3.Step());
- EXPECT_EQ(s3.ColumnType(0), sql::COLUMN_TYPE_TEXT);
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // |keywords| |created_by_policy| column should have been added.
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "id"));
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "created_by_policy"));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "billing_address"));
-
- // Verify the credit card data is converted.
- sql::Statement s(connection.GetUniqueStatement(
- "SELECT guid, name_on_card, expiration_month, expiration_year, "
- "card_number_encrypted, date_modified "
- "FROM credit_cards"));
- ASSERT_TRUE(s.Step());
- EXPECT_EQ("Jack", s.ColumnString(1));
- EXPECT_EQ(2, s.ColumnInt(2));
- EXPECT_EQ(2012, s.ColumnInt(3));
- // Column 5 is encrypted credit card number blo b.
- // Column 6 is date_modified.
- }
-}
-
-// Makes sure instant_url is added correctly to keywords.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion27ToCurrent) {
- // Initialize the database.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_27.sql")));
-
- // Verify pre-conditions. These are expectations for version 27 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- ASSERT_FALSE(connection.DoesColumnExist("keywords", "instant_url"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // Make sure supports_instant (added in Version 28) was ultimately dropped
- // again and instant_url was added.
- EXPECT_FALSE(connection.DoesColumnExist("keywords", "supports_instant"));
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "instant_url"));
-
- // Check that instant_url is empty.
- std::string stmt = "SELECT instant_url FROM keywords";
- sql::Statement s(connection.GetUniqueStatement(stmt.c_str()));
- ASSERT_TRUE(s.Step());
- EXPECT_EQ(std::string(), s.ColumnString(0));
-
- // Verify the data made it over.
- stmt = "SELECT " + KeywordTable::GetKeywordColumns() + " FROM keywords";
- sql::Statement s2(connection.GetUniqueStatement(stmt.c_str()));
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ(2, s2.ColumnInt(0));
- EXPECT_EQ("Google", s2.ColumnString(1));
- EXPECT_EQ("google.com", s2.ColumnString(2));
- EXPECT_EQ("http://www.google.com/favicon.ico", s2.ColumnString(3));
- EXPECT_EQ("{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}"\
- "{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}"\
- "&q={searchTerms}",
- s2.ColumnString(4));
- EXPECT_TRUE(s2.ColumnBool(5));
- EXPECT_EQ(std::string(), s2.ColumnString(6));
- EXPECT_EQ(0, s2.ColumnInt(7));
- EXPECT_EQ(0, s2.ColumnInt(8));
- EXPECT_EQ(std::string("UTF-8"), s2.ColumnString(9));
- EXPECT_TRUE(s2.ColumnBool(10));
- EXPECT_EQ(std::string("{google:baseSuggestURL}search?client=chrome&hl="
- "{language}&q={searchTerms}"), s2.ColumnString(11));
- EXPECT_EQ(1, s2.ColumnInt(12));
- EXPECT_FALSE(s2.ColumnBool(13));
- EXPECT_EQ(std::string(), s2.ColumnString(14));
- EXPECT_EQ(0, s2.ColumnInt(15));
- EXPECT_EQ(std::string(), s2.ColumnString(16));
- }
-}
-
-// Makes sure date_modified is added correctly to autofill_profiles and
-// credit_cards.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion29ToCurrent) {
- // Initialize the database.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_29.sql")));
-
- // Verify pre-conditions. These are expectations for version 29 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles",
- "date_modified"));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards",
- "date_modified"));
- }
-
- Time pre_creation_time = Time::Now();
- DoMigration();
- Time post_creation_time = Time::Now();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // Check that the columns were created.
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "date_modified"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards",
- "date_modified"));
-
- sql::Statement s_profiles(connection.GetUniqueStatement(
- "SELECT date_modified FROM autofill_profiles "));
- ASSERT_TRUE(s_profiles.is_valid());
- while (s_profiles.Step()) {
- EXPECT_GE(s_profiles.ColumnInt64(0),
- pre_creation_time.ToTimeT());
- EXPECT_LE(s_profiles.ColumnInt64(0),
- post_creation_time.ToTimeT());
- }
- EXPECT_TRUE(s_profiles.Succeeded());
-
- sql::Statement s_credit_cards(connection.GetUniqueStatement(
- "SELECT date_modified FROM credit_cards "));
- ASSERT_TRUE(s_credit_cards.is_valid());
- while (s_credit_cards.Step()) {
- EXPECT_GE(s_credit_cards.ColumnInt64(0),
- pre_creation_time.ToTimeT());
- EXPECT_LE(s_credit_cards.ColumnInt64(0),
- post_creation_time.ToTimeT());
- }
- EXPECT_TRUE(s_credit_cards.Succeeded());
- }
-}
-
-// Makes sure guids are added to autofill_profiles and credit_cards tables.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion30ToCurrent) {
- // Initialize the database.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_30.sql")));
-
- // Verify pre-conditions. These are expectations for version 29 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles", "guid"));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "guid"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- ASSERT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid"));
- ASSERT_TRUE(connection.DoesColumnExist("credit_cards", "guid"));
-
- // Check that guids are non-null, non-empty, conforms to guid format, and
- // are different.
- sql::Statement s(
- connection.GetUniqueStatement("SELECT guid FROM autofill_profiles"));
-
- ASSERT_TRUE(s.Step());
- std::string guid1 = s.ColumnString(0);
- EXPECT_TRUE(base::IsValidGUID(guid1));
-
- ASSERT_TRUE(s.Step());
- std::string guid2 = s.ColumnString(0);
- EXPECT_TRUE(base::IsValidGUID(guid2));
-
- EXPECT_NE(guid1, guid2);
- }
-}
-
-// Removes unique IDs and make GUIDs the primary key. Also removes unused
-// columns.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion31ToCurrent) {
- // Initialize the database.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_31.sql")));
-
- // Verify pre-conditions. These are expectations for version 30 of the
- // database.
- AutofillProfile profile;
- base::string16 profile_label;
- int profile_unique_id = 0;
- int64 profile_date_modified = 0;
- CreditCard credit_card;
- base::string16 cc_label;
- int cc_unique_id = 0;
- std::string cc_number_encrypted;
- int64 cc_date_modified = 0;
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Verify existence of columns we'll be changing.
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "unique_id"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "guid"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "unique_id"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "type"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "card_number"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards",
- "verification_code"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "billing_address"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "shipping_address"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards",
- "verification_code_encrypted"));
-
- // Fetch data in the database prior to migration.
- sql::Statement s1(
- connection.GetUniqueStatement(
- "SELECT label, unique_id, first_name, middle_name, last_name, "
- "email, company_name, address_line_1, address_line_2, city, state, "
- "zipcode, country, phone, fax, date_modified, guid "
- "FROM autofill_profiles"));
- ASSERT_TRUE(s1.Step());
- EXPECT_NO_FATAL_FAILURE(AutofillProfile31FromStatement(
- s1, &profile, &profile_label, &profile_unique_id,
- &profile_date_modified));
-
- sql::Statement s2(
- connection.GetUniqueStatement(
- "SELECT label, unique_id, name_on_card, type, card_number, "
- "expiration_month, expiration_year, verification_code, "
- "billing_address, shipping_address, card_number_encrypted, "
- "verification_code_encrypted, date_modified, guid "
- "FROM credit_cards"));
- ASSERT_TRUE(s2.Step());
- EXPECT_NO_FATAL_FAILURE(CreditCard31FromStatement(s2,
- &credit_card,
- &cc_label,
- &cc_unique_id,
- &cc_number_encrypted,
- &cc_date_modified));
-
- EXPECT_NE(profile_unique_id, cc_unique_id);
- EXPECT_NE(profile.guid(), credit_card.guid());
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // Verify existence of columns we'll be changing.
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid"));
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles", "unique_id"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "guid"));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "unique_id"));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "type"));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "card_number"));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards",
- "verification_code"));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "billing_address"));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards",
- "shipping_address"));
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards",
- "verification_code_encrypted"));
-
- // Verify data in the database after the migration.
- sql::Statement s1(
- connection.GetUniqueStatement(
- "SELECT guid, company_name, street_address, city, state, zipcode,"
- " country_code, date_modified "
- "FROM autofill_profiles"));
- ASSERT_TRUE(s1.Step());
-
- AutofillProfile profile_a;
- int64 profile_date_modified_a = 0;
- EXPECT_NO_FATAL_FAILURE(AutofillProfile33FromStatement(
- s1, &profile_a, &profile_date_modified_a));
- EXPECT_EQ(profile.guid(), profile_a.guid());
- EXPECT_EQ(profile.GetRawInfo(autofill::COMPANY_NAME),
- profile_a.GetRawInfo(autofill::COMPANY_NAME));
- EXPECT_EQ(profile.GetRawInfo(autofill::ADDRESS_HOME_LINE1),
- profile_a.GetRawInfo(autofill::ADDRESS_HOME_LINE1));
- EXPECT_EQ(profile.GetRawInfo(autofill::ADDRESS_HOME_LINE2),
- profile_a.GetRawInfo(autofill::ADDRESS_HOME_LINE2));
- EXPECT_EQ(profile.GetRawInfo(autofill::ADDRESS_HOME_CITY),
- profile_a.GetRawInfo(autofill::ADDRESS_HOME_CITY));
- EXPECT_EQ(profile.GetRawInfo(autofill::ADDRESS_HOME_STATE),
- profile_a.GetRawInfo(autofill::ADDRESS_HOME_STATE));
- EXPECT_EQ(profile.GetRawInfo(autofill::ADDRESS_HOME_ZIP),
- profile_a.GetRawInfo(autofill::ADDRESS_HOME_ZIP));
- EXPECT_EQ(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY),
- profile_a.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY));
- EXPECT_EQ(profile_date_modified, profile_date_modified_a);
-
- sql::Statement s2(
- connection.GetUniqueStatement(
- "SELECT guid, name_on_card, expiration_month, "
- "expiration_year, card_number_encrypted, date_modified "
- "FROM credit_cards"));
- ASSERT_TRUE(s2.Step());
-
- CreditCard credit_card_a;
- base::string16 cc_label_a;
- std::string cc_number_encrypted_a;
- int64 cc_date_modified_a = 0;
- EXPECT_NO_FATAL_FAILURE(CreditCard32FromStatement(s2,
- &credit_card_a,
- &cc_number_encrypted_a,
- &cc_date_modified_a));
- EXPECT_EQ(credit_card, credit_card_a);
- EXPECT_EQ(cc_label, cc_label_a);
- EXPECT_EQ(cc_number_encrypted, cc_number_encrypted_a);
- EXPECT_EQ(cc_date_modified, cc_date_modified_a);
- }
-}
-
-// Factor |autofill_profiles| address information separately from name, email,
-// and phone.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion32ToCurrent) {
- // Initialize the database.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_32.sql")));
-
- // Verify pre-conditions. These are expectations for version 32 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Verify existence of columns we'll be changing.
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "label"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "first_name"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "middle_name"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "last_name"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "email"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "company_name"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "address_line_1"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "address_line_2"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "city"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "state"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "zipcode"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "country"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "phone"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "fax"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "date_modified"));
-
- EXPECT_FALSE(connection.DoesTableExist("autofill_profile_names"));
- EXPECT_FALSE(connection.DoesTableExist("autofill_profile_emails"));
- EXPECT_FALSE(connection.DoesTableExist("autofill_profile_phones"));
-
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "label"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // Verify changes to columns.
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid"));
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles", "label"));
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles", "first_name"));
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles",
- "middle_name"));
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles", "last_name"));
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles", "email"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "company_name"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "street_address"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "city"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "state"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "zipcode"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "country_code"));
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles", "phone"));
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles", "fax"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "date_modified"));
-
- // New "names" table.
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profile_names", "guid"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profile_names",
- "first_name"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profile_names",
- "middle_name"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profile_names",
- "last_name"));
-
- // New "emails" table.
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profile_emails", "guid"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profile_emails", "email"));
-
- // New "phones" table.
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profile_phones", "guid"));
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profile_phones",
- "number"));
-
- EXPECT_FALSE(connection.DoesColumnExist("credit_cards", "label"));
-
- // Verify data in the database after the migration.
- sql::Statement s1(
- connection.GetUniqueStatement(
- "SELECT guid, company_name, street_address, city, state, zipcode, "
- " country_code, date_modified "
- "FROM autofill_profiles"));
-
- // John Doe.
- ASSERT_TRUE(s1.Step());
- EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s1.ColumnString(0));
- EXPECT_EQ(ASCIIToUTF16("Doe Enterprises"), s1.ColumnString16(1));
- EXPECT_EQ(ASCIIToUTF16("1 Main St\n"
- "Apt 1"),
- s1.ColumnString16(2));
- EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(3));
- EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(4));
- EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(5));
- EXPECT_EQ(ASCIIToUTF16("US"), s1.ColumnString16(6));
- EXPECT_EQ(1297882100L, s1.ColumnInt64(7));
-
- // John P. Doe.
- // Gets merged during migration from 35 to 37 due to multi-valued fields.
-
- // Dave Smith.
- ASSERT_TRUE(s1.Step());
- EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s1.ColumnString(0));
- EXPECT_EQ(base::string16(), s1.ColumnString16(1));
- EXPECT_EQ(ASCIIToUTF16("2 Main Street"), s1.ColumnString16(2));
- EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(3));
- EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(4));
- EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(5));
- EXPECT_EQ(ASCIIToUTF16("US"), s1.ColumnString16(6));
- EXPECT_EQ(1297882100L, s1.ColumnInt64(7));
-
- // Dave Smith (Part 2).
- ASSERT_TRUE(s1.Step());
- EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s1.ColumnString(0));
- EXPECT_EQ(base::string16(), s1.ColumnString16(1));
- EXPECT_EQ(ASCIIToUTF16("2 Main St"), s1.ColumnString16(2));
- EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(3));
- EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(4));
- EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(5));
- EXPECT_EQ(ASCIIToUTF16("US"), s1.ColumnString16(6));
- EXPECT_EQ(1297882100L, s1.ColumnInt64(7));
-
- // Alfred E Newman.
- // Gets culled during migration from 35 to 36 due to incomplete address.
-
- // 3 Main St.
- ASSERT_TRUE(s1.Step());
- EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s1.ColumnString(0));
- EXPECT_EQ(base::string16(), s1.ColumnString16(1));
- EXPECT_EQ(ASCIIToUTF16("3 Main St"), s1.ColumnString16(2));
- EXPECT_EQ(ASCIIToUTF16("Los Altos"), s1.ColumnString16(3));
- EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(4));
- EXPECT_EQ(ASCIIToUTF16("94022"), s1.ColumnString16(5));
- EXPECT_EQ(ASCIIToUTF16("US"), s1.ColumnString16(6));
- EXPECT_EQ(1297882100L, s1.ColumnInt64(7));
-
- // That should be all.
- EXPECT_FALSE(s1.Step());
-
- sql::Statement s2(
- connection.GetUniqueStatement(
- "SELECT guid, first_name, middle_name, last_name "
- "FROM autofill_profile_names"));
-
- // John Doe.
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s2.ColumnString(0));
- EXPECT_EQ(ASCIIToUTF16("John"), s2.ColumnString16(1));
- EXPECT_EQ(base::string16(), s2.ColumnString16(2));
- EXPECT_EQ(ASCIIToUTF16("Doe"), s2.ColumnString16(3));
-
- // John P. Doe. Note same guid as above due to merging of multi-valued
- // fields.
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s2.ColumnString(0));
- EXPECT_EQ(ASCIIToUTF16("John"), s2.ColumnString16(1));
- EXPECT_EQ(ASCIIToUTF16("P."), s2.ColumnString16(2));
- EXPECT_EQ(ASCIIToUTF16("Doe"), s2.ColumnString16(3));
-
- // Dave Smith.
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s2.ColumnString(0));
- EXPECT_EQ(ASCIIToUTF16("Dave"), s2.ColumnString16(1));
- EXPECT_EQ(base::string16(), s2.ColumnString16(2));
- EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3));
-
- // Dave Smith (Part 2).
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s2.ColumnString(0));
- EXPECT_EQ(ASCIIToUTF16("Dave"), s2.ColumnString16(1));
- EXPECT_EQ(base::string16(), s2.ColumnString16(2));
- EXPECT_EQ(ASCIIToUTF16("Smith"), s2.ColumnString16(3));
-
- // Alfred E Newman.
- // Gets culled during migration from 35 to 36 due to incomplete address.
-
- // 3 Main St.
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s2.ColumnString(0));
- EXPECT_EQ(base::string16(), s2.ColumnString16(1));
- EXPECT_EQ(base::string16(), s2.ColumnString16(2));
- EXPECT_EQ(base::string16(), s2.ColumnString16(3));
-
- // Should be all.
- EXPECT_FALSE(s2.Step());
-
- sql::Statement s3(
- connection.GetUniqueStatement(
- "SELECT guid, email "
- "FROM autofill_profile_emails"));
-
- // John Doe.
- ASSERT_TRUE(s3.Step());
- EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s3.ColumnString(0));
- EXPECT_EQ(ASCIIToUTF16("john@doe.com"), s3.ColumnString16(1));
-
- // John P. Doe.
- // Gets culled during migration from 35 to 37 due to merging of John Doe and
- // John P. Doe addresses.
-
- // 2 Main Street.
- ASSERT_TRUE(s3.Step());
- EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s3.ColumnString(0));
- EXPECT_EQ(base::string16(), s3.ColumnString16(1));
-
- // 2 Main St.
- ASSERT_TRUE(s3.Step());
- EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s3.ColumnString(0));
- EXPECT_EQ(base::string16(), s3.ColumnString16(1));
-
- // Alfred E Newman.
- // Gets culled during migration from 35 to 36 due to incomplete address.
-
- // 3 Main St.
- ASSERT_TRUE(s3.Step());
- EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s3.ColumnString(0));
- EXPECT_EQ(base::string16(), s3.ColumnString16(1));
-
- // Should be all.
- EXPECT_FALSE(s3.Step());
-
- sql::Statement s4(
- connection.GetUniqueStatement(
- "SELECT guid, number "
- "FROM autofill_profile_phones"));
-
- // John Doe phone.
- ASSERT_TRUE(s4.Step());
- EXPECT_EQ("00580526-FF81-EE2A-0546-1AC593A32E2F", s4.ColumnString(0));
- EXPECT_EQ(ASCIIToUTF16("4151112222"), s4.ColumnString16(1));
-
- // John Doe fax.
- // Gets culled after fax type removed.
-
- // John P. Doe phone.
- // Gets culled during migration from 35 to 37 due to merging of John Doe and
- // John P. Doe addresses.
-
- // John P. Doe fax.
- // Gets culled during migration from 35 to 37 due to merging of John Doe and
- // John P. Doe addresses.
-
- // 2 Main Street phone.
- ASSERT_TRUE(s4.Step());
- EXPECT_EQ("4C74A9D8-7EEE-423E-F9C2-E7FA70ED1396", s4.ColumnString(0));
- EXPECT_EQ(base::string16(), s4.ColumnString16(1));
-
- // 2 Main Street fax.
- // Gets culled after fax type removed.
-
- // 2 Main St phone.
- ASSERT_TRUE(s4.Step());
- EXPECT_EQ("722DF5C4-F74A-294A-46F0-31FFDED0D635", s4.ColumnString(0));
- EXPECT_EQ(0, s4.ColumnInt(1)); // 0 means phone.
- EXPECT_EQ(base::string16(), s4.ColumnString16(2));
-
- // 2 Main St fax.
- // Gets culled after fax type removed.
-
- // Note no phone or fax for Alfred E Newman.
-
- // 3 Main St phone.
- ASSERT_TRUE(s4.Step());
- EXPECT_EQ("9E5FE298-62C7-83DF-6293-381BC589183F", s4.ColumnString(0));
- EXPECT_EQ(base::string16(), s4.ColumnString16(1));
-
- // 2 Main St fax.
- // Gets culled after fax type removed.
-
- // Should be all.
- EXPECT_FALSE(s4.Step());
- }
-}
-
-// Adds a column for the autofill profile's country code.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion33ToCurrent) {
- // Initialize the database.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_33.sql")));
-
- // Verify pre-conditions. These are expectations for version 33 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- EXPECT_FALSE(connection.DoesColumnExist("autofill_profiles",
- "country_code"));
-
- // Check that the country value is the one we expect.
- sql::Statement s(
- connection.GetUniqueStatement("SELECT country FROM autofill_profiles"));
-
- ASSERT_TRUE(s.Step());
- std::string country = s.ColumnString(0);
- EXPECT_EQ("United States", country);
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- ASSERT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "country_code"));
-
- // Check that the country code is properly converted.
- sql::Statement s(connection.GetUniqueStatement(
- "SELECT country_code FROM autofill_profiles"));
-
- ASSERT_TRUE(s.Step());
- std::string country_code = s.ColumnString(0);
- EXPECT_EQ("US", country_code);
- }
-}
-
-// Cleans up bad country code "UK" in favor of good country code "GB".
-TEST_F(WebDatabaseMigrationTest, MigrateVersion34ToCurrent) {
- // Initialize the database.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_34.sql")));
-
- // Verify pre-conditions. These are expectations for version 34 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "country_code"));
-
- // Check that the country_code value is the one we expect.
- sql::Statement s(
- connection.GetUniqueStatement("SELECT country_code "
- "FROM autofill_profiles"));
-
- ASSERT_TRUE(s.Step());
- std::string country_code = s.ColumnString(0);
- EXPECT_EQ("UK", country_code);
-
- // Should have only one.
- ASSERT_FALSE(s.Step());
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- ASSERT_TRUE(connection.DoesColumnExist("autofill_profiles",
- "country_code"));
-
- // Check that the country_code code is properly converted.
- sql::Statement s(connection.GetUniqueStatement(
- "SELECT country_code FROM autofill_profiles"));
-
- ASSERT_TRUE(s.Step());
- std::string country_code = s.ColumnString(0);
- EXPECT_EQ("GB", country_code);
-
- // Should have only one.
- ASSERT_FALSE(s.Step());
- }
-}
-
-// Cleans up invalid profiles based on more agressive merging. Filters out
-// profiles that are subsets of other profiles, and profiles with invalid email,
-// state, and incomplete address.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion35ToCurrent) {
- // Initialize the database.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_35.sql")));
-
- // Verify pre-conditions. These are expectations for version 34 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- EXPECT_FALSE(connection.DoesTableExist("autofill_profiles_trash"));
- ASSERT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid"));
-
- // Check that there are 6 profiles prior to merge.
- sql::Statement s(
- connection.GetUniqueStatement("SELECT guid FROM autofill_profiles"));
- int i = 0;
- while (s.Step())
- ++i;
- EXPECT_EQ(6, i);
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- ASSERT_TRUE(connection.DoesTableExist("autofill_profiles_trash"));
- ASSERT_TRUE(connection.DoesColumnExist("autofill_profiles_trash", "guid"));
- ASSERT_TRUE(connection.DoesColumnExist("autofill_profiles", "guid"));
-
- // Verify data in the database after the migration.
- sql::Statement s1(
- connection.GetUniqueStatement(
- "SELECT guid, company_name, street_address, city, state, zipcode,"
- " country_code, date_modified "
- "FROM autofill_profiles"));
-
- // John Doe.
- ASSERT_TRUE(s1.Step());
- EXPECT_EQ("00000000-0000-0000-0000-000000000001", s1.ColumnString(0));
- EXPECT_EQ(ASCIIToUTF16("Acme Inc."), s1.ColumnString16(1));
- EXPECT_EQ(ASCIIToUTF16("1 Main Street\n"
- "Apt 2"),
- s1.ColumnString16(2));
- EXPECT_EQ(ASCIIToUTF16("San Francisco"), s1.ColumnString16(3));
- EXPECT_EQ(ASCIIToUTF16("CA"), s1.ColumnString16(4));
- EXPECT_EQ(ASCIIToUTF16("94102"), s1.ColumnString16(5));
- EXPECT_EQ(ASCIIToUTF16("US"), s1.ColumnString16(6));
- EXPECT_EQ(1300131704, s1.ColumnInt64(7));
-
- // That should be it.
- ASSERT_FALSE(s1.Step());
-
- // Check that there 5 trashed profile after the merge.
- sql::Statement s2(
- connection.GetUniqueStatement("SELECT guid "
- "FROM autofill_profiles_trash"));
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ("00000000-0000-0000-0000-000000000002", s2.ColumnString(0));
-
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ("00000000-0000-0000-0000-000000000003", s2.ColumnString(0));
-
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ("00000000-0000-0000-0000-000000000004", s2.ColumnString(0));
-
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ("00000000-0000-0000-0000-000000000005", s2.ColumnString(0));
-
- ASSERT_TRUE(s2.Step());
- EXPECT_EQ("00000000-0000-0000-0000-000000000006", s2.ColumnString(0));
-
- // That should be it.
- ASSERT_FALSE(s2.Step());
- }
-}
-
-// Tests that the |keywords| |last_modified| column gets added to the schema for
-// a version 37 database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion37ToCurrent) {
- // This schema is taken from a build prior to the addition of the |keywords|
- // |last_modified| column.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_37.sql")));
-
- // Verify pre-conditions. These are expectations for version 37 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Columns existing and not existing before current version.
- ASSERT_TRUE(connection.DoesColumnExist("keywords", "id"));
- ASSERT_FALSE(connection.DoesColumnExist("keywords", "last_modified"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // |keywords| |last_modified| column should have been added.
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "id"));
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "last_modified"));
- }
-}
-
-// Tests that the |keywords| |sync_guid| column gets added to the schema for
-// a version 38 database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion38ToCurrent) {
- // This schema is taken from a build prior to the addition of the |keywords|
- // |sync_guid| column.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_38.sql")));
-
- // Verify pre-conditions. These are expectations for version 38 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Columns existing and not existing before current version.
- ASSERT_TRUE(connection.DoesColumnExist("keywords", "id"));
- ASSERT_FALSE(connection.DoesColumnExist("keywords", "sync_guid"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // |keywords| |sync_guid| column should have been added.
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "id"));
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "sync_guid"));
- }
-}
-
-// Tests that no backup data is added to a version 39 database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion39ToCurrent) {
- // This schema is taken from a build prior to the addition of the default
- // search provider backup field to the meta table.
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_39.sql")));
-
- // Verify pre-conditions. These are expectations for version 39 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 39, 39));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
-
- EXPECT_NO_FATAL_FAILURE(CheckNoBackupData(connection, &meta_table));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, kCurrentTestedVersionNumber,
- kCurrentTestedVersionNumber));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
- EXPECT_NE(0, default_search_provider_id);
-
- EXPECT_NO_FATAL_FAILURE(CheckNoBackupData(connection, &meta_table));
- }
-}
-
-// Tests that the backup data is removed from the database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion40ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_40.sql")));
-
- // Verify pre-conditions. These are expectations for version 40 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 40, 40));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
-
- EXPECT_NO_FATAL_FAILURE(CheckHasBackupData(&meta_table));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, kCurrentTestedVersionNumber,
- kCurrentTestedVersionNumber));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
- EXPECT_NE(0, default_search_provider_id);
-
- EXPECT_NO_FATAL_FAILURE(CheckNoBackupData(connection, &meta_table));
- }
-}
-
-// Tests that the backup data is removed from the database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion41ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_41.sql")));
-
- // Verify pre-conditions. These are expectations for version 41 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 41, 41));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
-
- EXPECT_NO_FATAL_FAILURE(CheckHasBackupData(&meta_table));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, kCurrentTestedVersionNumber,
- kCurrentTestedVersionNumber));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
- EXPECT_NE(0, default_search_provider_id);
-
- EXPECT_NO_FATAL_FAILURE(CheckNoBackupData(connection, &meta_table));
- }
-}
-
-// Tests that the backup data is removed from the database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion42ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_42.sql")));
-
- // Verify pre-conditions. These are expectations for version 42 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 42, 42));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
-
- EXPECT_NO_FATAL_FAILURE(CheckHasBackupData(&meta_table));
-
- EXPECT_FALSE(connection.DoesTableExist("keywords_backup"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, kCurrentTestedVersionNumber,
- kCurrentTestedVersionNumber));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
- EXPECT_NE(0, default_search_provider_id);
-
- EXPECT_NO_FATAL_FAILURE(CheckNoBackupData(connection, &meta_table));
- }
-}
-
-// Tests that the backup data is removed from the database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion43ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_43.sql")));
-
- int64 previous_default_search_provider_id;
-
- // Verify pre-conditions. These are expectations for version 43 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 43, 43));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
- EXPECT_NE(default_search_provider_id, 0);
- previous_default_search_provider_id = default_search_provider_id;
-
- EXPECT_NO_FATAL_FAILURE(CheckHasBackupData(&meta_table));
- EXPECT_TRUE(connection.DoesTableExist("keywords_backup"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(
- &connection,
- kCurrentTestedVersionNumber,
- kCurrentTestedVersionNumber));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
- // Default search provider ID should not change.
- EXPECT_EQ(previous_default_search_provider_id, default_search_provider_id);
-
- EXPECT_NO_FATAL_FAILURE(CheckNoBackupData(connection, &meta_table));
- }
-}
-
-// Tests that the |autogenerate_keyword| and |logo_id| columns get removed from
-// the keyword table schema for a version 45 database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion44ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_44.sql")));
-
- // Verify pre-conditions. These are expectations for version 44 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 44, 44));
-
- ASSERT_TRUE(connection.DoesColumnExist("keywords", "autogenerate_keyword"));
- ASSERT_TRUE(connection.DoesColumnExist("keywords", "logo_id"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, kCurrentTestedVersionNumber,
- kCurrentTestedVersionNumber));
-
- // We should have removed this obsolete key.
- std::string default_search_provider_backup;
- EXPECT_FALSE(meta_table.GetValue("Default Search Provider Backup",
- &default_search_provider_backup));
-
- // Two columns should have been removed.
- EXPECT_FALSE(connection.DoesColumnExist("keywords",
- "autogenerate_keyword"));
- EXPECT_FALSE(connection.DoesColumnExist("keywords", "logo_id"));
-
- // Backup data should have been removed.
- EXPECT_NO_FATAL_FAILURE(CheckNoBackupData(connection, &meta_table));
- }
-}
-
-// Previously, this tested that the web_intents and web_intents_defaults tables
-// were modified to include "scheme" columns. Since the web_intents and
-// web_intents_defaults tables are now obsolete, this test checks to ensure that
-// they are properly removed.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion45ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_45.sql")));
-
- // Verify pre-conditions. These are expectations for version 45 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 45, 45));
-
- ASSERT_FALSE(connection.DoesColumnExist("scheme", "web_intents"));
- ASSERT_FALSE(connection.DoesColumnExist(
- "scheme", "web_intents_defaults"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(
- &connection,
- kCurrentTestedVersionNumber,
- kCurrentTestedVersionNumber));
-
- // finally ensure the migration code cleaned up after itself
- EXPECT_FALSE(connection.DoesTableExist("web_intents"));
- EXPECT_FALSE(connection.DoesTableExist("web_intents_defaults"));
- }
-}
-
-// Previously, this tested that the web_intents and web_intents_defaults tables
-// were modified to include "scheme" columns. Since the web_intents and
-// web_intents_defaults tables are now obsolete, this test checks to ensure that
-// they are properly removed.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion45InvalidToCurrent) {
- ASSERT_NO_FATAL_FAILURE(
- LoadDatabase(FILE_PATH_LITERAL("version_45_invalid.sql")));
-
- // Verify pre-conditions. These are expectations for version 45 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 45, 45));
-
- ASSERT_FALSE(connection.DoesColumnExist("scheme", "web_intents"));
- ASSERT_FALSE(connection.DoesColumnExist(
- "scheme", "web_intents_defaults"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(
- &connection,
- kCurrentTestedVersionNumber,
- kCurrentTestedVersionNumber));
-
- EXPECT_FALSE(connection.DoesTableExist("web_intents"));
- EXPECT_FALSE(connection.DoesTableExist("web_intents_defaults"));
- }
-}
-
-// Check that current version is forced to compatible version before migration,
-// if the former is smaller.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion45CompatibleToCurrent) {
- ASSERT_NO_FATAL_FAILURE(
- LoadDatabase(FILE_PATH_LITERAL("version_45_compatible.sql")));
-
- // Verify pre-conditions. These are expectations for version 45 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- // Database is actually version 45 but the version field states 40.
- ASSERT_TRUE(meta_table.Init(&connection, 40, 45));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
- EXPECT_LE(45, VersionFromConnection(&connection));
- }
-}
-
-// Tests that the |alternate_urls| column is added to the keyword table schema
-// for a version 47 database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion46ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(
- LoadDatabase(FILE_PATH_LITERAL("version_46.sql")));
-
- // Verify pre-conditions. These are expectations for version 46 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 46, 46));
-
- ASSERT_FALSE(connection.DoesColumnExist("keywords", "alternate_urls"));
- ASSERT_FALSE(connection.DoesColumnExist("keywords_backup",
- "alternate_urls"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // A new column should have been created.
- EXPECT_TRUE(connection.DoesColumnExist("keywords", "alternate_urls"));
- }
-}
-
-// Tests that the backup data is removed from the database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion47ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_47.sql")));
-
- // Verify pre-conditions. These are expectations for version 47 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 47, 47));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
- EXPECT_NE(0, default_search_provider_id);
-
- EXPECT_NO_FATAL_FAILURE(CheckHasBackupData(&meta_table));
- EXPECT_TRUE(connection.DoesTableExist("keywords_backup"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, kCurrentTestedVersionNumber,
- kCurrentTestedVersionNumber));
-
- int64 default_search_provider_id = 0;
- EXPECT_TRUE(meta_table.GetValue(KeywordTable::kDefaultSearchProviderKey,
- &default_search_provider_id));
- EXPECT_NE(0, default_search_provider_id);
-
- EXPECT_NO_FATAL_FAILURE(CheckNoBackupData(connection, &meta_table));
- }
-}
-
-// Tests that the |search_terms_replacement_key| column is added to the keyword
-// table schema for a version 49 database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion48ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(
- LoadDatabase(FILE_PATH_LITERAL("version_48.sql")));
-
- // Verify pre-conditions. These are expectations for version 48 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- sql::MetaTable meta_table;
- ASSERT_TRUE(meta_table.Init(&connection, 48, 48));
-
- ASSERT_FALSE(connection.DoesColumnExist("keywords",
- "search_terms_replacement_key"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // A new column should have been created.
- EXPECT_TRUE(connection.DoesColumnExist("keywords",
- "search_terms_replacement_key"));
- }
-}
-
-// Tests that the |origin| column is added to the autofill_profiles and
-// credit_cards table schemas for a version 50 database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion49ToCurrent) {
- ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_49.sql")));
-
- // Verify pre-conditions. These are expectations for version 49 of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
-
- ASSERT_FALSE(connection.DoesColumnExist("autofill_profiles", "origin"));
- ASSERT_FALSE(connection.DoesColumnExist("credit_cards", "origin"));
- }
-
- DoMigration();
-
- // Verify post-conditions. These are expectations for current version of the
- // database.
- {
- sql::Connection connection;
- ASSERT_TRUE(connection.Open(GetDatabasePath()));
- ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
-
- // Check version.
- EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection));
-
- // A new column should have been created in both tables.
- EXPECT_TRUE(connection.DoesColumnExist("autofill_profiles", "origin"));
- EXPECT_TRUE(connection.DoesColumnExist("credit_cards", "origin"));
- }
-}
-
-// Tests that the columns |image_url|, |search_url_post_params|,
-// |suggest_url_post_params|, |instant_url_post_params|, and
-// |image_url_post_params| are added to the keyword table schema for a version
-// 50 database.
-TEST_F(WebDatabaseMigrationTest, MigrateVersion50ToCurrent) {
+// Versions below 52 are deprecated. This verifies that old databases are razed.
+TEST_F(WebDatabaseMigrationTest, RazeDeprecatedVersionAndReinit) {
ASSERT_NO_FATAL_FAILURE(
LoadDatabase(FILE_PATH_LITERAL("version_50.sql")));