| 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" |
| 11 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 11 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 12 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 12 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
| 13 #include "chrome/browser/history/top_sites.h" | |
| 14 #include "chrome/browser/history/top_sites_factory.h" | 13 #include "chrome/browser/history/top_sites_factory.h" |
| 15 #include "chrome/browser/search_engines/template_url_service_factory.h" | 14 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 16 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "components/history/core/browser/top_sites.h" |
| 18 #include "components/metrics/proto/omnibox_event.pb.h" | 18 #include "components/metrics/proto/omnibox_event.pb.h" |
| 19 #include "components/omnibox/autocomplete_provider_listener.h" | 19 #include "components/omnibox/autocomplete_provider_listener.h" |
| 20 #include "components/omnibox/omnibox_field_trial.h" | 20 #include "components/omnibox/omnibox_field_trial.h" |
| 21 #include "components/search_engines/template_url.h" | 21 #include "components/search_engines/template_url.h" |
| 22 #include "components/search_engines/template_url_service.h" | 22 #include "components/search_engines/template_url_service.h" |
| 23 #include "components/variations/entropy_provider.h" | 23 #include "components/variations/entropy_provider.h" |
| 24 #include "components/variations/variations_associated_data.h" | 24 #include "components/variations/variations_associated_data.h" |
| 25 #include "content/public/test/test_browser_thread_bundle.h" | 25 #include "content/public/test/test_browser_thread_bundle.h" |
| 26 #include "net/url_request/test_url_fetcher_factory.h" | 26 #include "net/url_request/test_url_fetcher_factory.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 bool IsNonForcedFull() override { | 78 bool IsNonForcedFull() override { |
| 79 return false; | 79 return false; |
| 80 } | 80 } |
| 81 bool IsForcedFull() override { | 81 bool IsForcedFull() override { |
| 82 return false; | 82 return false; |
| 83 } | 83 } |
| 84 bool loaded() const override { | 84 bool loaded() const override { |
| 85 return false; | 85 return false; |
| 86 } | 86 } |
| 87 history::MostVisitedURLList GetPrepopulatePages() override { | 87 history::PrepopulatedPageList GetPrepopulatedPages() override { |
| 88 return history::MostVisitedURLList(); | 88 return history::PrepopulatedPageList(); |
| 89 } | 89 } |
| 90 bool AddForcedURL(const GURL& url, const base::Time& time) override { | 90 bool AddForcedURL(const GURL& url, const base::Time& time) override { |
| 91 return false; | 91 return false; |
| 92 } | 92 } |
| 93 // content::NotificationObserver: | |
| 94 void Observe(int type, | |
| 95 const content::NotificationSource& source, | |
| 96 const content::NotificationDetails& details) override {} | |
| 97 // RefcountedKeyedService: | 93 // RefcountedKeyedService: |
| 98 void ShutdownOnUIThread() override {} | 94 void ShutdownOnUIThread() override {} |
| 99 | 95 |
| 100 // A test-specific field for controlling when most visited callback is run | 96 // A test-specific field for controlling when most visited callback is run |
| 101 // after top sites have been requested. | 97 // after top sites have been requested. |
| 102 GetMostVisitedURLsCallback mv_callback; | 98 GetMostVisitedURLsCallback mv_callback; |
| 103 | 99 |
| 104 protected: | 100 protected: |
| 105 ~FakeEmptyTopSites() override {} | 101 ~FakeEmptyTopSites() override {} |
| 106 }; | 102 }; |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 441 |
| 446 base::RunLoop().RunUntilIdle(); | 442 base::RunLoop().RunUntilIdle(); |
| 447 | 443 |
| 448 // Expect that the matches have been cleared. | 444 // Expect that the matches have been cleared. |
| 449 ASSERT_TRUE(provider_->matches().empty()); | 445 ASSERT_TRUE(provider_->matches().empty()); |
| 450 | 446 |
| 451 // Expect the new results have been stored. | 447 // Expect the new results have been stored. |
| 452 EXPECT_EQ(empty_response, | 448 EXPECT_EQ(empty_response, |
| 453 prefs->GetString(prefs::kZeroSuggestCachedResults)); | 449 prefs->GetString(prefs::kZeroSuggestCachedResults)); |
| 454 } | 450 } |
| OLD | NEW |