| 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 "components/bookmarks/core/browser/bookmark_index.h" | 5 #include "components/bookmarks/core/browser/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" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" | |
| 17 #include "chrome/browser/bookmarks/test_bookmark_client.h" | |
| 18 #include "chrome/browser/history/history_service.h" | 16 #include "chrome/browser/history/history_service.h" |
| 19 #include "chrome/browser/history/history_service_factory.h" | 17 #include "chrome/browser/history/history_service_factory.h" |
| 20 #include "chrome/browser/history/url_database.h" | 18 #include "chrome/browser/history/url_database.h" |
| 21 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
| 22 #include "components/bookmarks/core/browser/bookmark_match.h" | 20 #include "components/bookmarks/core/browser/bookmark_match.h" |
| 23 #include "components/bookmarks/core/browser/bookmark_model.h" | 21 #include "components/bookmarks/core/browser/bookmark_model.h" |
| 22 #include "components/bookmarks/core/test/bookmark_test_helpers.h" |
| 23 #include "components/bookmarks/core/test/test_bookmark_client.h" |
| 24 #include "content/public/test/test_browser_thread_bundle.h" | 24 #include "content/public/test/test_browser_thread_bundle.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 using base::ASCIIToUTF16; | 27 using base::ASCIIToUTF16; |
| 28 | 28 |
| 29 class BookmarkIndexTest : public testing::Test { | 29 class BookmarkIndexTest : public testing::Test { |
| 30 public: | 30 public: |
| 31 BookmarkIndexTest() : model_(client_.CreateModel(false)) {} | 31 BookmarkIndexTest() : model_(client_.CreateModel(false)) {} |
| 32 | 32 |
| 33 typedef std::pair<std::string, std::string> TitleAndURL; | 33 typedef std::pair<std::string, std::string> TitleAndURL; |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 EXPECT_EQ(data[1].url, matches[3].node->url()); | 462 EXPECT_EQ(data[1].url, matches[3].node->url()); |
| 463 | 463 |
| 464 matches.clear(); | 464 matches.clear(); |
| 465 // Select top two matches. | 465 // Select top two matches. |
| 466 model->GetBookmarksMatching(ASCIIToUTF16("google"), 2, &matches); | 466 model->GetBookmarksMatching(ASCIIToUTF16("google"), 2, &matches); |
| 467 | 467 |
| 468 EXPECT_EQ(2, static_cast<int>(matches.size())); | 468 EXPECT_EQ(2, static_cast<int>(matches.size())); |
| 469 EXPECT_EQ(data[0].url, matches[0].node->url()); | 469 EXPECT_EQ(data[0].url, matches[0].node->url()); |
| 470 EXPECT_EQ(data[3].url, matches[1].node->url()); | 470 EXPECT_EQ(data[3].url, matches[1].node->url()); |
| 471 } | 471 } |
| OLD | NEW |