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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_view_browsertest.cc

Issue 268643002: Use the DefaultSearchManager as the exclusive authority on DSE, ignoring Web Data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: D'oh. 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
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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 void SetupSearchEngine() { 235 void SetupSearchEngine() {
236 Profile* profile = browser()->profile(); 236 Profile* profile = browser()->profile();
237 TemplateURLService* model = 237 TemplateURLService* model =
238 TemplateURLServiceFactory::GetForProfile(profile); 238 TemplateURLServiceFactory::GetForProfile(profile);
239 ASSERT_TRUE(model); 239 ASSERT_TRUE(model);
240 240
241 ui_test_utils::WaitForTemplateURLServiceToLoad(model); 241 ui_test_utils::WaitForTemplateURLServiceToLoad(model);
242 242
243 ASSERT_TRUE(model->loaded()); 243 ASSERT_TRUE(model->loaded());
244 // Remove built-in template urls, like google.com, bing.com etc., as they
245 // may appear as autocomplete suggests and interfere with our tests.
246 model->SetUserSelectedDefaultSearchProvider(NULL);
247 TemplateURLService::TemplateURLVector builtins = model->GetTemplateURLs();
248 for (TemplateURLService::TemplateURLVector::const_iterator
249 i = builtins.begin(); i != builtins.end(); ++i)
250 model->Remove(*i);
251 244
252 TemplateURLData data; 245 TemplateURLData data;
253 data.short_name = ASCIIToUTF16(kSearchShortName); 246 data.short_name = ASCIIToUTF16(kSearchShortName);
254 data.SetKeyword(ASCIIToUTF16(kSearchKeyword)); 247 data.SetKeyword(ASCIIToUTF16(kSearchKeyword));
255 data.SetURL(kSearchURL); 248 data.SetURL(kSearchURL);
256 TemplateURL* template_url = new TemplateURL(profile, data); 249 TemplateURL* template_url = new TemplateURL(profile, data);
257 model->Add(template_url); 250 model->Add(template_url);
258 model->SetUserSelectedDefaultSearchProvider(template_url); 251 model->SetUserSelectedDefaultSearchProvider(template_url);
259 252
260 data.SetKeyword(ASCIIToUTF16(kSearchKeyword2)); 253 data.SetKeyword(ASCIIToUTF16(kSearchKeyword2));
261 model->Add(new TemplateURL(profile, data)); 254 model->Add(new TemplateURL(profile, data));
255
256 // Remove built-in template urls, like google.com, bing.com etc., as they
257 // may appear as autocomplete suggests and interfere with our tests.
258 TemplateURLService::TemplateURLVector urls = model->GetTemplateURLs();
259 for (TemplateURLService::TemplateURLVector::const_iterator i = urls.begin();
260 i != urls.end();
261 ++i) {
262 if ((*i)->prepopulate_id() != 0)
263 model->Remove(*i);
264 }
262 } 265 }
263 266
264 void AddHistoryEntry(const TestHistoryEntry& entry, const Time& time) { 267 void AddHistoryEntry(const TestHistoryEntry& entry, const Time& time) {
265 Profile* profile = browser()->profile(); 268 Profile* profile = browser()->profile();
266 HistoryService* history_service = HistoryServiceFactory::GetForProfile( 269 HistoryService* history_service = HistoryServiceFactory::GetForProfile(
267 profile, Profile::EXPLICIT_ACCESS); 270 profile, Profile::EXPLICIT_ACCESS);
268 ASSERT_TRUE(history_service); 271 ASSERT_TRUE(history_service);
269 272
270 if (!history_service->BackendLoaded()) { 273 if (!history_service->BackendLoaded()) {
271 content::NotificationRegistrar registrar; 274 content::NotificationRegistrar registrar;
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 omnibox_view->Update(); 1785 omnibox_view->Update();
1783 EXPECT_EQ(url_c, omnibox_view->GetText()); 1786 EXPECT_EQ(url_c, omnibox_view->GetText());
1784 } 1787 }
1785 1788
1786 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { 1789 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) {
1787 browser()->toolbar_model()->set_url_replacement_enabled(true); 1790 browser()->toolbar_model()->set_url_replacement_enabled(true);
1788 chrome::FocusLocationBar(browser()); 1791 chrome::FocusLocationBar(browser());
1789 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); 1792 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0));
1790 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); 1793 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled());
1791 } 1794 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698