OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_edit.h" | 10 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
11 #include "chrome/browser/autocomplete/autocomplete_match.h" | 11 #include "chrome/browser/autocomplete/autocomplete_match.h" |
12 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 12 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
13 #include "chrome/browser/extensions/extension_browsertest.h" | 13 #include "chrome/browser/extensions/extension_browsertest.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/history/history.h" | 15 #include "chrome/browser/history/history.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/tabs/tab_strip_model.h" | 17 #include "chrome/browser/tabs/tab_strip_model.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/browser/ui/omnibox/location_bar.h" | 20 #include "chrome/browser/ui/omnibox/location_bar.h" |
21 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 21 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
22 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
24 #include "chrome/test/base/in_process_browser_test.h" | 24 #include "chrome/test/base/in_process_browser_test.h" |
25 #include "chrome/test/base/ui_test_utils.h" | 25 #include "chrome/test/base/ui_test_utils.h" |
26 #include "content/browser/tab_contents/tab_contents.h" | 26 #include "content/browser/tab_contents/tab_contents.h" |
| 27 #include "content/public/browser/notification_service.h" |
27 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
29 | 30 |
30 // Autocomplete test is flaky on ChromeOS. | 31 // Autocomplete test is flaky on ChromeOS. |
31 // http://crbug.com/52928 | 32 // http://crbug.com/52928 |
32 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
33 #define MAYBE_Autocomplete FLAKY_Autocomplete | 34 #define MAYBE_Autocomplete FLAKY_Autocomplete |
34 #else | 35 #else |
35 #define MAYBE_Autocomplete Autocomplete | 36 #define MAYBE_Autocomplete Autocomplete |
36 #endif | 37 #endif |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 144 |
144 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, TabAwayRevertSelect) { | 145 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, TabAwayRevertSelect) { |
145 // http://code.google.com/p/chromium/issues/detail?id=38385 | 146 // http://code.google.com/p/chromium/issues/detail?id=38385 |
146 // Make sure that tabbing away from an empty omnibar causes a revert | 147 // Make sure that tabbing away from an empty omnibar causes a revert |
147 // and select all. | 148 // and select all. |
148 LocationBar* location_bar = GetLocationBar(); | 149 LocationBar* location_bar = GetLocationBar(); |
149 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), | 150 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), |
150 location_bar->location_entry()->GetText()); | 151 location_bar->location_entry()->GetText()); |
151 location_bar->location_entry()->SetUserText(string16()); | 152 location_bar->location_entry()->SetUserText(string16()); |
152 ui_test_utils::WindowedNotificationObserver observer( | 153 ui_test_utils::WindowedNotificationObserver observer( |
153 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 154 content::NOTIFICATION_LOAD_STOP, |
| 155 content::NotificationService::AllSources()); |
154 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), | 156 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), |
155 content::PAGE_TRANSITION_START_PAGE); | 157 content::PAGE_TRANSITION_START_PAGE); |
156 observer.Wait(); | 158 observer.Wait(); |
157 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), | 159 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), |
158 location_bar->location_entry()->GetText()); | 160 location_bar->location_entry()->GetText()); |
159 browser()->CloseTab(); | 161 browser()->CloseTab(); |
160 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), | 162 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), |
161 location_bar->location_entry()->GetText()); | 163 location_bar->location_entry()->GetText()); |
162 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); | 164 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); |
163 } | 165 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 const AutocompleteResult& result = autocomplete_controller->result(); | 314 const AutocompleteResult& result = autocomplete_controller->result(); |
313 // 'App test' is also a substring of extension 'Packaged App Test'. | 315 // 'App test' is also a substring of extension 'Packaged App Test'. |
314 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result); | 316 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result); |
315 AutocompleteMatch match = result.match_at(0); | 317 AutocompleteMatch match = result.match_at(0); |
316 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents); | 318 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents); |
317 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type); | 319 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type); |
318 EXPECT_FALSE(match.deletable); | 320 EXPECT_FALSE(match.deletable); |
319 location_bar->AcceptInput(); | 321 location_bar->AcceptInput(); |
320 } | 322 } |
321 } | 323 } |
OLD | NEW |