| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 std::vector<bookmark_utils::TitleMatch> matches; | 214 std::vector<bookmark_utils::TitleMatch> matches; |
| 215 model_->GetBookmarksWithTitlesMatching(ASCIIToUTF16("ABc"), 1, &matches); | 215 model_->GetBookmarksWithTitlesMatching(ASCIIToUTF16("ABc"), 1, &matches); |
| 216 EXPECT_EQ(1U, matches.size()); | 216 EXPECT_EQ(1U, matches.size()); |
| 217 } | 217 } |
| 218 | 218 |
| 219 // Makes sure if the lower case string of a bookmark title is more characters | 219 // Makes sure if the lower case string of a bookmark title is more characters |
| 220 // than the upper case string no match positions are returned. | 220 // than the upper case string no match positions are returned. |
| 221 TEST_F(BookmarkIndexTest, EmptyMatchOnMultiwideLowercaseString) { | 221 TEST_F(BookmarkIndexTest, EmptyMatchOnMultiwideLowercaseString) { |
| 222 const BookmarkNode* n1 = model_->AddURL(model_->other_node(), 0, | 222 const BookmarkNode* n1 = model_->AddURL(model_->other_node(), 0, |
| 223 WideToUTF16(L"\u0130 i"), | 223 base::WideToUTF16(L"\u0130 i"), |
| 224 GURL("http://www.google.com")); | 224 GURL("http://www.google.com")); |
| 225 | 225 |
| 226 std::vector<bookmark_utils::TitleMatch> matches; | 226 std::vector<bookmark_utils::TitleMatch> matches; |
| 227 model_->GetBookmarksWithTitlesMatching(ASCIIToUTF16("i"), 100, &matches); | 227 model_->GetBookmarksWithTitlesMatching(ASCIIToUTF16("i"), 100, &matches); |
| 228 ASSERT_EQ(1U, matches.size()); | 228 ASSERT_EQ(1U, matches.size()); |
| 229 EXPECT_TRUE(matches[0].node == n1); | 229 EXPECT_TRUE(matches[0].node == n1); |
| 230 EXPECT_TRUE(matches[0].match_positions.empty()); | 230 EXPECT_TRUE(matches[0].match_positions.empty()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 TEST_F(BookmarkIndexTest, GetResultsSortedByTypedCount) { | 233 TEST_F(BookmarkIndexTest, GetResultsSortedByTypedCount) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 EXPECT_EQ(data[1].url, matches[3].node->url()); | 305 EXPECT_EQ(data[1].url, matches[3].node->url()); |
| 306 | 306 |
| 307 matches.clear(); | 307 matches.clear(); |
| 308 // Select top two matches. | 308 // Select top two matches. |
| 309 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); | 309 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); |
| 310 | 310 |
| 311 EXPECT_EQ(2, static_cast<int>(matches.size())); | 311 EXPECT_EQ(2, static_cast<int>(matches.size())); |
| 312 EXPECT_EQ(data[0].url, matches[0].node->url()); | 312 EXPECT_EQ(data[0].url, matches[0].node->url()); |
| 313 EXPECT_EQ(data[3].url, matches[1].node->url()); | 313 EXPECT_EQ(data[3].url, matches[1].node->url()); |
| 314 } | 314 } |
| OLD | NEW |