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

Side by Side Diff: chrome/browser/history/history_unittest.cc

Issue 934083003: Cleanup HistoryService and HistoryBackend interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@android-backend-provider
Patch Set: Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // History unit tests come in two flavors: 5 // History unit tests come in two flavors:
6 // 6 //
7 // 1. The more complicated style is that the unit test creates a full history 7 // 1. The more complicated style is that the unit test creates a full history
8 // service. This spawns a background thread for the history backend, and 8 // service. This spawns a background thread for the history backend, and
9 // all communication is asynchronous. This is useful for testing more 9 // all communication is asynchronous. This is useful for testing more
10 // complicated things or end-to-end behavior. 10 // complicated things or end-to-end behavior.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 ~HistoryBackendDBTest() override {} 131 ~HistoryBackendDBTest() override {}
132 132
133 protected: 133 protected:
134 friend class BackendDelegate; 134 friend class BackendDelegate;
135 135
136 // Creates the HistoryBackend and HistoryDatabase on the current thread, 136 // Creates the HistoryBackend and HistoryDatabase on the current thread,
137 // assigning the values to backend_ and db_. 137 // assigning the values to backend_ and db_.
138 void CreateBackendAndDatabase() { 138 void CreateBackendAndDatabase() {
139 backend_ = 139 backend_ = new HistoryBackend(new BackendDelegate(this), nullptr);
140 new HistoryBackend(history_dir_, new BackendDelegate(this), NULL);
141 backend_->Init(std::string(), false, 140 backend_->Init(std::string(), false,
142 HistoryDatabaseParamsForPath(history_dir_)); 141 HistoryDatabaseParamsForPath(history_dir_));
143 db_ = backend_->db_.get(); 142 db_ = backend_->db_.get();
144 DCHECK(in_mem_backend_) << "Mem backend should have been set by " 143 DCHECK(in_mem_backend_) << "Mem backend should have been set by "
145 "HistoryBackend::Init"; 144 "HistoryBackend::Init";
146 } 145 }
147 146
148 void CreateDBVersion(int version) { 147 void CreateDBVersion(int version) {
149 base::FilePath data_path; 148 base::FilePath data_path;
150 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 149 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 std::vector<PageUsageData*> results; 1865 std::vector<PageUsageData*> results;
1867 db_->QuerySegmentUsage(segment_time, 10, &results); 1866 db_->QuerySegmentUsage(segment_time, 10, &results);
1868 ASSERT_EQ(1u, results.size()); 1867 ASSERT_EQ(1u, results.size());
1869 EXPECT_EQ(url, results[0]->GetURL()); 1868 EXPECT_EQ(url, results[0]->GetURL());
1870 EXPECT_EQ(segment_id, results[0]->GetID()); 1869 EXPECT_EQ(segment_id, results[0]->GetID());
1871 EXPECT_EQ(title, results[0]->GetTitle()); 1870 EXPECT_EQ(title, results[0]->GetTitle());
1872 STLDeleteElements(&results); 1871 STLDeleteElements(&results);
1873 } 1872 }
1874 1873
1875 } // namespace history 1874 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698