| 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 "components/omnibox/browser/zero_suggest_provider.h" | 5 #include "components/omnibox/browser/zero_suggest_provider.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.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" |
| 11 #include "base/test/scoped_task_environment.h" |
| 11 #include "components/history/core/browser/top_sites.h" | 12 #include "components/history/core/browser/top_sites.h" |
| 12 #include "components/metrics/proto/omnibox_event.pb.h" | 13 #include "components/metrics/proto/omnibox_event.pb.h" |
| 13 #include "components/omnibox/browser/autocomplete_provider_listener.h" | 14 #include "components/omnibox/browser/autocomplete_provider_listener.h" |
| 14 #include "components/omnibox/browser/mock_autocomplete_provider_client.h" | 15 #include "components/omnibox/browser/mock_autocomplete_provider_client.h" |
| 15 #include "components/omnibox/browser/omnibox_field_trial.h" | 16 #include "components/omnibox/browser/omnibox_field_trial.h" |
| 16 #include "components/omnibox/browser/omnibox_pref_names.h" | 17 #include "components/omnibox/browser/omnibox_pref_names.h" |
| 17 #include "components/omnibox/browser/test_scheme_classifier.h" | 18 #include "components/omnibox/browser/test_scheme_classifier.h" |
| 18 #include "components/prefs/pref_registry_simple.h" | 19 #include "components/prefs/pref_registry_simple.h" |
| 19 #include "components/prefs/testing_pref_service.h" | 20 #include "components/prefs/testing_pref_service.h" |
| 20 #include "components/search_engines/template_url.h" | 21 #include "components/search_engines/template_url.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 159 |
| 159 protected: | 160 protected: |
| 160 // AutocompleteProviderListener: | 161 // AutocompleteProviderListener: |
| 161 void OnProviderUpdate(bool updated_matches) override; | 162 void OnProviderUpdate(bool updated_matches) override; |
| 162 | 163 |
| 163 void ResetFieldTrialList(); | 164 void ResetFieldTrialList(); |
| 164 | 165 |
| 165 void CreatePersonalizedFieldTrial(); | 166 void CreatePersonalizedFieldTrial(); |
| 166 void CreateMostVisitedFieldTrial(); | 167 void CreateMostVisitedFieldTrial(); |
| 167 | 168 |
| 168 base::MessageLoop message_loop_; | 169 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 169 | 170 |
| 170 // Needed for OmniboxFieldTrial::ActivateStaticTrials(). | 171 // Needed for OmniboxFieldTrial::ActivateStaticTrials(). |
| 171 std::unique_ptr<base::FieldTrialList> field_trial_list_; | 172 std::unique_ptr<base::FieldTrialList> field_trial_list_; |
| 172 | 173 |
| 173 net::TestURLFetcherFactory test_factory_; | 174 net::TestURLFetcherFactory test_factory_; |
| 174 std::unique_ptr<FakeAutocompleteProviderClient> client_; | 175 std::unique_ptr<FakeAutocompleteProviderClient> client_; |
| 175 scoped_refptr<ZeroSuggestProvider> provider_; | 176 scoped_refptr<ZeroSuggestProvider> provider_; |
| 176 TemplateURL* default_t_url_; | 177 TemplateURL* default_t_url_; |
| 177 | 178 |
| 178 private: | 179 private: |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 442 |
| 442 base::RunLoop().RunUntilIdle(); | 443 base::RunLoop().RunUntilIdle(); |
| 443 | 444 |
| 444 // Expect that the matches have been cleared. | 445 // Expect that the matches have been cleared. |
| 445 ASSERT_TRUE(provider_->matches().empty()); | 446 ASSERT_TRUE(provider_->matches().empty()); |
| 446 | 447 |
| 447 // Expect the new results have been stored. | 448 // Expect the new results have been stored. |
| 448 EXPECT_EQ(empty_response, | 449 EXPECT_EQ(empty_response, |
| 449 prefs->GetString(omnibox::kZeroSuggestCachedResults)); | 450 prefs->GetString(omnibox::kZeroSuggestCachedResults)); |
| 450 } | 451 } |
| OLD | NEW |