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/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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 AutocompleteMatch* wyt_match) { | 193 AutocompleteMatch* wyt_match) { |
194 QueryForInput(text, false); | 194 QueryForInput(text, false); |
195 profile_.BlockUntilHistoryProcessesPendingRequests(); | 195 profile_.BlockUntilHistoryProcessesPendingRequests(); |
196 ASSERT_NO_FATAL_FAILURE(FinishDefaultSuggestQuery()); | 196 ASSERT_NO_FATAL_FAILURE(FinishDefaultSuggestQuery()); |
197 EXPECT_NE(profile_.GetPrefs()->GetBoolean(prefs::kInstantEnabled), | 197 EXPECT_NE(profile_.GetPrefs()->GetBoolean(prefs::kInstantEnabled), |
198 provider_->done()); | 198 provider_->done()); |
199 if (!wyt_match) | 199 if (!wyt_match) |
200 return; | 200 return; |
201 ASSERT_GE(provider_->matches().size(), 1u); | 201 ASSERT_GE(provider_->matches().size(), 1u); |
202 EXPECT_TRUE(FindMatchWithDestination(GURL( | 202 EXPECT_TRUE(FindMatchWithDestination(GURL( |
203 default_t_url_->url_ref().ReplaceSearchTerms(text, | 203 default_t_url_->url_ref().ReplaceSearchTerms(text, |
204 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())), wyt_match)); | 204 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())), wyt_match)); |
205 } | 205 } |
206 | 206 |
207 void SearchProviderTest::TearDown() { | 207 void SearchProviderTest::TearDown() { |
208 message_loop_.RunAllPending(); | 208 message_loop_.RunAllPending(); |
209 | 209 |
210 // Shutdown the provider before the profile. | 210 // Shutdown the provider before the profile. |
211 provider_ = NULL; | 211 provider_ = NULL; |
212 } | 212 } |
213 | 213 |
214 GURL SearchProviderTest::AddSearchToHistory(TemplateURL* t_url, | 214 GURL SearchProviderTest::AddSearchToHistory(TemplateURL* t_url, |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 fetcher = NULL; | 661 fetcher = NULL; |
662 | 662 |
663 // Run till the history results complete. | 663 // Run till the history results complete. |
664 RunTillProviderDone(); | 664 RunTillProviderDone(); |
665 | 665 |
666 // Make sure there is a match for 'a.com' and it doesn't have a template_url. | 666 // Make sure there is a match for 'a.com' and it doesn't have a template_url. |
667 AutocompleteMatch nav_match; | 667 AutocompleteMatch nav_match; |
668 EXPECT_TRUE(FindMatchWithDestination(GURL("http://a.com"), &nav_match)); | 668 EXPECT_TRUE(FindMatchWithDestination(GURL("http://a.com"), &nav_match)); |
669 EXPECT_FALSE(nav_match.template_url); | 669 EXPECT_FALSE(nav_match.template_url); |
670 } | 670 } |
OLD | NEW |