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/autocomplete/bookmark_provider.h" | 5 #include "chrome/browser/autocomplete/bookmark_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // actually bookmarked. | 387 // actually bookmarked. |
388 }; | 388 }; |
389 | 389 |
390 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(query_data); ++i) { | 390 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(query_data); ++i) { |
391 const std::string description = "for query=" + query_data[i].query + | 391 const std::string description = "for query=" + query_data[i].query + |
392 " and url=" + query_data[i].url; | 392 " and url=" + query_data[i].url; |
393 AutocompleteInput input(base::ASCIIToUTF16(query_data[i].query), | 393 AutocompleteInput input(base::ASCIIToUTF16(query_data[i].query), |
394 base::string16::npos, base::string16(), GURL(), | 394 base::string16::npos, base::string16(), GURL(), |
395 AutocompleteInput::INVALID_SPEC, false, false, | 395 AutocompleteInput::INVALID_SPEC, false, false, |
396 false, true); | 396 false, true); |
397 AutocompleteInput fixed_up_input(input); | 397 const base::string16 fixed_up_input( |
398 provider_->FixupUserInput(&fixed_up_input); | 398 provider_->FixupUserInput(input).second); |
399 BookmarkNode node(GURL(query_data[i].url)); | 399 BookmarkNode node(GURL(query_data[i].url)); |
400 node.SetTitle(base::ASCIIToUTF16(query_data[i].url)); | 400 node.SetTitle(base::ASCIIToUTF16(query_data[i].url)); |
401 BookmarkMatch bookmark_match; | 401 BookmarkMatch bookmark_match; |
402 bookmark_match.node = &node; | 402 bookmark_match.node = &node; |
403 const AutocompleteMatch& ac_match = provider_->BookmarkMatchToACMatch( | 403 const AutocompleteMatch& ac_match = provider_->BookmarkMatchToACMatch( |
404 input, fixed_up_input, bookmark_match); | 404 input, fixed_up_input, bookmark_match); |
405 EXPECT_EQ(query_data[i].allowed_to_be_default_match, | 405 EXPECT_EQ(query_data[i].allowed_to_be_default_match, |
406 ac_match.allowed_to_be_default_match) << description; | 406 ac_match.allowed_to_be_default_match) << description; |
407 EXPECT_EQ(base::ASCIIToUTF16(query_data[i].inline_autocompletion), | 407 EXPECT_EQ(base::ASCIIToUTF16(query_data[i].inline_autocompletion), |
408 ac_match.inline_autocompletion) << description; | 408 ac_match.inline_autocompletion) << description; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 ASSERT_EQ(2U, chunks.size()) << description; | 457 ASSERT_EQ(2U, chunks.size()) << description; |
458 size_t offset; | 458 size_t offset; |
459 EXPECT_TRUE(base::StringToSizeT(chunks[0], &offset)) << description; | 459 EXPECT_TRUE(base::StringToSizeT(chunks[0], &offset)) << description; |
460 EXPECT_EQ(offset, match.contents_class[i].offset) << description; | 460 EXPECT_EQ(offset, match.contents_class[i].offset) << description; |
461 int style; | 461 int style; |
462 EXPECT_TRUE(base::StringToInt(chunks[1], &style)) << description; | 462 EXPECT_TRUE(base::StringToInt(chunks[1], &style)) << description; |
463 EXPECT_EQ(style, match.contents_class[i].style) << description; | 463 EXPECT_EQ(style, match.contents_class[i].style) << description; |
464 } | 464 } |
465 } | 465 } |
466 } | 466 } |
OLD | NEW |