Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: chrome/browser/bookmarks/bookmark_index_unittest.cc

Issue 3142030: Remove wstrings from bookmarks, part 6. (Closed)
Patch Set: fix views and tests Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698