OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string_util.h" | 5 #include "base/string_util.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/autocomplete/autocomplete.h" | 7 #include "chrome/browser/autocomplete/autocomplete.h" |
8 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 8 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, TabAwayRevertSelect) { | 135 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, TabAwayRevertSelect) { |
136 // http://code.google.com/p/chromium/issues/detail?id=38385 | 136 // http://code.google.com/p/chromium/issues/detail?id=38385 |
137 // Make sure that tabbing away from an empty omnibar causes a revert | 137 // Make sure that tabbing away from an empty omnibar causes a revert |
138 // and select all. | 138 // and select all. |
139 LocationBar* location_bar = GetLocationBar(); | 139 LocationBar* location_bar = GetLocationBar(); |
140 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), | 140 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), |
141 location_bar->location_entry()->GetText()); | 141 location_bar->location_entry()->GetText()); |
142 location_bar->location_entry()->SetUserText(L""); | 142 location_bar->location_entry()->SetUserText(L""); |
143 Browser::AddTabWithURLParams params(GURL(chrome::kAboutBlankURL), | 143 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), |
144 PageTransition::START_PAGE); | 144 PageTransition::START_PAGE); |
145 browser()->AddTabWithURL(¶ms); | |
146 EXPECT_EQ(browser(), params.target); | |
147 ui_test_utils::WaitForNavigation( | 145 ui_test_utils::WaitForNavigation( |
148 &browser()->GetSelectedTabContents()->controller()); | 146 &browser()->GetSelectedTabContents()->controller()); |
149 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), | 147 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), |
150 location_bar->location_entry()->GetText()); | 148 location_bar->location_entry()->GetText()); |
151 browser()->CloseTab(); | 149 browser()->CloseTab(); |
152 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), | 150 EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL), |
153 location_bar->location_entry()->GetText()); | 151 location_bar->location_entry()->GetText()); |
154 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); | 152 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); |
155 } | 153 } |
156 | 154 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 EXPECT_EQ(std::wstring(), location_bar->GetInputString()); | 235 EXPECT_EQ(std::wstring(), location_bar->GetInputString()); |
238 EXPECT_EQ(L" ?foo", location_bar->location_entry()->GetText()); | 236 EXPECT_EQ(L" ?foo", location_bar->location_entry()->GetText()); |
239 | 237 |
240 size_t selection_start, selection_end; | 238 size_t selection_start, selection_end; |
241 location_bar->location_entry()->GetSelectionBounds(&selection_start, | 239 location_bar->location_entry()->GetSelectionBounds(&selection_start, |
242 &selection_end); | 240 &selection_end); |
243 EXPECT_EQ(4U, std::min(selection_start, selection_end)); | 241 EXPECT_EQ(4U, std::min(selection_start, selection_end)); |
244 EXPECT_EQ(7U, std::max(selection_start, selection_end)); | 242 EXPECT_EQ(7U, std::max(selection_start, selection_end)); |
245 } | 243 } |
246 } | 244 } |
OLD | NEW |