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 <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_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 TestingProfile profile; | 239 TestingProfile profile; |
240 profile.CreateHistoryService(true, false); | 240 profile.CreateHistoryService(true, false); |
241 profile.BlockUntilHistoryProcessesPendingRequests(); | 241 profile.BlockUntilHistoryProcessesPendingRequests(); |
242 profile.CreateBookmarkModel(true); | 242 profile.CreateBookmarkModel(true); |
243 profile.BlockUntilBookmarkModelLoaded(); | 243 profile.BlockUntilBookmarkModelLoaded(); |
244 | 244 |
245 BookmarkModel* model = BookmarkModelFactory::GetForProfile(&profile); | 245 BookmarkModel* model = BookmarkModelFactory::GetForProfile(&profile); |
246 | 246 |
247 HistoryService* const history_service = | 247 HistoryService* const history_service = |
248 HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS); | 248 HistoryServiceFactory::GetForProfile( |
| 249 &profile, Profile::EXPLICIT_ACCESS).get(); |
249 | 250 |
250 history::URLDatabase* url_db = history_service->InMemoryDatabase(); | 251 history::URLDatabase* url_db = history_service->InMemoryDatabase(); |
251 | 252 |
252 struct TestData { | 253 struct TestData { |
253 const GURL url; | 254 const GURL url; |
254 const char* title; | 255 const char* title; |
255 const int typed_count; | 256 const int typed_count; |
256 } data[] = { | 257 } data[] = { |
257 { GURL("http://www.google.com/"), "Google", 100 }, | 258 { GURL("http://www.google.com/"), "Google", 100 }, |
258 { GURL("http://maps.google.com/"), "Google Maps", 40 }, | 259 { GURL("http://maps.google.com/"), "Google Maps", 40 }, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 EXPECT_EQ(data[1].url, matches[3].node->url()); | 305 EXPECT_EQ(data[1].url, matches[3].node->url()); |
305 | 306 |
306 matches.clear(); | 307 matches.clear(); |
307 // Select top two matches. | 308 // Select top two matches. |
308 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); | 309 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); |
309 | 310 |
310 EXPECT_EQ(2, static_cast<int>(matches.size())); | 311 EXPECT_EQ(2, static_cast<int>(matches.size())); |
311 EXPECT_EQ(data[0].url, matches[0].node->url()); | 312 EXPECT_EQ(data[0].url, matches[0].node->url()); |
312 EXPECT_EQ(data[3].url, matches[1].node->url()); | 313 EXPECT_EQ(data[3].url, matches[1].node->url()); |
313 } | 314 } |
OLD | NEW |