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/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/autocomplete/autocomplete_input.h" | 9 #include "chrome/browser/autocomplete/autocomplete_input.h" |
10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 EXPECT_EQ(UTF8ToUTF16(content::kAboutBlankURL), location_entry->GetText()); | 148 EXPECT_EQ(UTF8ToUTF16(content::kAboutBlankURL), location_entry->GetText()); |
149 EXPECT_FALSE(location_entry->IsSelectAll()); | 149 EXPECT_FALSE(location_entry->IsSelectAll()); |
150 const AutocompleteResult& result = autocomplete_controller->result(); | 150 const AutocompleteResult& result = autocomplete_controller->result(); |
151 EXPECT_TRUE(result.empty()) << AutocompleteResultAsString(result); | 151 EXPECT_TRUE(result.empty()) << AutocompleteResultAsString(result); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, TabAwayRevertSelect) { | 155 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, TabAwayRevertSelect) { |
156 WaitForTemplateURLServiceToLoad(); | 156 WaitForTemplateURLServiceToLoad(); |
157 // http://code.google.com/p/chromium/issues/detail?id=38385 | 157 // http://code.google.com/p/chromium/issues/detail?id=38385 |
158 // Make sure that tabbing away from an empty omnibar causes a revert | 158 // Make sure that tabbing away from an empty omnibox causes a revert |
159 // and select all. | 159 // and select all. |
160 LocationBar* location_bar = GetLocationBar(); | 160 LocationBar* location_bar = GetLocationBar(); |
161 OmniboxView* location_entry = location_bar->GetLocationEntry(); | 161 OmniboxView* location_entry = location_bar->GetLocationEntry(); |
162 EXPECT_EQ(UTF8ToUTF16(content::kAboutBlankURL), location_entry->GetText()); | 162 EXPECT_EQ(UTF8ToUTF16(content::kAboutBlankURL), location_entry->GetText()); |
163 location_entry->SetUserText(string16()); | 163 location_entry->SetUserText(string16()); |
164 content::WindowedNotificationObserver observer( | 164 content::WindowedNotificationObserver observer( |
165 content::NOTIFICATION_LOAD_STOP, | 165 content::NOTIFICATION_LOAD_STOP, |
166 content::NotificationService::AllSources()); | 166 content::NotificationService::AllSources()); |
167 chrome::AddSelectedTabWithURL(browser(), GURL(content::kAboutBlankURL), | 167 chrome::AddSelectedTabWithURL(browser(), GURL(content::kAboutBlankURL), |
168 content::PAGE_TRANSITION_AUTO_TOPLEVEL); | 168 content::PAGE_TRANSITION_AUTO_TOPLEVEL); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 location_bar->FocusSearch(); | 252 location_bar->FocusSearch(); |
253 EXPECT_TRUE(location_bar->GetInputString().empty()); | 253 EXPECT_TRUE(location_bar->GetInputString().empty()); |
254 EXPECT_EQ(ASCIIToUTF16(" ?foo"), location_entry->GetText()); | 254 EXPECT_EQ(ASCIIToUTF16(" ?foo"), location_entry->GetText()); |
255 | 255 |
256 size_t selection_start, selection_end; | 256 size_t selection_start, selection_end; |
257 location_entry->GetSelectionBounds(&selection_start, &selection_end); | 257 location_entry->GetSelectionBounds(&selection_start, &selection_end); |
258 EXPECT_EQ(4U, std::min(selection_start, selection_end)); | 258 EXPECT_EQ(4U, std::min(selection_start, selection_end)); |
259 EXPECT_EQ(7U, std::max(selection_start, selection_end)); | 259 EXPECT_EQ(7U, std::max(selection_start, selection_end)); |
260 } | 260 } |
261 } | 261 } |
OLD | NEW |