OLD | NEW |
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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 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. | 245 // may appear as autocomplete suggests and interfere with our tests. |
246 model->SetDefaultSearchProvider(NULL); | 246 model->SetUserSelectedDefaultSearchProvider(NULL); |
247 TemplateURLService::TemplateURLVector builtins = model->GetTemplateURLs(); | 247 TemplateURLService::TemplateURLVector builtins = model->GetTemplateURLs(); |
248 for (TemplateURLService::TemplateURLVector::const_iterator | 248 for (TemplateURLService::TemplateURLVector::const_iterator |
249 i = builtins.begin(); i != builtins.end(); ++i) | 249 i = builtins.begin(); i != builtins.end(); ++i) |
250 model->Remove(*i); | 250 model->Remove(*i); |
251 | 251 |
252 TemplateURLData data; | 252 TemplateURLData data; |
253 data.short_name = ASCIIToUTF16(kSearchShortName); | 253 data.short_name = ASCIIToUTF16(kSearchShortName); |
254 data.SetKeyword(ASCIIToUTF16(kSearchKeyword)); | 254 data.SetKeyword(ASCIIToUTF16(kSearchKeyword)); |
255 data.SetURL(kSearchURL); | 255 data.SetURL(kSearchURL); |
256 TemplateURL* template_url = new TemplateURL(profile, data); | 256 TemplateURL* template_url = new TemplateURL(profile, data); |
257 model->Add(template_url); | 257 model->Add(template_url); |
258 model->SetDefaultSearchProvider(template_url); | 258 model->SetUserSelectedDefaultSearchProvider(template_url); |
259 | 259 |
260 data.SetKeyword(ASCIIToUTF16(kSearchKeyword2)); | 260 data.SetKeyword(ASCIIToUTF16(kSearchKeyword2)); |
261 model->Add(new TemplateURL(profile, data)); | 261 model->Add(new TemplateURL(profile, data)); |
262 } | 262 } |
263 | 263 |
264 void AddHistoryEntry(const TestHistoryEntry& entry, const Time& time) { | 264 void AddHistoryEntry(const TestHistoryEntry& entry, const Time& time) { |
265 Profile* profile = browser()->profile(); | 265 Profile* profile = browser()->profile(); |
266 HistoryService* history_service = HistoryServiceFactory::GetForProfile( | 266 HistoryService* history_service = HistoryServiceFactory::GetForProfile( |
267 profile, Profile::EXPLICIT_ACCESS); | 267 profile, Profile::EXPLICIT_ACCESS); |
268 ASSERT_TRUE(history_service); | 268 ASSERT_TRUE(history_service); |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_MACOSX) | 1054 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_MACOSX) |
1055 #define MAYBE_DeleteItem DISABLED_DeleteItem | 1055 #define MAYBE_DeleteItem DISABLED_DeleteItem |
1056 #else | 1056 #else |
1057 #define MAYBE_DeleteItem DeleteItem | 1057 #define MAYBE_DeleteItem DeleteItem |
1058 #endif | 1058 #endif |
1059 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_DeleteItem) { | 1059 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_DeleteItem) { |
1060 // Disable the search provider, to make sure the popup contains only history | 1060 // Disable the search provider, to make sure the popup contains only history |
1061 // items. | 1061 // items. |
1062 TemplateURLService* model = | 1062 TemplateURLService* model = |
1063 TemplateURLServiceFactory::GetForProfile(browser()->profile()); | 1063 TemplateURLServiceFactory::GetForProfile(browser()->profile()); |
1064 model->SetDefaultSearchProvider(NULL); | 1064 model->SetUserSelectedDefaultSearchProvider(NULL); |
1065 | 1065 |
1066 ui_test_utils::NavigateToURL(browser(), GURL(content::kAboutBlankURL)); | 1066 ui_test_utils::NavigateToURL(browser(), GURL(content::kAboutBlankURL)); |
1067 chrome::FocusLocationBar(browser()); | 1067 chrome::FocusLocationBar(browser()); |
1068 | 1068 |
1069 OmniboxView* omnibox_view = NULL; | 1069 OmniboxView* omnibox_view = NULL; |
1070 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 1070 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
1071 | 1071 |
1072 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); | 1072 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); |
1073 ASSERT_TRUE(popup_model); | 1073 ASSERT_TRUE(popup_model); |
1074 | 1074 |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 omnibox_view->Update(); | 1782 omnibox_view->Update(); |
1783 EXPECT_EQ(url_c, omnibox_view->GetText()); | 1783 EXPECT_EQ(url_c, omnibox_view->GetText()); |
1784 } | 1784 } |
1785 | 1785 |
1786 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { | 1786 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { |
1787 browser()->toolbar_model()->set_url_replacement_enabled(true); | 1787 browser()->toolbar_model()->set_url_replacement_enabled(true); |
1788 chrome::FocusLocationBar(browser()); | 1788 chrome::FocusLocationBar(browser()); |
1789 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); | 1789 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); |
1790 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); | 1790 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); |
1791 } | 1791 } |
OLD | NEW |