| 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 11 matching lines...) Expand all Loading... |
| 22 #include "components/variations/variations_associated_data.h" | 22 #include "components/variations/variations_associated_data.h" |
| 23 #include "content/public/test/test_browser_thread_bundle.h" | 23 #include "content/public/test/test_browser_thread_bundle.h" |
| 24 #include "net/url_request/test_url_fetcher_factory.h" | 24 #include "net/url_request/test_url_fetcher_factory.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 class ZeroSuggestProviderTest : public testing::Test, | 27 class ZeroSuggestProviderTest : public testing::Test, |
| 28 public AutocompleteProviderListener { | 28 public AutocompleteProviderListener { |
| 29 public: | 29 public: |
| 30 ZeroSuggestProviderTest(); | 30 ZeroSuggestProviderTest(); |
| 31 | 31 |
| 32 virtual void SetUp() OVERRIDE; | 32 virtual void SetUp() override; |
| 33 virtual void TearDown() OVERRIDE; | 33 virtual void TearDown() override; |
| 34 | 34 |
| 35 protected: | 35 protected: |
| 36 // AutocompleteProviderListener: | 36 // AutocompleteProviderListener: |
| 37 virtual void OnProviderUpdate(bool updated_matches) OVERRIDE; | 37 virtual void OnProviderUpdate(bool updated_matches) override; |
| 38 | 38 |
| 39 void ResetFieldTrialList(); | 39 void ResetFieldTrialList(); |
| 40 | 40 |
| 41 void CreatePersonalizedFieldTrial(); | 41 void CreatePersonalizedFieldTrial(); |
| 42 | 42 |
| 43 // Set up threads for testing; this needs to be instantiated before | 43 // Set up threads for testing; this needs to be instantiated before |
| 44 // |profile_|. | 44 // |profile_|. |
| 45 content::TestBrowserThreadBundle thread_bundle_; | 45 content::TestBrowserThreadBundle thread_bundle_; |
| 46 | 46 |
| 47 // Needed for OmniboxFieldTrial::ActivateStaticTrials(). | 47 // Needed for OmniboxFieldTrial::ActivateStaticTrials(). |
| (...skipping 184 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 |