Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Unified Diff: components/webdata/common/web_database_migration_unittest.cc

Issue 382703002: Remove unused SQLLite tables from WebData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/webdata/common/web_database_migration_unittest.cc
diff --git a/components/webdata/common/web_database_migration_unittest.cc b/components/webdata/common/web_database_migration_unittest.cc
index fe8a32c9eb58ac068e214c5193b20f694d57e45a..23c838b05f039e784bed2756ed7ee07d8e035d93 100644
--- a/components/webdata/common/web_database_migration_unittest.cc
+++ b/components/webdata/common/web_database_migration_unittest.cc
@@ -16,8 +16,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
-#include "chrome/browser/webdata/web_apps_table.h"
-#include "chrome/browser/webdata/web_intents_table.h"
#include "components/autofill/core/browser/autofill_country.h"
#include "components/autofill/core/browser/autofill_profile.h"
#include "components/autofill/core/browser/autofill_type.h"
@@ -189,16 +187,12 @@ class WebDatabaseMigrationTest : public testing::Test {
KeywordTable keyword_table;
LoginsTable logins_table;
TokenServiceTable token_service_table;
- WebAppsTable web_apps_table;
- WebIntentsTable web_intents_table;
WebDatabase db;
db.AddTable(&autofill_table);
db.AddTable(&keyword_table);
db.AddTable(&logins_table);
db.AddTable(&token_service_table);
- db.AddTable(&web_apps_table);
- db.AddTable(&web_intents_table);
// This causes the migration to occur.
ASSERT_EQ(sql::INIT_OK, db.Init(GetDatabasePath()));
@@ -256,7 +250,7 @@ class WebDatabaseMigrationTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest);
};
-const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 57;
+const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 58;
void WebDatabaseMigrationTest::LoadDatabase(
const base::FilePath::StringType& file) {
@@ -312,10 +306,10 @@ TEST_F(WebDatabaseMigrationTest, MigrateEmptyToCurrent) {
EXPECT_FALSE(connection.DoesTableExist("logins"));
EXPECT_TRUE(connection.DoesTableExist("meta"));
EXPECT_TRUE(connection.DoesTableExist("token_service"));
- EXPECT_TRUE(connection.DoesTableExist("web_app_icons"));
- EXPECT_TRUE(connection.DoesTableExist("web_apps"));
- EXPECT_TRUE(connection.DoesTableExist("web_intents"));
- EXPECT_TRUE(connection.DoesTableExist("web_intents_defaults"));
+ EXPECT_FALSE(connection.DoesTableExist("web_app_icons"));
+ EXPECT_FALSE(connection.DoesTableExist("web_apps"));
+ EXPECT_FALSE(connection.DoesTableExist("web_intents"));
+ EXPECT_FALSE(connection.DoesTableExist("web_intents_defaults"));
}
}
@@ -2733,3 +2727,40 @@ TEST_F(WebDatabaseMigrationTest, MigrateVersion56ToCurrent) {
ASSERT_FALSE(s_names.Step());
}
}
+
+// Tests that migrating from version 57 to version 58 drops the web_intents and
+// web_apps tables.
+TEST_F(WebDatabaseMigrationTest, MigrateVersion57ToCurrent) {
+ ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_57.sql")));
+
+ // Verify pre-conditions. These are expectations for version 57 of the
+ // database.
+ {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+ ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection));
+
+ EXPECT_TRUE(connection.DoesTableExist("web_apps"));
+ EXPECT_TRUE(connection.DoesTableExist("web_intents"));
+ EXPECT_TRUE(connection.DoesTableExist("web_app_icons"));
Scott Hess - ex-Googler 2014/07/10 19:19:39 Order this above "web_intents", just because. Als
Cait (Slow) 2014/07/14 23:09:45 Done.
+ EXPECT_TRUE(connection.DoesTableExist("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));
+
+ EXPECT_FALSE(connection.DoesTableExist("web_apps"));
+ EXPECT_FALSE(connection.DoesTableExist("web_intents"));
+ EXPECT_FALSE(connection.DoesTableExist("web_app_icons"));
+ EXPECT_FALSE(connection.DoesTableExist("web_intents_defaults"));
+ }
+}
« components/webdata/common/web_database.cc ('K') | « components/webdata/common/web_database.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698