| 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/search_provider.h" | 5 #include "chrome/browser/autocomplete/search_provider.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 | 662 |
| 663 // Verifies AutocompleteControllers sets descriptions for results correctly. | 663 // Verifies AutocompleteControllers sets descriptions for results correctly. |
| 664 TEST_F(SearchProviderTest, UpdateKeywordDescriptions) { | 664 TEST_F(SearchProviderTest, UpdateKeywordDescriptions) { |
| 665 // Add an entry that corresponds to a keyword search with 'term2'. | 665 // Add an entry that corresponds to a keyword search with 'term2'. |
| 666 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); | 666 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); |
| 667 profile_.BlockUntilHistoryProcessesPendingRequests(); | 667 profile_.BlockUntilHistoryProcessesPendingRequests(); |
| 668 | 668 |
| 669 ACProviders providers; | 669 ACProviders providers; |
| 670 SearchProvider* provider = provider_.release(); | 670 SearchProvider* provider = provider_.release(); |
| 671 providers.push_back(provider); | 671 providers.push_back(provider); |
| 672 AutocompleteController controller(providers, &profile_); | 672 |
| 673 controller.set_search_provider(provider); | 673 AutocompleteController controller(&profile_, NULL, 0); |
| 674 controller.providers_.swap(providers); |
| 675 controller.search_provider_ = provider; |
| 674 provider->set_listener(&controller); | 676 provider->set_listener(&controller); |
| 677 |
| 675 controller.Start(ASCIIToUTF16("k t"), string16(), false, false, true, | 678 controller.Start(ASCIIToUTF16("k t"), string16(), false, false, true, |
| 676 AutocompleteInput::ALL_MATCHES); | 679 AutocompleteInput::ALL_MATCHES); |
| 677 const AutocompleteResult& result = controller.result(); | 680 const AutocompleteResult& result = controller.result(); |
| 678 | 681 |
| 679 // There should be two matches, one for the keyword one for what you typed. | 682 // There should be two matches, one for the keyword one for what you typed. |
| 680 ASSERT_EQ(2u, result.size()); | 683 ASSERT_EQ(2u, result.size()); |
| 681 | 684 |
| 682 EXPECT_FALSE(result.match_at(0).keyword.empty()); | 685 EXPECT_FALSE(result.match_at(0).keyword.empty()); |
| 683 EXPECT_FALSE(result.match_at(1).keyword.empty()); | 686 EXPECT_FALSE(result.match_at(1).keyword.empty()); |
| 684 EXPECT_NE(result.match_at(0).keyword, result.match_at(1).keyword); | 687 EXPECT_NE(result.match_at(0).keyword, result.match_at(1).keyword); |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, | 1251 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, |
| 1249 match.contents_class[0].style); | 1252 match.contents_class[0].style); |
| 1250 EXPECT_EQ(4U, match.contents_class[1].offset); | 1253 EXPECT_EQ(4U, match.contents_class[1].offset); |
| 1251 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL | | 1254 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL | |
| 1252 AutocompleteMatch::ACMatchClassification::MATCH, | 1255 AutocompleteMatch::ACMatchClassification::MATCH, |
| 1253 match.contents_class[1].style); | 1256 match.contents_class[1].style); |
| 1254 EXPECT_EQ(5U, match.contents_class[2].offset); | 1257 EXPECT_EQ(5U, match.contents_class[2].offset); |
| 1255 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, | 1258 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, |
| 1256 match.contents_class[2].style); | 1259 match.contents_class[2].style); |
| 1257 } | 1260 } |
| OLD | NEW |