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

Side by Side Diff: chrome/browser/ui/search_engines/edit_search_engine_controller.cc

Issue 276063003: Remove a call to initialize the TemplateURLService factory in this test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Some more adjustments. Created 6 years, 7 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 | « chrome/browser/ui/cocoa/cocoa_profile_test.mm ('k') | no next file » | 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/ui/search_engines/edit_search_engine_controller.h" 5 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 TemplateURLData data; 44 TemplateURLData data;
45 data.SetURL(url); 45 data.SetURL(url);
46 TemplateURL t_url(profile_, data); 46 TemplateURL t_url(profile_, data);
47 const TemplateURLRef& template_ref = t_url.url_ref(); 47 const TemplateURLRef& template_ref = t_url.url_ref();
48 if (!template_ref.IsValid()) 48 if (!template_ref.IsValid())
49 return false; 49 return false;
50 50
51 // If this is going to be the default search engine, it must support 51 // If this is going to be the default search engine, it must support
52 // replacement. 52 // replacement.
53 if (!template_ref.SupportsReplacement() && 53 if (!template_ref.SupportsReplacement() &&
54 (template_url_ == TemplateURLServiceFactory::GetForProfile(profile_)-> 54 template_url_ &&
55 GetDefaultSearchProvider())) 55 template_url_ == TemplateURLServiceFactory::GetForProfile(profile_)->
56 GetDefaultSearchProvider())
56 return false; 57 return false;
57 58
58 // Replace any search term with a placeholder string and make sure the 59 // Replace any search term with a placeholder string and make sure the
59 // resulting URL is valid. 60 // resulting URL is valid.
60 return GURL(template_ref.ReplaceSearchTerms( 61 return GURL(template_ref.ReplaceSearchTerms(
61 TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("x")))).is_valid(); 62 TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("x")))).is_valid();
62 } 63 }
63 64
64 bool EditSearchEngineController::IsKeywordValid( 65 bool EditSearchEngineController::IsKeywordValid(
65 const base::string16& keyword_input) const { 66 const base::string16& keyword_input) const {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 TemplateURL t_url(profile_, data); 138 TemplateURL t_url(profile_, data);
138 std::string expanded_url(t_url.url_ref().ReplaceSearchTerms( 139 std::string expanded_url(t_url.url_ref().ReplaceSearchTerms(
139 TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("x")))); 140 TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("x"))));
140 url::Parsed parts; 141 url::Parsed parts;
141 std::string scheme(URLFixerUpper::SegmentURL(expanded_url, &parts)); 142 std::string scheme(URLFixerUpper::SegmentURL(expanded_url, &parts));
142 if (!parts.scheme.is_valid()) 143 if (!parts.scheme.is_valid())
143 url.insert(0, scheme + "://"); 144 url.insert(0, scheme + "://");
144 145
145 return url; 146 return url;
146 } 147 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/cocoa_profile_test.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698