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 "base/format_macros.h" | 5 #include "base/format_macros.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/autocomplete/autocomplete.h" | 9 #include "chrome/browser/autocomplete/autocomplete.h" |
10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
11 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 11 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
12 #include "chrome/browser/extensions/extension_browsertest.h" | 12 #include "chrome/browser/extensions/extension_browsertest.h" |
13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
14 #include "chrome/browser/extensions/unpacked_installer.h" | 14 #include "chrome/browser/extensions/unpacked_installer.h" |
15 #include "chrome/browser/history/history.h" | 15 #include "chrome/browser/history/history.h" |
16 #include "chrome/browser/history/history_service_factory.h" | 16 #include "chrome/browser/history/history_service_factory.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_commands.h" | 19 #include "chrome/browser/ui/browser_commands.h" |
| 20 #include "chrome/browser/ui/browser_tabstrip.h" |
20 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/browser/ui/omnibox/location_bar.h" | 22 #include "chrome/browser/ui/omnibox/location_bar.h" |
22 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 23 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
23 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 24 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 25 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
25 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
26 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
27 #include "chrome/test/base/in_process_browser_test.h" | 28 #include "chrome/test/base/in_process_browser_test.h" |
28 #include "chrome/test/base/ui_test_utils.h" | 29 #include "chrome/test/base/ui_test_utils.h" |
29 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // http://code.google.com/p/chromium/issues/detail?id=38385 | 149 // http://code.google.com/p/chromium/issues/detail?id=38385 |
149 // Make sure that tabbing away from an empty omnibar causes a revert | 150 // Make sure that tabbing away from an empty omnibar causes a revert |
150 // and select all. | 151 // and select all. |
151 LocationBar* location_bar = GetLocationBar(); | 152 LocationBar* location_bar = GetLocationBar(); |
152 OmniboxView* location_entry = location_bar->GetLocationEntry(); | 153 OmniboxView* location_entry = location_bar->GetLocationEntry(); |
153 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), location_entry->GetText()); | 154 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), location_entry->GetText()); |
154 location_entry->SetUserText(string16()); | 155 location_entry->SetUserText(string16()); |
155 ui_test_utils::WindowedNotificationObserver observer( | 156 ui_test_utils::WindowedNotificationObserver observer( |
156 content::NOTIFICATION_LOAD_STOP, | 157 content::NOTIFICATION_LOAD_STOP, |
157 content::NotificationService::AllSources()); | 158 content::NotificationService::AllSources()); |
158 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), | 159 chrome::AddSelectedTabWithURL(browser(), GURL(chrome::kAboutBlankURL), |
159 content::PAGE_TRANSITION_START_PAGE); | 160 content::PAGE_TRANSITION_START_PAGE); |
160 observer.Wait(); | 161 observer.Wait(); |
161 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), location_entry->GetText()); | 162 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), location_entry->GetText()); |
162 chrome::CloseTab(browser()); | 163 chrome::CloseTab(browser()); |
163 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), location_entry->GetText()); | 164 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), location_entry->GetText()); |
164 EXPECT_TRUE(location_entry->IsSelectAll()); | 165 EXPECT_TRUE(location_entry->IsSelectAll()); |
165 } | 166 } |
166 | 167 |
167 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, FocusSearch) { | 168 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, FocusSearch) { |
168 LocationBar* location_bar = GetLocationBar(); | 169 LocationBar* location_bar = GetLocationBar(); |
169 OmniboxView* location_entry = location_bar->GetLocationEntry(); | 170 OmniboxView* location_entry = location_bar->GetLocationEntry(); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 EXPECT_TRUE(autocomplete_controller->done()); | 301 EXPECT_TRUE(autocomplete_controller->done()); |
301 const AutocompleteResult& result = autocomplete_controller->result(); | 302 const AutocompleteResult& result = autocomplete_controller->result(); |
302 // 'App test' is also a substring of extension 'Packaged App Test'. | 303 // 'App test' is also a substring of extension 'Packaged App Test'. |
303 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result); | 304 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result); |
304 AutocompleteMatch match = result.match_at(0); | 305 AutocompleteMatch match = result.match_at(0); |
305 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents); | 306 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents); |
306 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type); | 307 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type); |
307 EXPECT_FALSE(match.deletable); | 308 EXPECT_FALSE(match.deletable); |
308 } | 309 } |
309 } | 310 } |
OLD | NEW |