Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: chrome/browser/autocomplete/history_url_provider_unittest.cc

Issue 367863005: No chrome dependencies in TemplateURLService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename to TemplateURLServiceClient Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/chrome_template_url_service_client.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
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<TemplateURLServiceClient>(
179 new ChromeTemplateURLServiceClient(profile)),
180 NULL, NULL, base::Closure());
175 } 181 }
176 182
177 // testing::Test 183 // testing::Test
178 virtual void SetUp() { 184 virtual void SetUp() {
179 ASSERT_TRUE(SetUpImpl(false)); 185 ASSERT_TRUE(SetUpImpl(false));
180 } 186 }
181 virtual void TearDown(); 187 virtual void TearDown();
182 188
183 // Does the real setup. 189 // Does the real setup.
184 bool SetUpImpl(bool no_db) WARN_UNUSED_RESULT; 190 bool SetUpImpl(bool no_db) WARN_UNUSED_RESULT;
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 autocomplete_->scoring_params_.experimental_scoring_enabled = true; 1029 autocomplete_->scoring_params_.experimental_scoring_enabled = true;
1024 ASSERT_NO_FATAL_FAILURE( 1030 ASSERT_NO_FATAL_FAILURE(
1025 RunTest(ASCIIToUTF16(test_cases[i].input), 1031 RunTest(ASCIIToUTF16(test_cases[i].input),
1026 base::string16(), false, output, max_matches)); 1032 base::string16(), false, output, max_matches));
1027 for (int j = 0; j < max_matches; ++j) { 1033 for (int j = 0; j < max_matches; ++j) {
1028 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, 1034 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance,
1029 matches_[j].relevance); 1035 matches_[j].relevance);
1030 } 1036 }
1031 } 1037 }
1032 } 1038 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698