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

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

Issue 10872032: Revert 152946 - Replace HistoryQuickProvider protobuf-based caching with an SQLite-based database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 #include <set> 5 #include <set>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } // namepace 51 } // namepace
52 52
53 namespace history { 53 namespace history {
54 54
55 class HistoryBackendTest; 55 class HistoryBackendTest;
56 56
57 // This must be a separate object since HistoryBackend manages its lifetime. 57 // This must be a separate object since HistoryBackend manages its lifetime.
58 // This just forwards the messages we're interested in to the test object. 58 // This just forwards the messages we're interested in to the test object.
59 class HistoryBackendTestDelegate : public HistoryBackend::Delegate { 59 class HistoryBackendTestDelegate : public HistoryBackend::Delegate {
60 public: 60 public:
61 explicit HistoryBackendTestDelegate(HistoryBackendTest* test); 61 explicit HistoryBackendTestDelegate(HistoryBackendTest* test) : test_(test) {}
62 62
63 virtual void NotifyProfileError(int backend_id, 63 virtual void NotifyProfileError(int backend_id,
64 sql::InitStatus init_status) OVERRIDE; 64 sql::InitStatus init_status) OVERRIDE {}
65 virtual void SetInMemoryBackend(int backend_id, 65 virtual void SetInMemoryBackend(int backend_id,
66 InMemoryHistoryBackend* backend) OVERRIDE; 66 InMemoryHistoryBackend* backend) OVERRIDE;
67 virtual void BroadcastNotifications(int type, 67 virtual void BroadcastNotifications(int type,
68 HistoryDetails* details) OVERRIDE; 68 HistoryDetails* details) OVERRIDE;
69 virtual void DBLoaded(int backend_id) OVERRIDE; 69 virtual void DBLoaded(int backend_id) OVERRIDE;
70 virtual void StartTopSitesMigration(int backend_id) OVERRIDE; 70 virtual void StartTopSitesMigration(int backend_id) OVERRIDE;
71 virtual void NotifyVisitDBObserversOnAddVisit( 71 virtual void NotifyVisitDBObserversOnAddVisit(
72 const BriefVisitInfo& info) OVERRIDE; 72 const BriefVisitInfo& info) OVERRIDE {}
73 73
74 private: 74 private:
75 // Not owned by us. 75 // Not owned by us.
76 HistoryBackendTest* test_; 76 HistoryBackendTest* test_;
77 77
78 DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestDelegate); 78 DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestDelegate);
79 }; 79 };
80 80
81 class HistoryBackendCancelableRequest : public CancelableRequestProvider, 81 class HistoryBackendCancelableRequest : public CancelableRequestProvider,
82 public CancelableRequestConsumerBase { 82 public CancelableRequestConsumerBase {
83 public: 83 public:
84 HistoryBackendCancelableRequest(); 84 HistoryBackendCancelableRequest() {}
85 85
86 // CancelableRequestConsumerBase overrides: 86 // CancelableRequestConsumerBase overrides:
87 virtual void OnRequestAdded( 87 virtual void OnRequestAdded(
88 CancelableRequestProvider* provider, 88 CancelableRequestProvider* provider,
89 CancelableRequestProvider::Handle handle) OVERRIDE; 89 CancelableRequestProvider::Handle handle) OVERRIDE {}
90 virtual void OnRequestRemoved( 90 virtual void OnRequestRemoved(
91 CancelableRequestProvider* provider, 91 CancelableRequestProvider* provider,
92 CancelableRequestProvider::Handle handle) OVERRIDE; 92 CancelableRequestProvider::Handle handle) OVERRIDE {}
93 virtual void WillExecute( 93 virtual void WillExecute(
94 CancelableRequestProvider* provider, 94 CancelableRequestProvider* provider,
95 CancelableRequestProvider::Handle handle) OVERRIDE; 95 CancelableRequestProvider::Handle handle) OVERRIDE {}
96 virtual void DidExecute( 96 virtual void DidExecute(
97 CancelableRequestProvider* provider, 97 CancelableRequestProvider* provider,
98 CancelableRequestProvider::Handle handle) OVERRIDE; 98 CancelableRequestProvider::Handle handle) OVERRIDE {}
99 99
100 template<class RequestType> 100 template<class RequestType>
101 CancelableRequestProvider::Handle MockScheduleOfRequest( 101 CancelableRequestProvider::Handle MockScheduleOfRequest(
102 RequestType* request) { 102 RequestType* request) {
103 AddRequest(request, this); 103 AddRequest(request, this);
104 return request->handle(); 104 return request->handle();
105 } 105 }
106 }; 106 };
107 107
108 class HistoryBackendTest : public testing::Test { 108 class HistoryBackendTest : public testing::Test {
109 public: 109 public:
110 HistoryBackendTest(); 110 HistoryBackendTest() : bookmark_model_(NULL), loaded_(false) {}
111 virtual ~HistoryBackendTest(); 111 virtual ~HistoryBackendTest() {
112 }
112 113
113 // Callback for QueryMostVisited. 114 // Callback for QueryMostVisited.
114 void OnQueryMostVisited(CancelableRequestProvider::Handle handle, 115 void OnQueryMostVisited(CancelableRequestProvider::Handle handle,
115 history::MostVisitedURLList data); 116 history::MostVisitedURLList data) {
117 most_visited_list_.swap(data);
118 }
116 119
117 // Callback for QueryFiltered. 120 // Callback for QueryFiltered.
118 void OnQueryFiltered(CancelableRequestProvider::Handle handle, 121 void OnQueryFiltered(CancelableRequestProvider::Handle handle,
119 const history::FilteredURLList& data); 122 const history::FilteredURLList& data) {
123 filtered_list_ = data;
124 }
120 125
121 const history::MostVisitedURLList& get_most_visited_list() const { 126 const history::MostVisitedURLList& get_most_visited_list() const {
122 return most_visited_list_; 127 return most_visited_list_;
123 } 128 }
124 129
125 const history::FilteredURLList& get_filtered_list() const { 130 const history::FilteredURLList& get_filtered_list() const {
126 return filtered_list_; 131 return filtered_list_;
127 } 132 }
128 133
129 protected: 134 protected:
130 void AddRedirectChain(const char* sequence[], int page_id); 135 scoped_refptr<HistoryBackend> backend_; // Will be NULL on init failure.
136 scoped_ptr<InMemoryHistoryBackend> mem_backend_;
131 137
132 void AddRedirectChainWithTransitionAndTime(const char* sequence[], 138 void AddRedirectChain(const char* sequence[], int page_id) {
133 int page_id, 139 AddRedirectChainWithTransitionAndTime(sequence, page_id,
134 content::PageTransition transition, 140 content::PAGE_TRANSITION_LINK,
135 base::Time time); 141 Time::Now());
142 }
143
144 void AddRedirectChainWithTransitionAndTime(
145 const char* sequence[],
146 int page_id,
147 content::PageTransition transition,
148 base::Time time) {
149 history::RedirectList redirects;
150 for (int i = 0; sequence[i] != NULL; ++i)
151 redirects.push_back(GURL(sequence[i]));
152
153 int int_scope = 1;
154 void* scope = 0;
155 memcpy(&scope, &int_scope, sizeof(int_scope));
156 scoped_refptr<history::HistoryAddPageArgs> request(
157 new history::HistoryAddPageArgs(
158 redirects.back(), time, scope, page_id, GURL(),
159 redirects, transition, history::SOURCE_BROWSED,
160 true));
161 backend_->AddPage(request);
162 }
136 163
137 // Adds CLIENT_REDIRECT page transition. 164 // Adds CLIENT_REDIRECT page transition.
138 // |url1| is the source URL and |url2| is the destination. 165 // |url1| is the source URL and |url2| is the destination.
139 // |did_replace| is true if the transition is non-user initiated and the 166 // |did_replace| is true if the transition is non-user initiated and the
140 // navigation entry for |url2| has replaced that for |url1|. The possibly 167 // navigation entry for |url2| has replaced that for |url1|. The possibly
141 // updated transition code of the visit records for |url1| and |url2| is 168 // updated transition code of the visit records for |url1| and |url2| is
142 // returned by filling in |*transition1| and |*transition2|, respectively. 169 // returned by filling in |*transition1| and |*transition2|, respectively.
143 // |time| is a time of the redirect. 170 // |time| is a time of the redirect.
144 void AddClientRedirect(const GURL& url1, 171 void AddClientRedirect(const GURL& url1, const GURL& url2, bool did_replace,
145 const GURL& url2,
146 bool did_replace,
147 base::Time time, 172 base::Time time,
148 int* transition1, 173 int* transition1, int* transition2) {
149 int* transition2); 174 void* const dummy_scope = reinterpret_cast<void*>(0x87654321);
175 history::RedirectList redirects;
176 if (url1.is_valid())
177 redirects.push_back(url1);
178 if (url2.is_valid())
179 redirects.push_back(url2);
180 scoped_refptr<HistoryAddPageArgs> request(
181 new HistoryAddPageArgs(url2, time, dummy_scope, 0, url1,
182 redirects, content::PAGE_TRANSITION_CLIENT_REDIRECT,
183 history::SOURCE_BROWSED, did_replace));
184 backend_->AddPage(request);
150 185
151 int GetTransition(const GURL& url); 186 *transition1 = getTransition(url1);
187 *transition2 = getTransition(url2);
188 }
152 189
153 FilePath get_test_dir() { return test_dir_; } 190 int getTransition(const GURL& url) {
191 if (!url.is_valid())
192 return 0;
193 URLRow row;
194 URLID id = backend_->db()->GetRowForURL(url, &row);
195 VisitVector visits;
196 EXPECT_TRUE(backend_->db()->GetVisitsForURL(id, &visits));
197 return visits[0].transition;
198 }
154 199
155 FaviconID GetFavicon(const GURL& url, IconType icon_type); 200 FilePath getTestDir() {
201 return test_dir_;
202 }
156 203
157 scoped_refptr<HistoryBackend> backend_; // Will be NULL on init failure. 204 FaviconID GetFavicon(const GURL& url, IconType icon_type) {
158 scoped_ptr<InMemoryHistoryBackend> mem_backend_; 205 IconMapping icon_mapping;
206 if (backend_->thumbnail_db_->GetIconMappingForPageURL(url, icon_type,
207 &icon_mapping))
208 return icon_mapping.icon_id;
209 else
210 return 0;
211 }
212
159 BookmarkModel bookmark_model_; 213 BookmarkModel bookmark_model_;
214
215 protected:
160 bool loaded_; 216 bool loaded_;
161 217
162 private: 218 private:
163 friend class HistoryBackendTestDelegate; 219 friend class HistoryBackendTestDelegate;
164 220
165 // testing::Test 221 // testing::Test
166 virtual void SetUp(); 222 virtual void SetUp() {
167 virtual void TearDown(); 223 if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("BackendTest"),
224 &test_dir_))
225 return;
226 backend_ = new HistoryBackend(test_dir_,
227 0,
228 new HistoryBackendTestDelegate(this),
229 &bookmark_model_);
230 backend_->Init(std::string(), false);
231 }
232 virtual void TearDown() {
233 if (backend_.get())
234 backend_->Closing();
235 backend_ = NULL;
236 mem_backend_.reset();
237 file_util::Delete(test_dir_, true);
238 }
168 239
169 void SetInMemoryBackend(int backend_id, InMemoryHistoryBackend* backend); 240 void SetInMemoryBackend(int backend_id, InMemoryHistoryBackend* backend) {
241 mem_backend_.reset(backend);
242 }
170 243
171 void BroadcastNotifications(int type, HistoryDetails* details); 244 void BroadcastNotifications(int type,
245 HistoryDetails* details) {
246 // Send the notifications directly to the in-memory database.
247 content::Details<HistoryDetails> det(details);
248 mem_backend_->Observe(type, content::Source<HistoryBackendTest>(NULL), det);
249
250 // The backend passes ownership of the details pointer to us.
251 delete details;
252 }
172 253
173 MessageLoop message_loop_; 254 MessageLoop message_loop_;
174 FilePath test_dir_; 255 FilePath test_dir_;
175 history::MostVisitedURLList most_visited_list_; 256 history::MostVisitedURLList most_visited_list_;
176 history::FilteredURLList filtered_list_; 257 history::FilteredURLList filtered_list_;
177 }; 258 };
178 259
179 // HistoryBackendTestDelegate --------------------------------------------------
180
181 HistoryBackendTestDelegate::HistoryBackendTestDelegate(HistoryBackendTest* test)
182 : test_(test) {
183 }
184
185 void HistoryBackendTestDelegate::NotifyProfileError(int backend_id,
186 sql::InitStatus init_status) {
187 }
188
189 void HistoryBackendTestDelegate::NotifyVisitDBObserversOnAddVisit(
190 const BriefVisitInfo& info) {
191 }
192
193 void HistoryBackendTestDelegate::SetInMemoryBackend(int backend_id, 260 void HistoryBackendTestDelegate::SetInMemoryBackend(int backend_id,
194 InMemoryHistoryBackend* backend) { 261 InMemoryHistoryBackend* backend) {
195 test_->SetInMemoryBackend(backend_id, backend); 262 test_->SetInMemoryBackend(backend_id, backend);
196 } 263 }
197 264
198 void HistoryBackendTestDelegate::BroadcastNotifications( 265 void HistoryBackendTestDelegate::BroadcastNotifications(
199 int type, 266 int type,
200 HistoryDetails* details) { 267 HistoryDetails* details) {
201 test_->BroadcastNotifications(type, details); 268 test_->BroadcastNotifications(type, details);
202 } 269 }
203 270
204 void HistoryBackendTestDelegate::DBLoaded(int backend_id) { 271 void HistoryBackendTestDelegate::DBLoaded(int backend_id) {
205 test_->loaded_ = true; 272 test_->loaded_ = true;
206 } 273 }
207 274
208 void HistoryBackendTestDelegate::StartTopSitesMigration(int backend_id) { 275 void HistoryBackendTestDelegate::StartTopSitesMigration(int backend_id) {
209 test_->backend_->MigrateThumbnailsDatabase(); 276 test_->backend_->MigrateThumbnailsDatabase();
210 } 277 }
211 278
212 // HistoryBackendCancelableRequest ---------------------------------------------
213
214 HistoryBackendCancelableRequest::HistoryBackendCancelableRequest() {}
215
216 void HistoryBackendCancelableRequest::OnRequestAdded(
217 CancelableRequestProvider* provider,
218 CancelableRequestProvider::Handle handle) {}
219 void HistoryBackendCancelableRequest::OnRequestRemoved(
220 CancelableRequestProvider* provider,
221 CancelableRequestProvider::Handle handle) {}
222 void HistoryBackendCancelableRequest::WillExecute(
223 CancelableRequestProvider* provider,
224 CancelableRequestProvider::Handle handle) {}
225 void HistoryBackendCancelableRequest::DidExecute(
226 CancelableRequestProvider* provider,
227 CancelableRequestProvider::Handle handle) {}
228
229 // HistoryBackendTest ----------------------------------------------------------
230
231 HistoryBackendTest::HistoryBackendTest()
232 : bookmark_model_(NULL),
233 loaded_(false) {
234 }
235
236 HistoryBackendTest::~HistoryBackendTest() {}
237
238 void HistoryBackendTest::OnQueryMostVisited(
239 CancelableRequestProvider::Handle handle,
240 history::MostVisitedURLList data) {
241 most_visited_list_.swap(data);
242 }
243
244 void HistoryBackendTest::OnQueryFiltered(
245 CancelableRequestProvider::Handle handle,
246 const history::FilteredURLList& data) {
247 filtered_list_ = data;
248 }
249
250 void HistoryBackendTest::AddRedirectChain(const char* sequence[], int page_id) {
251 AddRedirectChainWithTransitionAndTime(sequence, page_id,
252 content::PAGE_TRANSITION_LINK,
253 Time::Now());
254 }
255
256 void HistoryBackendTest::AddRedirectChainWithTransitionAndTime(
257 const char* sequence[],
258 int page_id,
259 content::PageTransition transition,
260 base::Time time) {
261 history::RedirectList redirects;
262 for (int i = 0; sequence[i] != NULL; ++i)
263 redirects.push_back(GURL(sequence[i]));
264
265 int int_scope = 1;
266 void* scope = 0;
267 memcpy(&scope, &int_scope, sizeof(int_scope));
268 scoped_refptr<history::HistoryAddPageArgs> request(
269 new history::HistoryAddPageArgs(redirects.back(), time, scope, page_id,
270 GURL(), redirects, transition,
271 history::SOURCE_BROWSED, true));
272 backend_->AddPage(request);
273 }
274
275 void HistoryBackendTest::AddClientRedirect(const GURL& url1,
276 const GURL& url2,
277 bool did_replace,
278 base::Time time,
279 int* transition1,
280 int* transition2) {
281 void* const dummy_scope = reinterpret_cast<void*>(0x87654321);
282 history::RedirectList redirects;
283 if (url1.is_valid())
284 redirects.push_back(url1);
285 if (url2.is_valid())
286 redirects.push_back(url2);
287 scoped_refptr<HistoryAddPageArgs> request(
288 new HistoryAddPageArgs(url2, time, dummy_scope, 0, url1,
289 redirects, content::PAGE_TRANSITION_CLIENT_REDIRECT,
290 history::SOURCE_BROWSED, did_replace));
291 backend_->AddPage(request);
292
293 *transition1 = GetTransition(url1);
294 *transition2 = GetTransition(url2);
295 }
296
297 int HistoryBackendTest::GetTransition(const GURL& url) {
298 if (!url.is_valid())
299 return 0;
300 URLRow row;
301 URLID id = backend_->db()->GetRowForURL(url, &row);
302 VisitVector visits;
303 EXPECT_TRUE(backend_->db()->GetVisitsForURL(id, &visits));
304 return visits[0].transition;
305 }
306
307 FaviconID HistoryBackendTest::GetFavicon(const GURL& url, IconType icon_type) {
308 IconMapping icon_mapping;
309 return backend_->thumbnail_db_->GetIconMappingForPageURL(url, icon_type,
310 &icon_mapping) ? icon_mapping.icon_id : 0;
311 }
312
313 void HistoryBackendTest::SetUp() {
314 if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("BackendTest"),
315 &test_dir_))
316 return;
317 backend_ = new HistoryBackend(test_dir_,
318 0,
319 new HistoryBackendTestDelegate(this),
320 &bookmark_model_);
321 backend_->Init(std::string(), false);
322 }
323
324 void HistoryBackendTest::TearDown() {
325 if (backend_.get())
326 backend_->Closing();
327 backend_ = NULL;
328 mem_backend_.reset();
329 file_util::Delete(test_dir_, true);
330 }
331
332 void HistoryBackendTest::SetInMemoryBackend(int backend_id,
333 InMemoryHistoryBackend* backend) {
334 mem_backend_.reset(backend);
335 }
336
337 void HistoryBackendTest::BroadcastNotifications(int type,
338 HistoryDetails* details) {
339 // Send the notifications directly to the in-memory database.
340 content::Details<HistoryDetails> det(details);
341 mem_backend_->Observe(type, content::Source<HistoryBackendTest>(NULL), det);
342
343 // The backend passes ownership of the details pointer to us.
344 delete details;
345 }
346
347 // http://crbug.com/114287 279 // http://crbug.com/114287
348 #if defined(OS_WIN) 280 #if defined(OS_WIN)
349 #define MAYBE_Loaded DISABLED_Loaded 281 #define MAYBE_Loaded DISABLED_Loaded
350 #else 282 #else
351 #define MAYBE_Loaded Loaded 283 #define MAYBE_Loaded Loaded
352 #endif // defined(OS_WIN) 284 #endif // defined(OS_WIN)
353 TEST_F(HistoryBackendTest, MAYBE_Loaded) { 285 TEST_F(HistoryBackendTest, MAYBE_Loaded) {
354 ASSERT_TRUE(backend_.get()); 286 ASSERT_TRUE(backend_.get());
355 ASSERT_TRUE(loaded_); 287 ASSERT_TRUE(loaded_);
356 } 288 }
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 backend_->Closing(); 1059 backend_->Closing();
1128 backend_ = NULL; 1060 backend_ = NULL;
1129 1061
1130 FilePath old_history_path; 1062 FilePath old_history_path;
1131 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); 1063 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path));
1132 old_history_path = old_history_path.AppendASCII("History"); 1064 old_history_path = old_history_path.AppendASCII("History");
1133 old_history_path = old_history_path.AppendASCII("HistoryNoSource"); 1065 old_history_path = old_history_path.AppendASCII("HistoryNoSource");
1134 1066
1135 // Copy history database file to current directory so that it will be deleted 1067 // Copy history database file to current directory so that it will be deleted
1136 // in Teardown. 1068 // in Teardown.
1137 FilePath new_history_path(get_test_dir()); 1069 FilePath new_history_path(getTestDir());
1138 file_util::Delete(new_history_path, true); 1070 file_util::Delete(new_history_path, true);
1139 file_util::CreateDirectory(new_history_path); 1071 file_util::CreateDirectory(new_history_path);
1140 FilePath new_history_file = new_history_path.Append(chrome::kHistoryFilename); 1072 FilePath new_history_file = new_history_path.Append(chrome::kHistoryFilename);
1141 ASSERT_TRUE(file_util::CopyFile(old_history_path, new_history_file)); 1073 ASSERT_TRUE(file_util::CopyFile(old_history_path, new_history_file));
1142 1074
1143 backend_ = new HistoryBackend(new_history_path, 1075 backend_ = new HistoryBackend(new_history_path,
1144 0, 1076 0,
1145 new HistoryBackendTestDelegate(this), 1077 new HistoryBackendTestDelegate(this),
1146 &bookmark_model_); 1078 &bookmark_model_);
1147 backend_->Init(std::string(), false); 1079 backend_->Init(std::string(), false);
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 backend_ = NULL; 1532 backend_ = NULL;
1601 1533
1602 FilePath old_history_path, old_history, old_archived; 1534 FilePath old_history_path, old_history, old_archived;
1603 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); 1535 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path));
1604 old_history_path = old_history_path.AppendASCII("History"); 1536 old_history_path = old_history_path.AppendASCII("History");
1605 old_history = old_history_path.AppendASCII("HistoryNoDuration"); 1537 old_history = old_history_path.AppendASCII("HistoryNoDuration");
1606 old_archived = old_history_path.AppendASCII("ArchivedNoDuration"); 1538 old_archived = old_history_path.AppendASCII("ArchivedNoDuration");
1607 1539
1608 // Copy history database file to current directory so that it will be deleted 1540 // Copy history database file to current directory so that it will be deleted
1609 // in Teardown. 1541 // in Teardown.
1610 FilePath new_history_path(get_test_dir()); 1542 FilePath new_history_path(getTestDir());
1611 file_util::Delete(new_history_path, true); 1543 file_util::Delete(new_history_path, true);
1612 file_util::CreateDirectory(new_history_path); 1544 file_util::CreateDirectory(new_history_path);
1613 FilePath new_history_file = new_history_path.Append(chrome::kHistoryFilename); 1545 FilePath new_history_file = new_history_path.Append(chrome::kHistoryFilename);
1614 FilePath new_archived_file = 1546 FilePath new_archived_file =
1615 new_history_path.Append(chrome::kArchivedHistoryFilename); 1547 new_history_path.Append(chrome::kArchivedHistoryFilename);
1616 ASSERT_TRUE(file_util::CopyFile(old_history, new_history_file)); 1548 ASSERT_TRUE(file_util::CopyFile(old_history, new_history_file));
1617 ASSERT_TRUE(file_util::CopyFile(old_archived, new_archived_file)); 1549 ASSERT_TRUE(file_util::CopyFile(old_archived, new_archived_file));
1618 1550
1619 backend_ = new HistoryBackend(new_history_path, 1551 backend_ = new HistoryBackend(new_history_path,
1620 0, 1552 0,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 1607
1676 backend_->DeleteURL(url); 1608 backend_->DeleteURL(url);
1677 backend_->AddPageNoVisitForBookmark(url, string16()); 1609 backend_->AddPageNoVisitForBookmark(url, string16());
1678 backend_->GetURL(url, &row); 1610 backend_->GetURL(url, &row);
1679 EXPECT_EQ(url, row.url()); 1611 EXPECT_EQ(url, row.url());
1680 EXPECT_EQ(UTF8ToUTF16(url.spec()), row.title()); 1612 EXPECT_EQ(UTF8ToUTF16(url.spec()), row.title());
1681 EXPECT_EQ(0, row.visit_count()); 1613 EXPECT_EQ(0, row.visit_count());
1682 } 1614 }
1683 1615
1684 } // namespace history 1616 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend.cc ('k') | chrome/browser/history/history_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698