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

Unified Diff: chrome/browser/history/history_backend_unittest.cc

Issue 235863023: Eliminate the archived history database and clean up related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, improved comments, fixed minor formatting nits. Created 6 years, 7 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: chrome/browser/history/history_backend_unittest.cc
diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc
index 5ab9a3a94bc152349b25b67aef4750a7bdef9cfb..2b67bc4664e3bb692e4e7a7879b3e268f804991b 100644
--- a/chrome/browser/history/history_backend_unittest.cc
+++ b/chrome/browser/history/history_backend_unittest.cc
@@ -685,7 +685,7 @@ TEST_F(HistoryBackendTest, DeleteAll) {
const URLsDeletedDetails* details = static_cast<const URLsDeletedDetails*>(
broadcasted_notifications()[0].second);
EXPECT_TRUE(details->all_history);
- EXPECT_FALSE(details->archived);
+ EXPECT_FALSE(details->expired);
}
// Checks that adding a visit, then calling DeleteAll, and then trying to add
@@ -937,19 +937,14 @@ TEST_F(HistoryBackendTest, AddPagesWithDetails) {
rows.push_back(row4);
backend_->AddPagesWithDetails(rows, history::SOURCE_BROWSED);
- // Verify that recent URLs have ended up in the main |db_|, while expired URLs
- // have ended up in the |archived_db_|.
+ // Verify that recent URLs have ended up in the main |db_|, while the already
+ // expired URL has been ignored.
URLRow stored_row1, stored_row2, stored_row3, stored_row4;
EXPECT_NE(0, backend_->db_->GetRowForURL(row1.url(), &stored_row1));
EXPECT_NE(0, backend_->db_->GetRowForURL(row2.url(), &stored_row2));
EXPECT_NE(0, backend_->db_->GetRowForURL(row3.url(), &stored_row3));
EXPECT_EQ(0, backend_->db_->GetRowForURL(row4.url(), &stored_row4));
- EXPECT_EQ(0, backend_->archived_db_->GetRowForURL(row1.url(), &stored_row1));
- EXPECT_EQ(0, backend_->archived_db_->GetRowForURL(row2.url(), &stored_row2));
- EXPECT_EQ(0, backend_->archived_db_->GetRowForURL(row3.url(), &stored_row3));
- EXPECT_NE(0, backend_->archived_db_->GetRowForURL(row4.url(), &stored_row4));
-
// Ensure that a notification was fired, and further verify that the IDs in
// the notification are set to those that are in effect in the main database.
// The InMemoryHistoryBackend relies on this for caching.
@@ -2869,11 +2864,10 @@ TEST_F(HistoryBackendTest, MigrationVisitDuration) {
backend_->Closing();
backend_ = NULL;
- base::FilePath old_history_path, old_history, old_archived;
+ base::FilePath old_history_path, old_history;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path));
old_history_path = old_history_path.AppendASCII("History");
old_history = old_history_path.AppendASCII("HistoryNoDuration");
- old_archived = old_history_path.AppendASCII("ArchivedNoDuration");
// Copy history database file to current directory so that it will be deleted
// in Teardown.
@@ -2882,10 +2876,7 @@ TEST_F(HistoryBackendTest, MigrationVisitDuration) {
base::CreateDirectory(new_history_path);
base::FilePath new_history_file =
new_history_path.Append(chrome::kHistoryFilename);
- base::FilePath new_archived_file =
- new_history_path.Append(chrome::kArchivedHistoryFilename);
ASSERT_TRUE(base::CopyFile(old_history, new_history_file));
- ASSERT_TRUE(base::CopyFile(old_archived, new_archived_file));
backend_ = new HistoryBackend(new_history_path,
new HistoryBackendTestDelegate(this),
@@ -2894,7 +2885,7 @@ TEST_F(HistoryBackendTest, MigrationVisitDuration) {
backend_->Closing();
backend_ = NULL;
- // Now both history and archived_history databases should already be migrated.
+ // Now the history database should already be migrated.
// Check version in history database first.
int cur_version = HistoryDatabase::GetCurrentVersion();
@@ -2911,23 +2902,6 @@ TEST_F(HistoryBackendTest, MigrationVisitDuration) {
"SELECT visit_duration FROM visits LIMIT 1"));
ASSERT_TRUE(s.Step());
EXPECT_EQ(0, s.ColumnInt(0));
-
- // Repeat version and visit_duration checks in archived history database
- // also.
- cur_version = ArchivedDatabase::GetCurrentVersion();
- sql::Connection archived_db;
- ASSERT_TRUE(archived_db.Open(new_archived_file));
- sql::Statement s1(archived_db.GetUniqueStatement(
- "SELECT value FROM meta WHERE key = 'version'"));
- ASSERT_TRUE(s1.Step());
- file_version = s1.ColumnInt(0);
- EXPECT_EQ(cur_version, file_version);
-
- // Check visit_duration column in visits table is created and set to 0.
- s1.Assign(archived_db.GetUniqueStatement(
- "SELECT visit_duration FROM visits LIMIT 1"));
- ASSERT_TRUE(s1.Step());
- EXPECT_EQ(0, s1.ColumnInt(0));
}
TEST_F(HistoryBackendTest, AddPageNoVisitForBookmark) {

Powered by Google App Engine
This is Rietveld 408576698