| 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/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete.h" | 8 #include "chrome/browser/autocomplete/autocomplete.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 10 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 { | 108 { |
| 109 autocomplete_controller->Start( | 109 autocomplete_controller->Start( |
| 110 ASCIIToUTF16("chrome"), string16(), true, false, true, | 110 ASCIIToUTF16("chrome"), string16(), true, false, true, |
| 111 AutocompleteInput::SYNCHRONOUS_MATCHES); | 111 AutocompleteInput::SYNCHRONOUS_MATCHES); |
| 112 | 112 |
| 113 EXPECT_TRUE(autocomplete_controller->done()); | 113 EXPECT_TRUE(autocomplete_controller->done()); |
| 114 EXPECT_TRUE(location_bar->GetInputString().empty()); | 114 EXPECT_TRUE(location_bar->GetInputString().empty()); |
| 115 EXPECT_TRUE(location_bar->location_entry()->GetText().empty()); | 115 EXPECT_TRUE(location_bar->location_entry()->GetText().empty()); |
| 116 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); | 116 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); |
| 117 const AutocompleteResult& result = autocomplete_controller->result(); | 117 const AutocompleteResult& result = autocomplete_controller->result(); |
| 118 ASSERT_EQ(1U, result.size()) << AutocompleteResultAsString(result); | 118 // We get two matches because we have a provider for extension apps and the |
| 119 // Chrome Web Store is a built-in Extension app. For this test, we only care |
| 120 // about the other match existing. |
| 121 ASSERT_GE(result.size(), 1U) << AutocompleteResultAsString(result); |
| 119 AutocompleteMatch match = result.match_at(0); | 122 AutocompleteMatch match = result.match_at(0); |
| 120 EXPECT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, match.type); | 123 EXPECT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, match.type); |
| 121 EXPECT_FALSE(match.deletable); | 124 EXPECT_FALSE(match.deletable); |
| 122 } | 125 } |
| 123 | 126 |
| 124 { | 127 { |
| 125 location_bar->Revert(); | 128 location_bar->Revert(); |
| 126 | 129 |
| 127 EXPECT_TRUE(location_bar->GetInputString().empty()); | 130 EXPECT_TRUE(location_bar->GetInputString().empty()); |
| 128 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), | 131 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 EXPECT_EQ(ASCIIToUTF16(" ?foo"), | 241 EXPECT_EQ(ASCIIToUTF16(" ?foo"), |
| 239 location_bar->location_entry()->GetText()); | 242 location_bar->location_entry()->GetText()); |
| 240 | 243 |
| 241 size_t selection_start, selection_end; | 244 size_t selection_start, selection_end; |
| 242 location_bar->location_entry()->GetSelectionBounds(&selection_start, | 245 location_bar->location_entry()->GetSelectionBounds(&selection_start, |
| 243 &selection_end); | 246 &selection_end); |
| 244 EXPECT_EQ(4U, std::min(selection_start, selection_end)); | 247 EXPECT_EQ(4U, std::min(selection_start, selection_end)); |
| 245 EXPECT_EQ(7U, std::max(selection_start, selection_end)); | 248 EXPECT_EQ(7U, std::max(selection_start, selection_end)); |
| 246 } | 249 } |
| 247 } | 250 } |
| OLD | NEW |