| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_index.h" | 10 #include "chrome/browser/bookmarks/bookmark_index.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 | 211 |
| 212 TEST_F(BookmarkIndexTest, GetResultsSortedByTypedCount) { | 212 TEST_F(BookmarkIndexTest, GetResultsSortedByTypedCount) { |
| 213 // This ensures MessageLoop::current() will exist, which is needed by | 213 // This ensures MessageLoop::current() will exist, which is needed by |
| 214 // TestingProfile::BlockUntilHistoryProcessesPendingRequests(). | 214 // TestingProfile::BlockUntilHistoryProcessesPendingRequests(). |
| 215 MessageLoop loop(MessageLoop::TYPE_DEFAULT); | 215 MessageLoop loop(MessageLoop::TYPE_DEFAULT); |
| 216 ChromeThread ui_thread(ChromeThread::UI, &loop); | 216 ChromeThread ui_thread(ChromeThread::UI, &loop); |
| 217 ChromeThread file_thread(ChromeThread::FILE, &loop); | 217 ChromeThread file_thread(ChromeThread::FILE, &loop); |
| 218 | 218 |
| 219 TestingProfile profile; | 219 TestingProfile profile; |
| 220 profile.CreateHistoryService(true); | 220 profile.CreateHistoryService(true, false); |
| 221 profile.BlockUntilHistoryProcessesPendingRequests(); | 221 profile.BlockUntilHistoryProcessesPendingRequests(); |
| 222 profile.CreateBookmarkModel(true); | 222 profile.CreateBookmarkModel(true); |
| 223 profile.BlockUntilBookmarkModelLoaded(); | 223 profile.BlockUntilBookmarkModelLoaded(); |
| 224 | 224 |
| 225 BookmarkModel* model = profile.GetBookmarkModel(); | 225 BookmarkModel* model = profile.GetBookmarkModel(); |
| 226 | 226 |
| 227 HistoryService* const history_service = | 227 HistoryService* const history_service = |
| 228 profile.GetHistoryService(Profile::EXPLICIT_ACCESS); | 228 profile.GetHistoryService(Profile::EXPLICIT_ACCESS); |
| 229 | 229 |
| 230 history::URLDatabase* url_db = history_service->InMemoryDatabase(); | 230 history::URLDatabase* url_db = history_service->InMemoryDatabase(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 matches.clear(); | 285 matches.clear(); |
| 286 // Select top two matches. | 286 // Select top two matches. |
| 287 model->GetBookmarksWithTitlesMatching(L"google", 2, &matches); | 287 model->GetBookmarksWithTitlesMatching(L"google", 2, &matches); |
| 288 | 288 |
| 289 EXPECT_EQ(2, static_cast<int>(matches.size())); | 289 EXPECT_EQ(2, static_cast<int>(matches.size())); |
| 290 EXPECT_EQ(data[0].url, matches[0].node->GetURL()); | 290 EXPECT_EQ(data[0].url, matches[0].node->GetURL()); |
| 291 EXPECT_EQ(data[3].url, matches[1].node->GetURL()); | 291 EXPECT_EQ(data[3].url, matches[1].node->GetURL()); |
| 292 } | 292 } |
| 293 | 293 |
| OLD | NEW |