OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/zero_suggest_provider.h" | 5 #include "chrome/browser/autocomplete/zero_suggest_provider.h" |
6 | 6 |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 TemplateURLData data; | 79 TemplateURLData data; |
80 data.short_name = base::ASCIIToUTF16("t"); | 80 data.short_name = base::ASCIIToUTF16("t"); |
81 data.SetURL("https://www.google.com/?q={searchTerms}"); | 81 data.SetURL("https://www.google.com/?q={searchTerms}"); |
82 data.suggestions_url = "https://www.google.com/complete/?q={searchTerms}"; | 82 data.suggestions_url = "https://www.google.com/complete/?q={searchTerms}"; |
83 data.instant_url = "https://does/not/exist?strk=1"; | 83 data.instant_url = "https://does/not/exist?strk=1"; |
84 data.search_terms_replacement_key = "strk"; | 84 data.search_terms_replacement_key = "strk"; |
85 default_t_url_ = new TemplateURL(data); | 85 default_t_url_ = new TemplateURL(data); |
86 turl_model->Add(default_t_url_); | 86 turl_model->Add(default_t_url_); |
87 turl_model->SetUserSelectedDefaultSearchProvider(default_t_url_); | 87 turl_model->SetUserSelectedDefaultSearchProvider(default_t_url_); |
88 | 88 |
89 provider_ = ZeroSuggestProvider::Create(this, &profile_); | 89 provider_ = ZeroSuggestProvider::Create(this, turl_model, &profile_); |
90 } | 90 } |
91 | 91 |
92 void ZeroSuggestProviderTest::TearDown() { | 92 void ZeroSuggestProviderTest::TearDown() { |
93 // Shutdown the provider before the profile. | 93 // Shutdown the provider before the profile. |
94 provider_ = NULL; | 94 provider_ = NULL; |
95 } | 95 } |
96 | 96 |
97 void ZeroSuggestProviderTest::OnProviderUpdate(bool updated_matches) { | 97 void ZeroSuggestProviderTest::OnProviderUpdate(bool updated_matches) { |
98 } | 98 } |
99 | 99 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 base::RunLoop().RunUntilIdle(); | 233 base::RunLoop().RunUntilIdle(); |
234 | 234 |
235 // Expect that the matches have been cleared. | 235 // Expect that the matches have been cleared. |
236 ASSERT_TRUE(provider_->matches().empty()); | 236 ASSERT_TRUE(provider_->matches().empty()); |
237 | 237 |
238 // Expect the new results have been stored. | 238 // Expect the new results have been stored. |
239 EXPECT_EQ(empty_response, | 239 EXPECT_EQ(empty_response, |
240 prefs->GetString(prefs::kZeroSuggestCachedResults)); | 240 prefs->GetString(prefs::kZeroSuggestCachedResults)); |
241 } | 241 } |
OLD | NEW |