OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_util.h" | 10 #include "base/string_util.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 ExpectMatches(L"A", NULL, 0U); | 184 ExpectMatches(L"A", NULL, 0U); |
185 } | 185 } |
186 | 186 |
187 // Makes sure index is updated when a node's title is changed. | 187 // Makes sure index is updated when a node's title is changed. |
188 TEST_F(BookmarkIndexTest, ChangeTitle) { | 188 TEST_F(BookmarkIndexTest, ChangeTitle) { |
189 const wchar_t* input[] = { L"a", L"b" }; | 189 const wchar_t* input[] = { L"a", L"b" }; |
190 AddBookmarksWithTitles(input, ARRAYSIZE_UNSAFE(input)); | 190 AddBookmarksWithTitles(input, ARRAYSIZE_UNSAFE(input)); |
191 | 191 |
192 // Remove the node and make sure we don't get back any results. | 192 // Remove the node and make sure we don't get back any results. |
193 const wchar_t* expected[] = { L"blah" }; | 193 const wchar_t* expected[] = { L"blah" }; |
194 model_->SetTitle(model_->other_node()->GetChild(0), L"blah"); | 194 model_->SetTitle(model_->other_node()->GetChild(0), ASCIIToUTF16("blah")); |
195 ExpectMatches(L"BlAh", expected, ARRAYSIZE_UNSAFE(expected)); | 195 ExpectMatches(L"BlAh", expected, ARRAYSIZE_UNSAFE(expected)); |
196 } | 196 } |
197 | 197 |
198 // Makes sure no more than max queries is returned. | 198 // Makes sure no more than max queries is returned. |
199 TEST_F(BookmarkIndexTest, HonorMax) { | 199 TEST_F(BookmarkIndexTest, HonorMax) { |
200 const wchar_t* input[] = { L"abcd", L"abcde" }; | 200 const wchar_t* input[] = { L"abcd", L"abcde" }; |
201 AddBookmarksWithTitles(input, ARRAYSIZE_UNSAFE(input)); | 201 AddBookmarksWithTitles(input, ARRAYSIZE_UNSAFE(input)); |
202 | 202 |
203 std::vector<bookmark_utils::TitleMatch> matches; | 203 std::vector<bookmark_utils::TitleMatch> matches; |
204 model_->GetBookmarksWithTitlesMatching(ASCIIToUTF16("ABc"), 1, &matches); | 204 model_->GetBookmarksWithTitlesMatching(ASCIIToUTF16("ABc"), 1, &matches); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 295 |
296 matches.clear(); | 296 matches.clear(); |
297 // Select top two matches. | 297 // Select top two matches. |
298 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); | 298 model->GetBookmarksWithTitlesMatching(ASCIIToUTF16("google"), 2, &matches); |
299 | 299 |
300 EXPECT_EQ(2, static_cast<int>(matches.size())); | 300 EXPECT_EQ(2, static_cast<int>(matches.size())); |
301 EXPECT_EQ(data[0].url, matches[0].node->GetURL()); | 301 EXPECT_EQ(data[0].url, matches[0].node->GetURL()); |
302 EXPECT_EQ(data[3].url, matches[1].node->GetURL()); | 302 EXPECT_EQ(data[3].url, matches[1].node->GetURL()); |
303 } | 303 } |
304 | 304 |
OLD | NEW |