| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "base/time.h" | 6 #include "base/time.h" |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/autocomplete/search_provider.h" | 8 #include "chrome/browser/autocomplete/search_provider.h" |
| 9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // If true, OnProviderUpdate exits out of the current message loop. | 81 // If true, OnProviderUpdate exits out of the current message loop. |
| 82 bool quit_when_done_; | 82 bool quit_when_done_; |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(SearchProviderTest); | 84 DISALLOW_COPY_AND_ASSIGN(SearchProviderTest); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 void SearchProviderTest::SetUp() { | 87 void SearchProviderTest::SetUp() { |
| 88 SearchProvider::set_query_suggest_immediately(true); | 88 SearchProvider::set_query_suggest_immediately(true); |
| 89 | 89 |
| 90 // We need both the history service and template url model loaded. | 90 // We need both the history service and template url model loaded. |
| 91 profile_.CreateHistoryService(true); | 91 profile_.CreateHistoryService(true, false); |
| 92 profile_.CreateTemplateURLModel(); | 92 profile_.CreateTemplateURLModel(); |
| 93 | 93 |
| 94 TemplateURLModel* turl_model = profile_.GetTemplateURLModel(); | 94 TemplateURLModel* turl_model = profile_.GetTemplateURLModel(); |
| 95 | 95 |
| 96 // Reset the default TemplateURL. | 96 // Reset the default TemplateURL. |
| 97 default_t_url_ = new TemplateURL(); | 97 default_t_url_ = new TemplateURL(); |
| 98 default_t_url_->SetURL(L"http://defaultturl/{searchTerms}", 0, 0); | 98 default_t_url_->SetURL(L"http://defaultturl/{searchTerms}", 0, 0); |
| 99 default_t_url_->SetSuggestionsURL(L"http://defaultturl2/{searchTerms}", 0, 0); | 99 default_t_url_->SetSuggestionsURL(L"http://defaultturl2/{searchTerms}", 0, 0); |
| 100 turl_model->Add(default_t_url_); | 100 turl_model->Add(default_t_url_); |
| 101 turl_model->SetDefaultSearchProvider(default_t_url_); | 101 turl_model->SetDefaultSearchProvider(default_t_url_); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 AutocompleteMatch match = FindMatchWithDestination(keyword_url_); | 257 AutocompleteMatch match = FindMatchWithDestination(keyword_url_); |
| 258 ASSERT_TRUE(!match.destination_url.is_empty()); | 258 ASSERT_TRUE(!match.destination_url.is_empty()); |
| 259 | 259 |
| 260 // The match should have a TemplateURL. | 260 // The match should have a TemplateURL. |
| 261 EXPECT_TRUE(match.template_url); | 261 EXPECT_TRUE(match.template_url); |
| 262 | 262 |
| 263 // The fill into edit should contain the keyword. | 263 // The fill into edit should contain the keyword. |
| 264 EXPECT_EQ(keyword_t_url_->keyword() + L" " + keyword_term_, | 264 EXPECT_EQ(keyword_t_url_->keyword() + L" " + keyword_term_, |
| 265 match.fill_into_edit); | 265 match.fill_into_edit); |
| 266 } | 266 } |
| OLD | NEW |