Chromium Code Reviews| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 | 107 |
| 108 { | 108 { |
| 109 autocomplete_controller->Start(ASCIIToUTF16("chrome"), string16(), | 109 autocomplete_controller->Start(ASCIIToUTF16("chrome"), string16(), |
| 110 true, false, true, true); | 110 true, false, true, true); |
| 111 | 111 |
| 112 EXPECT_TRUE(autocomplete_controller->done()); | 112 EXPECT_TRUE(autocomplete_controller->done()); |
| 113 EXPECT_TRUE(location_bar->GetInputString().empty()); | 113 EXPECT_TRUE(location_bar->GetInputString().empty()); |
| 114 EXPECT_TRUE(location_bar->location_entry()->GetText().empty()); | 114 EXPECT_TRUE(location_bar->location_entry()->GetText().empty()); |
| 115 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); | 115 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); |
| 116 const AutocompleteResult& result = autocomplete_controller->result(); | 116 const AutocompleteResult& result = autocomplete_controller->result(); |
| 117 ASSERT_EQ(1U, result.size()) << AutocompleteResultAsString(result); | 117 // We get two matches because we have a provider for extension apps and the |
| 118 // Chrome Web Store is a built-in Extension app. For this test, we only care | |
| 119 // about the other match. | |
| 120 ASSERT_EQ(2U, result.size()) << AutocompleteResultAsString(result); | |
|
Peter Kasting
2011/04/04 19:35:32
Nit: Maybe ASSERT_GE(result.size(), 1U)?
Finnur
2011/04/05 15:50:24
Done.
| |
| 118 AutocompleteMatch match = result.match_at(0); | 121 AutocompleteMatch match = result.match_at(0); |
| 119 EXPECT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, match.type); | 122 EXPECT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, match.type); |
| 120 EXPECT_FALSE(match.deletable); | 123 EXPECT_FALSE(match.deletable); |
| 121 } | 124 } |
| 122 | 125 |
| 123 { | 126 { |
| 124 location_bar->Revert(); | 127 location_bar->Revert(); |
| 125 | 128 |
| 126 EXPECT_TRUE(location_bar->GetInputString().empty()); | 129 EXPECT_TRUE(location_bar->GetInputString().empty()); |
| 127 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), | 130 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 EXPECT_EQ(ASCIIToUTF16(" ?foo"), | 240 EXPECT_EQ(ASCIIToUTF16(" ?foo"), |
| 238 location_bar->location_entry()->GetText()); | 241 location_bar->location_entry()->GetText()); |
| 239 | 242 |
| 240 size_t selection_start, selection_end; | 243 size_t selection_start, selection_end; |
| 241 location_bar->location_entry()->GetSelectionBounds(&selection_start, | 244 location_bar->location_entry()->GetSelectionBounds(&selection_start, |
| 242 &selection_end); | 245 &selection_end); |
| 243 EXPECT_EQ(4U, std::min(selection_start, selection_end)); | 246 EXPECT_EQ(4U, std::min(selection_start, selection_end)); |
| 244 EXPECT_EQ(7U, std::max(selection_start, selection_end)); | 247 EXPECT_EQ(7U, std::max(selection_start, selection_end)); |
| 245 } | 248 } |
| 246 } | 249 } |
| OLD | NEW |