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.h" | 10 #include "base/message_loop.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 std::vector<bookmark_utils::TitleMatch> matches; | 227 std::vector<bookmark_utils::TitleMatch> matches; |
228 model_->GetBookmarksWithTitlesMatching(ASCIIToUTF16("i"), 100, &matches); | 228 model_->GetBookmarksWithTitlesMatching(ASCIIToUTF16("i"), 100, &matches); |
229 ASSERT_EQ(1U, matches.size()); | 229 ASSERT_EQ(1U, matches.size()); |
230 EXPECT_TRUE(matches[0].node == n1); | 230 EXPECT_TRUE(matches[0].node == n1); |
231 EXPECT_TRUE(matches[0].match_positions.empty()); | 231 EXPECT_TRUE(matches[0].match_positions.empty()); |
232 } | 232 } |
233 | 233 |
234 TEST_F(BookmarkIndexTest, GetResultsSortedByTypedCount) { | 234 TEST_F(BookmarkIndexTest, GetResultsSortedByTypedCount) { |
235 // This ensures MessageLoop::current() will exist, which is needed by | 235 // This ensures MessageLoop::current() will exist, which is needed by |
236 // TestingProfile::BlockUntilHistoryProcessesPendingRequests(). | 236 // TestingProfile::BlockUntilHistoryProcessesPendingRequests(). |
237 MessageLoop loop(MessageLoop::TYPE_DEFAULT); | 237 base::MessageLoop loop(base::MessageLoop::TYPE_DEFAULT); |
238 content::TestBrowserThread ui_thread(BrowserThread::UI, &loop); | 238 content::TestBrowserThread ui_thread(BrowserThread::UI, &loop); |
239 content::TestBrowserThread file_thread(BrowserThread::FILE, &loop); | 239 content::TestBrowserThread file_thread(BrowserThread::FILE, &loop); |
240 | 240 |
241 TestingProfile profile; | 241 TestingProfile profile; |
242 profile.CreateHistoryService(true, false); | 242 profile.CreateHistoryService(true, false); |
243 profile.BlockUntilHistoryProcessesPendingRequests(); | 243 profile.BlockUntilHistoryProcessesPendingRequests(); |
244 profile.CreateBookmarkModel(true); | 244 profile.CreateBookmarkModel(true); |
245 | 245 |
246 BookmarkModel* model = BookmarkModelFactory::GetForProfile(&profile); | 246 BookmarkModel* model = BookmarkModelFactory::GetForProfile(&profile); |
247 ui_test_utils::WaitForBookmarkModelToLoad(model); | 247 ui_test_utils::WaitForBookmarkModelToLoad(model); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 EXPECT_EQ(data[1].url, matches[3].node->url()); | 306 EXPECT_EQ(data[1].url, matches[3].node->url()); |
307 | 307 |
308 matches.clear(); | 308 matches.clear(); |
309 // Select top two matches. | 309 // Select top two matches. |
310 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); | 310 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); |
311 | 311 |
312 EXPECT_EQ(2, static_cast<int>(matches.size())); | 312 EXPECT_EQ(2, static_cast<int>(matches.size())); |
313 EXPECT_EQ(data[0].url, matches[0].node->url()); | 313 EXPECT_EQ(data[0].url, matches[0].node->url()); |
314 EXPECT_EQ(data[3].url, matches[1].node->url()); | 314 EXPECT_EQ(data[3].url, matches[1].node->url()); |
315 } | 315 } |
OLD | NEW |