summaryrefslogtreecommitdiffstats
path: root/components/webdata
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-24 04:59:33 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-24 04:59:33 +0000
commit2bf760cce240bc4d252ebf0609f037938d0d9321 (patch)
tree0867bbb53e60c343cec385649ec04c549ce55d4b /components/webdata
parent135dfc93b310f1584ec83fdbddf5972e55ed6ecc (diff)
downloadchromium_src-2bf760cce240bc4d252ebf0609f037938d0d9321.zip
chromium_src-2bf760cce240bc4d252ebf0609f037938d0d9321.tar.gz
chromium_src-2bf760cce240bc4d252ebf0609f037938d0d9321.tar.bz2
[Autofill] Add domain of origin column to the Autofill WebDB tables.
This will be populated with domains like https://accounts.google.com/ for automatically aggregated profiles and chrome://settings/autofill for manually edited profiles. BUG=170401, 231029 Review URL: https://chromiumcodereview.appspot.com/14096007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/webdata')
-rw-r--r--components/webdata/common/web_database.cc2
-rw-r--r--components/webdata/common/web_database_migration_unittest.cc35
2 files changed, 35 insertions, 2 deletions
diff --git a/components/webdata/common/web_database.cc b/components/webdata/common/web_database.cc
index 3daaf88..82b2a74 100644
--- a/components/webdata/common/web_database.cc
+++ b/components/webdata/common/web_database.cc
@@ -15,7 +15,7 @@
// corresponding changes must happen in the unit tests, and new migration test
// added. See |WebDatabaseMigrationTest::kCurrentTestedVersionNumber|.
// static
-const int WebDatabase::kCurrentVersionNumber = 49;
+const int WebDatabase::kCurrentVersionNumber = 50;
namespace {
diff --git a/components/webdata/common/web_database_migration_unittest.cc b/components/webdata/common/web_database_migration_unittest.cc
index f9d8b35..a279532 100644
--- a/components/webdata/common/web_database_migration_unittest.cc
+++ b/components/webdata/common/web_database_migration_unittest.cc
@@ -240,7 +240,7 @@ class WebDatabaseMigrationTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest);
};
-const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 49;
+const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 50;
void WebDatabaseMigrationTest::LoadDatabase(
const base::FilePath::StringType& file) {
@@ -1987,3 +1987,36 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion48ToCurrent) {
"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"));
+ }
+}