| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 profile.CreateHistoryService(true); | 217 profile.CreateHistoryService(true); |
| 218 profile.BlockUntilHistoryProcessesPendingRequests(); | 218 profile.BlockUntilHistoryProcessesPendingRequests(); |
| 219 profile.CreateBookmarkModel(true); | 219 profile.CreateBookmarkModel(true); |
| 220 profile.BlockUntilBookmarkModelLoaded(); | 220 profile.BlockUntilBookmarkModelLoaded(); |
| 221 | 221 |
| 222 BookmarkModel* model = profile.GetBookmarkModel(); | 222 BookmarkModel* model = profile.GetBookmarkModel(); |
| 223 | 223 |
| 224 HistoryService* const history_service = | 224 HistoryService* const history_service = |
| 225 profile.GetHistoryService(Profile::EXPLICIT_ACCESS); | 225 profile.GetHistoryService(Profile::EXPLICIT_ACCESS); |
| 226 | 226 |
| 227 history::URLDatabase* url_db = history_service->in_memory_database(); | 227 history::URLDatabase* url_db = history_service->InMemoryDatabase(); |
| 228 | 228 |
| 229 struct TestData { | 229 struct TestData { |
| 230 const GURL url; | 230 const GURL url; |
| 231 const std::wstring title; | 231 const std::wstring title; |
| 232 const int typed_count; | 232 const int typed_count; |
| 233 } data[] = { | 233 } data[] = { |
| 234 { GURL("http://www.google.com/"), L"Google", 100 }, | 234 { GURL("http://www.google.com/"), L"Google", 100 }, |
| 235 { GURL("http://maps.google.com/"), L"Google Maps", 40 }, | 235 { GURL("http://maps.google.com/"), L"Google Maps", 40 }, |
| 236 { GURL("http://docs.google.com/"), L"Google Docs", 50 }, | 236 { GURL("http://docs.google.com/"), L"Google Docs", 50 }, |
| 237 { GURL("http://reader.google.com/"), L"Google Reader", 80 }, | 237 { GURL("http://reader.google.com/"), L"Google Reader", 80 }, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 matches.clear(); | 282 matches.clear(); |
| 283 // Select top two matches. | 283 // Select top two matches. |
| 284 model->GetBookmarksWithTitlesMatching(L"google", 2, &matches); | 284 model->GetBookmarksWithTitlesMatching(L"google", 2, &matches); |
| 285 | 285 |
| 286 EXPECT_EQ(2, static_cast<int>(matches.size())); | 286 EXPECT_EQ(2, static_cast<int>(matches.size())); |
| 287 EXPECT_EQ(data[0].url, matches[0].node->GetURL()); | 287 EXPECT_EQ(data[0].url, matches[0].node->GetURL()); |
| 288 EXPECT_EQ(data[3].url, matches[1].node->GetURL()); | 288 EXPECT_EQ(data[3].url, matches[1].node->GetURL()); |
| 289 } | 289 } |
| 290 | 290 |
| OLD | NEW |