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

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

Issue 9834056: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upload rebase Created 8 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete_history_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/browser/autocomplete/autocomplete.h" 11 #include "chrome/browser/autocomplete/autocomplete.h"
12 #include "chrome/browser/autocomplete/autocomplete_match.h" 12 #include "chrome/browser/autocomplete/autocomplete_match.h"
13 #include "chrome/browser/history/history.h" 13 #include "chrome/browser/history/history.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/search_engines/template_url.h" 15 #include "chrome/browser/search_engines/template_url.h"
16 #include "chrome/browser/search_engines/template_url_service.h" 16 #include "chrome/browser/search_engines/template_url_service.h"
17 #include "chrome/browser/search_engines/template_url_service_factory.h" 17 #include "chrome/browser/search_engines/template_url_service_factory.h"
18 #include "chrome/browser/webdata/web_data_service_factory.h"
18 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
19 #include "chrome/test/base/testing_browser_process.h" 20 #include "chrome/test/base/testing_browser_process.h"
20 #include "chrome/test/base/testing_profile.h" 21 #include "chrome/test/base/testing_profile.h"
21 #include "content/test/test_browser_thread.h" 22 #include "content/test/test_browser_thread.h"
22 #include "content/test/test_url_fetcher_factory.h" 23 #include "content/test/test_url_fetcher_factory.h"
23 #include "net/url_request/url_request_status.h" 24 #include "net/url_request/url_request_status.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 26
26 using content::BrowserThread; 27 using content::BrowserThread;
27 28
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // If true, OnProviderUpdate exits out of the current message loop. 106 // If true, OnProviderUpdate exits out of the current message loop.
106 bool quit_when_done_; 107 bool quit_when_done_;
107 108
108 DISALLOW_COPY_AND_ASSIGN(SearchProviderTest); 109 DISALLOW_COPY_AND_ASSIGN(SearchProviderTest);
109 }; 110 };
110 111
111 void SearchProviderTest::SetUp() { 112 void SearchProviderTest::SetUp() {
112 SearchProvider::set_query_suggest_immediately(true); 113 SearchProvider::set_query_suggest_immediately(true);
113 114
114 // We need both the history service and template url model loaded. 115 // We need both the history service and template url model loaded.
116 // TemplateURLService relies on the absence of the WebDataService in tests.
117 WebDataServiceFactory::GetInstance()->SetTestingFactory(&profile_, NULL);
115 profile_.CreateHistoryService(true, false); 118 profile_.CreateHistoryService(true, false);
116 profile_.CreateTemplateURLService(); 119 profile_.CreateTemplateURLService();
117 120
118 TemplateURLService* turl_model = 121 TemplateURLService* turl_model =
119 TemplateURLServiceFactory::GetForProfile(&profile_); 122 TemplateURLServiceFactory::GetForProfile(&profile_);
120 123
121 turl_model->Load(); 124 turl_model->Load();
122 125
123 // Reset the default TemplateURL. 126 // Reset the default TemplateURL.
124 default_t_url_ = new TemplateURL(); 127 default_t_url_ = new TemplateURL();
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 fetcher = NULL; 663 fetcher = NULL;
661 664
662 // Run till the history results complete. 665 // Run till the history results complete.
663 RunTillProviderDone(); 666 RunTillProviderDone();
664 667
665 // Make sure there is a match for 'a.com' and it doesn't have a template_url. 668 // Make sure there is a match for 'a.com' and it doesn't have a template_url.
666 AutocompleteMatch nav_match; 669 AutocompleteMatch nav_match;
667 EXPECT_TRUE(FindMatchWithDestination(GURL("http://a.com"), &nav_match)); 670 EXPECT_TRUE(FindMatchWithDestination(GURL("http://a.com"), &nav_match));
668 EXPECT_FALSE(nav_match.template_url); 671 EXPECT_FALSE(nav_match.template_url);
669 } 672 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete_history_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698