| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_index.h" | 13 #include "chrome/browser/bookmarks/bookmark_index.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_model.h" | 14 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_utils.h" | 15 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 16 #include "chrome/browser/history/history_database.h" | 16 #include "chrome/browser/history/history_database.h" |
| 17 #include "chrome/browser/history/in_memory_database.h" | 17 #include "chrome/browser/history/in_memory_database.h" |
| 18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 19 #include "content/test/test_browser_thread.h" | 19 #include "content/test/test_browser_thread.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 21 |
| 22 using content::BrowserThread; |
| 23 |
| 22 class BookmarkIndexTest : public testing::Test { | 24 class BookmarkIndexTest : public testing::Test { |
| 23 public: | 25 public: |
| 24 BookmarkIndexTest() : model_(new BookmarkModel(NULL)) {} | 26 BookmarkIndexTest() : model_(new BookmarkModel(NULL)) {} |
| 25 | 27 |
| 26 void AddBookmarksWithTitles(const char** titles, size_t count) { | 28 void AddBookmarksWithTitles(const char** titles, size_t count) { |
| 27 std::vector<std::string> title_vector; | 29 std::vector<std::string> title_vector; |
| 28 for (size_t i = 0; i < count; ++i) | 30 for (size_t i = 0; i < count; ++i) |
| 29 title_vector.push_back(titles[i]); | 31 title_vector.push_back(titles[i]); |
| 30 AddBookmarksWithTitles(title_vector); | 32 AddBookmarksWithTitles(title_vector); |
| 31 } | 33 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 EXPECT_EQ(data[1].url, matches[3].node->url()); | 294 EXPECT_EQ(data[1].url, matches[3].node->url()); |
| 293 | 295 |
| 294 matches.clear(); | 296 matches.clear(); |
| 295 // Select top two matches. | 297 // Select top two matches. |
| 296 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); | 298 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); |
| 297 | 299 |
| 298 EXPECT_EQ(2, static_cast<int>(matches.size())); | 300 EXPECT_EQ(2, static_cast<int>(matches.size())); |
| 299 EXPECT_EQ(data[0].url, matches[0].node->url()); | 301 EXPECT_EQ(data[0].url, matches[0].node->url()); |
| 300 EXPECT_EQ(data[3].url, matches[1].node->url()); | 302 EXPECT_EQ(data[3].url, matches[1].node->url()); |
| 301 } | 303 } |
| OLD | NEW |