| 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" | 13 #include "chrome/browser/history/top_sites_provider.h" |
| 14 #include "chrome/browser/search_engines/template_url_service_factory.h" | 14 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "components/metrics/proto/omnibox_event.pb.h" | 17 #include "components/metrics/proto/omnibox_event.pb.h" |
| 18 #include "components/omnibox/autocomplete_provider_listener.h" | 18 #include "components/omnibox/autocomplete_provider_listener.h" |
| 19 #include "components/omnibox/omnibox_field_trial.h" | 19 #include "components/omnibox/omnibox_field_trial.h" |
| 20 #include "components/search_engines/template_url.h" | 20 #include "components/search_engines/template_url.h" |
| 21 #include "components/search_engines/template_url_service.h" | 21 #include "components/search_engines/template_url_service.h" |
| 22 #include "components/variations/entropy_provider.h" | 22 #include "components/variations/entropy_provider.h" |
| 23 #include "components/variations/variations_associated_data.h" | 23 #include "components/variations/variations_associated_data.h" |
| 24 #include "content/public/test/test_browser_thread_bundle.h" | 24 #include "content/public/test/test_browser_thread_bundle.h" |
| 25 #include "net/url_request/test_url_fetcher_factory.h" | 25 #include "net/url_request/test_url_fetcher_factory.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 class FakeEmptyTopSites : public history::TopSites { | 29 class FakeEmptyTopSites : public history::TopSitesProvider { |
| 30 public: | 30 public: |
| 31 FakeEmptyTopSites() { | 31 FakeEmptyTopSites() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 // history::TopSites: | 34 // history::TopSites: |
| 35 bool SetPageThumbnail(const GURL& url, const gfx::Image& thumbnail, | 35 bool SetPageThumbnail(const GURL& url, const gfx::Image& thumbnail, |
| 36 const ThumbnailScore& score) override { | 36 const ThumbnailScore& score) override { |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 bool SetPageThumbnailToJPEGBytes(const GURL& url, | 39 bool SetPageThumbnailToJPEGBytes(const GURL& url, |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 408 |
| 409 base::RunLoop().RunUntilIdle(); | 409 base::RunLoop().RunUntilIdle(); |
| 410 | 410 |
| 411 // Expect that the matches have been cleared. | 411 // Expect that the matches have been cleared. |
| 412 ASSERT_TRUE(provider_->matches().empty()); | 412 ASSERT_TRUE(provider_->matches().empty()); |
| 413 | 413 |
| 414 // Expect the new results have been stored. | 414 // Expect the new results have been stored. |
| 415 EXPECT_EQ(empty_response, | 415 EXPECT_EQ(empty_response, |
| 416 prefs->GetString(prefs::kZeroSuggestCachedResults)); | 416 prefs->GetString(prefs::kZeroSuggestCachedResults)); |
| 417 } | 417 } |
| OLD | NEW |