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

Side by Side Diff: chrome/browser/chrome_content_browser_client_unittest.cc

Issue 1135163002: Omnibox - Strip Extra Whitespace from Custom Search Engine Names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix more tests that don't set short_name Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/search_engines/template_url_service_factory.h" 10 #include "chrome/browser/search_engines/template_url_service_factory.h"
10 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/test/base/browser_with_test_window_test.h" 13 #include "chrome/test/base/browser_with_test_window_test.h"
13 #include "chrome/test/base/ui_test_utils.h" 14 #include "chrome/test/base/ui_test_utils.h"
14 #include "components/content_settings/core/browser/host_content_settings_map.h" 15 #include "components/content_settings/core/browser/host_content_settings_map.h"
15 #include "components/search_engines/template_url_service.h" 16 #include "components/search_engines/template_url_service.h"
16 #include "components/variations/entropy_provider.h" 17 #include "components/variations/entropy_provider.h"
17 #include "content/public/browser/navigation_controller.h" 18 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/navigation_entry.h" 19 #include "content/public/browser/navigation_entry.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 157 }
157 158
158 void InstallTemplateURLWithNewTabPage(GURL new_tab_page_url) { 159 void InstallTemplateURLWithNewTabPage(GURL new_tab_page_url) {
159 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 160 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
160 profile(), &TemplateURLServiceFactory::BuildInstanceFor); 161 profile(), &TemplateURLServiceFactory::BuildInstanceFor);
161 TemplateURLService* template_url_service = 162 TemplateURLService* template_url_service =
162 TemplateURLServiceFactory::GetForProfile(browser()->profile()); 163 TemplateURLServiceFactory::GetForProfile(browser()->profile());
163 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); 164 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service);
164 165
165 TemplateURLData data; 166 TemplateURLData data;
167 data.SetShortName(base::ASCIIToUTF16("foo.com"));
166 data.SetURL("http://foo.com/url?bar={searchTerms}"); 168 data.SetURL("http://foo.com/url?bar={searchTerms}");
167 data.new_tab_url = new_tab_page_url.spec(); 169 data.new_tab_url = new_tab_page_url.spec();
168 TemplateURL* template_url = new TemplateURL(data); 170 TemplateURL* template_url = new TemplateURL(data);
169 // Takes ownership. 171 // Takes ownership.
170 template_url_service->Add(template_url); 172 template_url_service->Add(template_url);
171 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); 173 template_url_service->SetUserSelectedDefaultSearchProvider(template_url);
172 } 174 }
173 175
174 scoped_ptr<base::FieldTrialList> field_trial_list_; 176 scoped_ptr<base::FieldTrialList> field_trial_list_;
175 }; 177 };
(...skipping 10 matching lines...) Expand all
186 188
187 NavigationEntry* entry = browser()->tab_strip_model()-> 189 NavigationEntry* entry = browser()->tab_strip_model()->
188 GetActiveWebContents()->GetController().GetLastCommittedEntry(); 190 GetActiveWebContents()->GetController().GetLastCommittedEntry();
189 ASSERT_TRUE(entry != NULL); 191 ASSERT_TRUE(entry != NULL);
190 EXPECT_EQ(url_rewritten, entry->GetURL()); 192 EXPECT_EQ(url_rewritten, entry->GetURL());
191 EXPECT_EQ(url_original, entry->GetVirtualURL()); 193 EXPECT_EQ(url_original, entry->GetVirtualURL());
192 } 194 }
193 195
194 } // namespace content 196 } // namespace content
195 #endif // !defined(OS_IOS) && !defined(OS_ANDROID) 197 #endif // !defined(OS_IOS) && !defined(OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698