| OLD | NEW | 
|     1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |     1 // Copyright (c) 2012 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/history_url_provider.h" |     5 #include "chrome/browser/autocomplete/history_url_provider.h" | 
|     6  |     6  | 
|     7 #include <algorithm> |     7 #include <algorithm> | 
|     8  |     8  | 
|     9 #include "base/message_loop/message_loop.h" |     9 #include "base/message_loop/message_loop.h" | 
|    10 #include "base/path_service.h" |    10 #include "base/path_service.h" | 
|    11 #include "base/prefs/pref_service.h" |    11 #include "base/prefs/pref_service.h" | 
|    12 #include "base/strings/string_util.h" |    12 #include "base/strings/string_util.h" | 
|    13 #include "base/strings/utf_string_conversions.h" |    13 #include "base/strings/utf_string_conversions.h" | 
|    14 #include "base/time/time.h" |    14 #include "base/time/time.h" | 
|    15 #include "chrome/browser/autocomplete/autocomplete_match.h" |    15 #include "chrome/browser/autocomplete/autocomplete_match.h" | 
|    16 #include "chrome/browser/autocomplete/autocomplete_provider.h" |    16 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 
|    17 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" |    17 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" | 
|    18 #include "chrome/browser/autocomplete/autocomplete_result.h" |    18 #include "chrome/browser/autocomplete/autocomplete_result.h" | 
|    19 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |    19 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 
|    20 #include "chrome/browser/autocomplete/history_quick_provider.h" |    20 #include "chrome/browser/autocomplete/history_quick_provider.h" | 
|    21 #include "chrome/browser/history/history_service.h" |    21 #include "chrome/browser/history/history_service.h" | 
|    22 #include "chrome/browser/history/history_service_factory.h" |    22 #include "chrome/browser/history/history_service_factory.h" | 
 |    23 #include "chrome/browser/search_engines/keyword_history_service.h" | 
|    23 #include "chrome/browser/search_engines/template_url_service.h" |    24 #include "chrome/browser/search_engines/template_url_service.h" | 
|    24 #include "chrome/browser/search_engines/template_url_service_factory.h" |    25 #include "chrome/browser/search_engines/template_url_service_factory.h" | 
|    25 #include "chrome/common/pref_names.h" |    26 #include "chrome/common/pref_names.h" | 
|    26 #include "chrome/test/base/testing_browser_process.h" |    27 #include "chrome/test/base/testing_browser_process.h" | 
|    27 #include "chrome/test/base/testing_profile.h" |    28 #include "chrome/test/base/testing_profile.h" | 
|    28 #include "components/history/core/browser/url_database.h" |    29 #include "components/history/core/browser/url_database.h" | 
|    29 #include "components/metrics/proto/omnibox_event.pb.h" |    30 #include "components/metrics/proto/omnibox_event.pb.h" | 
|    30 #include "components/metrics/proto/omnibox_input_type.pb.h" |    31 #include "components/metrics/proto/omnibox_input_type.pb.h" | 
 |    32 #include "components/search_engines/search_terms_data.h" | 
|    31 #include "components/search_engines/template_url.h" |    33 #include "components/search_engines/template_url.h" | 
|    32 #include "components/url_fixer/url_fixer.h" |    34 #include "components/url_fixer/url_fixer.h" | 
|    33 #include "content/public/test/test_browser_thread_bundle.h" |    35 #include "content/public/test/test_browser_thread_bundle.h" | 
|    34 #include "testing/gtest/include/gtest/gtest.h" |    36 #include "testing/gtest/include/gtest/gtest.h" | 
|    35  |    37  | 
|    36 using base::ASCIIToUTF16; |    38 using base::ASCIIToUTF16; | 
|    37 using base::Time; |    39 using base::Time; | 
|    38 using base::TimeDelta; |    40 using base::TimeDelta; | 
|    39  |    41  | 
|    40 using content::TestBrowserThreadBundle; |    42 using content::TestBrowserThreadBundle; | 
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   162  |   164  | 
|   163   virtual ~HistoryURLProviderTest() { |   165   virtual ~HistoryURLProviderTest() { | 
|   164     HistoryQuickProvider::set_disabled(false); |   166     HistoryQuickProvider::set_disabled(false); | 
|   165   } |   167   } | 
|   166  |   168  | 
|   167   // AutocompleteProviderListener: |   169   // AutocompleteProviderListener: | 
|   168   virtual void OnProviderUpdate(bool updated_matches) OVERRIDE; |   170   virtual void OnProviderUpdate(bool updated_matches) OVERRIDE; | 
|   169  |   171  | 
|   170  protected: |   172  protected: | 
|   171   static KeyedService* CreateTemplateURLService( |   173   static KeyedService* CreateTemplateURLService( | 
|   172       content::BrowserContext* profile) { |   174       content::BrowserContext* context) { | 
|   173     return new TemplateURLService(static_cast<Profile*>(profile), NULL, |   175     Profile* profile = static_cast<Profile*>(context); | 
|   174                                   base::Closure()); |   176     return new TemplateURLService( | 
 |   177         profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL, | 
 |   178         scoped_ptr<KeywordHistoryServiceInterface>( | 
 |   179             new KeywordHistoryService(profile)), NULL, NULL, base::Closure()); | 
|   175   } |   180   } | 
|   176  |   181  | 
|   177   // testing::Test |   182   // testing::Test | 
|   178   virtual void SetUp() { |   183   virtual void SetUp() { | 
|   179     ASSERT_TRUE(SetUpImpl(false)); |   184     ASSERT_TRUE(SetUpImpl(false)); | 
|   180   } |   185   } | 
|   181   virtual void TearDown(); |   186   virtual void TearDown(); | 
|   182  |   187  | 
|   183   // Does the real setup. |   188   // Does the real setup. | 
|   184   bool SetUpImpl(bool no_db) WARN_UNUSED_RESULT; |   189   bool SetUpImpl(bool no_db) WARN_UNUSED_RESULT; | 
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1021     autocomplete_->scoring_params_.experimental_scoring_enabled = true; |  1026     autocomplete_->scoring_params_.experimental_scoring_enabled = true; | 
|  1022     ASSERT_NO_FATAL_FAILURE( |  1027     ASSERT_NO_FATAL_FAILURE( | 
|  1023         RunTest(ASCIIToUTF16(test_cases[i].input), |  1028         RunTest(ASCIIToUTF16(test_cases[i].input), | 
|  1024                 base::string16(), false, output, max_matches)); |  1029                 base::string16(), false, output, max_matches)); | 
|  1025     for (int j = 0; j < max_matches; ++j) { |  1030     for (int j = 0; j < max_matches; ++j) { | 
|  1026       EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, |  1031       EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, | 
|  1027                 matches_[j].relevance); |  1032                 matches_[j].relevance); | 
|  1028     } |  1033     } | 
|  1029   } |  1034   } | 
|  1030 } |  1035 } | 
| OLD | NEW |