| 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 "chrome/browser/bookmarks/bookmark_index.h" | 5 #include "chrome/browser/bookmarks/bookmark_index.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 EXPECT_TRUE(matches[0].node == n1); | 229 EXPECT_TRUE(matches[0].node == n1); |
| 230 EXPECT_TRUE(matches[0].match_positions.empty()); | 230 EXPECT_TRUE(matches[0].match_positions.empty()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 TEST_F(BookmarkIndexTest, GetResultsSortedByTypedCount) { | 233 TEST_F(BookmarkIndexTest, GetResultsSortedByTypedCount) { |
| 234 // This ensures MessageLoop::current() will exist, which is needed by | 234 // This ensures MessageLoop::current() will exist, which is needed by |
| 235 // TestingProfile::BlockUntilHistoryProcessesPendingRequests(). | 235 // TestingProfile::BlockUntilHistoryProcessesPendingRequests(). |
| 236 content::TestBrowserThreadBundle thread_bundle; | 236 content::TestBrowserThreadBundle thread_bundle; |
| 237 | 237 |
| 238 TestingProfile profile; | 238 TestingProfile profile; |
| 239 profile.CreateHistoryService(true, false); | 239 ASSERT_TRUE(profile.CreateHistoryService(true, false)); |
| 240 profile.BlockUntilHistoryProcessesPendingRequests(); | 240 profile.BlockUntilHistoryProcessesPendingRequests(); |
| 241 profile.CreateBookmarkModel(true); | 241 profile.CreateBookmarkModel(true); |
| 242 | 242 |
| 243 BookmarkModel* model = BookmarkModelFactory::GetForProfile(&profile); | 243 BookmarkModel* model = BookmarkModelFactory::GetForProfile(&profile); |
| 244 ui_test_utils::WaitForBookmarkModelToLoad(model); | 244 ui_test_utils::WaitForBookmarkModelToLoad(model); |
| 245 | 245 |
| 246 HistoryService* const history_service = | 246 HistoryService* const history_service = |
| 247 HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS); | 247 HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS); |
| 248 | 248 |
| 249 history::URLDatabase* url_db = history_service->InMemoryDatabase(); | 249 history::URLDatabase* url_db = history_service->InMemoryDatabase(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 EXPECT_EQ(data[1].url, matches[3].node->url()); | 303 EXPECT_EQ(data[1].url, matches[3].node->url()); |
| 304 | 304 |
| 305 matches.clear(); | 305 matches.clear(); |
| 306 // Select top two matches. | 306 // Select top two matches. |
| 307 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); | 307 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); |
| 308 | 308 |
| 309 EXPECT_EQ(2, static_cast<int>(matches.size())); | 309 EXPECT_EQ(2, static_cast<int>(matches.size())); |
| 310 EXPECT_EQ(data[0].url, matches[0].node->url()); | 310 EXPECT_EQ(data[0].url, matches[0].node->url()); |
| 311 EXPECT_EQ(data[3].url, matches[1].node->url()); | 311 EXPECT_EQ(data[3].url, matches[1].node->url()); |
| 312 } | 312 } |
| OLD | NEW |