| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 history->AddPageWithDetails(term_url, string16(), 1, 1, | 551 history->AddPageWithDetails(term_url, string16(), 1, 1, |
| 552 base::Time::Now(), false, | 552 base::Time::Now(), false, |
| 553 history::SOURCE_BROWSED); | 553 history::SOURCE_BROWSED); |
| 554 history->SetKeywordSearchTermsForURL(term_url, keyword_t_url_->id(), term); | 554 history->SetKeywordSearchTermsForURL(term_url, keyword_t_url_->id(), term); |
| 555 | 555 |
| 556 profile_.BlockUntilHistoryProcessesPendingRequests(); | 556 profile_.BlockUntilHistoryProcessesPendingRequests(); |
| 557 | 557 |
| 558 ACProviders providers; | 558 ACProviders providers; |
| 559 SearchProvider* provider = provider_.release(); | 559 SearchProvider* provider = provider_.release(); |
| 560 providers.push_back(provider); | 560 providers.push_back(provider); |
| 561 AutocompleteController controller(providers); | 561 AutocompleteController controller(providers, &profile_); |
| 562 provider->set_listener(&controller); | 562 provider->set_listener(&controller); |
| 563 controller.Start(ASCIIToUTF16("k t"), string16(), false, false, true, | 563 controller.Start(ASCIIToUTF16("k t"), string16(), false, false, true, |
| 564 AutocompleteInput::ALL_MATCHES); | 564 AutocompleteInput::ALL_MATCHES); |
| 565 const AutocompleteResult& result = controller.result(); | 565 const AutocompleteResult& result = controller.result(); |
| 566 | 566 |
| 567 // There should be two matches, one for the keyword one for what you typed. | 567 // There should be two matches, one for the keyword one for what you typed. |
| 568 ASSERT_EQ(2u, result.size()); | 568 ASSERT_EQ(2u, result.size()); |
| 569 | 569 |
| 570 EXPECT_TRUE(result.match_at(0).template_url != NULL); | 570 EXPECT_TRUE(result.match_at(0).template_url != NULL); |
| 571 EXPECT_TRUE(result.match_at(1).template_url != NULL); | 571 EXPECT_TRUE(result.match_at(1).template_url != NULL); |
| 572 EXPECT_NE(result.match_at(0).template_url, | 572 EXPECT_NE(result.match_at(0).template_url, |
| 573 result.match_at(1).template_url); | 573 result.match_at(1).template_url); |
| 574 | 574 |
| 575 EXPECT_FALSE(result.match_at(0).description.empty()); | 575 EXPECT_FALSE(result.match_at(0).description.empty()); |
| 576 EXPECT_FALSE(result.match_at(1).description.empty()); | 576 EXPECT_FALSE(result.match_at(1).description.empty()); |
| 577 EXPECT_NE(result.match_at(0).description, | 577 EXPECT_NE(result.match_at(0).description, |
| 578 result.match_at(1).description); | 578 result.match_at(1).description); |
| 579 } | 579 } |
| OLD | NEW |