OLD | NEW |
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 <algorithm> | 5 #include <algorithm> |
6 #include <fstream> | 6 #include <fstream> |
7 | 7 |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 17 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
18 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" | 19 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" |
19 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
20 #include "chrome/browser/history/history_backend.h" | 21 #include "chrome/browser/history/history_backend.h" |
21 #include "chrome/browser/history/history_database.h" | 22 #include "chrome/browser/history/history_database.h" |
22 #include "chrome/browser/history/history_notifications.h" | 23 #include "chrome/browser/history/history_notifications.h" |
23 #include "chrome/browser/history/history_service.h" | 24 #include "chrome/browser/history/history_service.h" |
24 #include "chrome/browser/history/history_service_factory.h" | 25 #include "chrome/browser/history/history_service_factory.h" |
25 #include "chrome/browser/history/in_memory_url_index.h" | 26 #include "chrome/browser/history/in_memory_url_index.h" |
26 #include "chrome/browser/history/in_memory_url_index_types.h" | 27 #include "chrome/browser/history/in_memory_url_index_types.h" |
27 #include "chrome/browser/history/url_index_private_data.h" | 28 #include "chrome/browser/history/url_index_private_data.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 183 } |
183 | 184 |
184 bool InMemoryURLIndexTest::DeleteURL(const GURL& url) { | 185 bool InMemoryURLIndexTest::DeleteURL(const GURL& url) { |
185 return GetPrivateData()->DeleteURL(url); | 186 return GetPrivateData()->DeleteURL(url); |
186 } | 187 } |
187 | 188 |
188 void InMemoryURLIndexTest::SetUp() { | 189 void InMemoryURLIndexTest::SetUp() { |
189 // We cannot access the database until the backend has been loaded. | 190 // We cannot access the database until the backend has been loaded. |
190 ASSERT_TRUE(profile_.CreateHistoryService(true, false)); | 191 ASSERT_TRUE(profile_.CreateHistoryService(true, false)); |
191 profile_.CreateBookmarkModel(true); | 192 profile_.CreateBookmarkModel(true); |
192 test::WaitForBookmarkModelToLoad(&profile_); | 193 test::WaitForBookmarkModelToLoad( |
| 194 BookmarkModelFactory::GetForProfile(&profile_)); |
193 profile_.BlockUntilHistoryProcessesPendingRequests(); | 195 profile_.BlockUntilHistoryProcessesPendingRequests(); |
194 profile_.BlockUntilHistoryIndexIsRefreshed(); | 196 profile_.BlockUntilHistoryIndexIsRefreshed(); |
195 history_service_ = HistoryServiceFactory::GetForProfile( | 197 history_service_ = HistoryServiceFactory::GetForProfile( |
196 &profile_, Profile::EXPLICIT_ACCESS); | 198 &profile_, Profile::EXPLICIT_ACCESS); |
197 ASSERT_TRUE(history_service_); | 199 ASSERT_TRUE(history_service_); |
198 HistoryBackend* backend = history_service_->history_backend_.get(); | 200 HistoryBackend* backend = history_service_->history_backend_.get(); |
199 history_database_ = backend->db(); | 201 history_database_ = backend->db(); |
200 | 202 |
201 // Create and populate a working copy of the URL history database. | 203 // Create and populate a working copy of the URL history database. |
202 base::FilePath history_proto_path; | 204 base::FilePath history_proto_path; |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 full_file_path.GetComponents(&actual_parts); | 1177 full_file_path.GetComponents(&actual_parts); |
1176 ASSERT_EQ(expected_parts.size(), actual_parts.size()); | 1178 ASSERT_EQ(expected_parts.size(), actual_parts.size()); |
1177 size_t count = expected_parts.size(); | 1179 size_t count = expected_parts.size(); |
1178 for (size_t i = 0; i < count; ++i) | 1180 for (size_t i = 0; i < count; ++i) |
1179 EXPECT_EQ(expected_parts[i], actual_parts[i]); | 1181 EXPECT_EQ(expected_parts[i], actual_parts[i]); |
1180 // Must clear the history_dir_ to satisfy the dtor's DCHECK. | 1182 // Must clear the history_dir_ to satisfy the dtor's DCHECK. |
1181 set_history_dir(base::FilePath()); | 1183 set_history_dir(base::FilePath()); |
1182 } | 1184 } |
1183 | 1185 |
1184 } // namespace history | 1186 } // namespace history |
OLD | NEW |