Chromium Code Reviews| 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/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_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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 // loaded so that the autocomplete results are consistent. | 114 // loaded so that the autocomplete results are consistent. |
| 115 ui_test_utils::WaitForHistoryToLoad( | 115 ui_test_utils::WaitForHistoryToLoad( |
| 116 HistoryServiceFactory::GetForProfile(browser()->profile(), | 116 HistoryServiceFactory::GetForProfile(browser()->profile(), |
| 117 Profile::EXPLICIT_ACCESS)); | 117 Profile::EXPLICIT_ACCESS)); |
| 118 | 118 |
| 119 LocationBar* location_bar = GetLocationBar(); | 119 LocationBar* location_bar = GetLocationBar(); |
| 120 AutocompleteController* autocomplete_controller = GetAutocompleteController(); | 120 AutocompleteController* autocomplete_controller = GetAutocompleteController(); |
| 121 | 121 |
| 122 { | 122 { |
| 123 autocomplete_controller->Start( | 123 autocomplete_controller->Start( |
| 124 ASCIIToUTF16("chrome"), string16(), true, false, true, | 124 AutocompleteInput(ASCIIToUTF16("chrome"), string16::npos, string16(), |
|
Peter Kasting
2012/12/05 20:49:38
Nit: You can save a line by leaving the wrapping l
Bart N.
2012/12/06 21:43:32
Done.
| |
| 125 AutocompleteInput::SYNCHRONOUS_MATCHES); | 125 true, false, true, |
| 126 AutocompleteInput::SYNCHRONOUS_MATCHES)); | |
| 126 | 127 |
| 127 OmniboxView* location_entry = location_bar->GetLocationEntry(); | 128 OmniboxView* location_entry = location_bar->GetLocationEntry(); |
| 128 | 129 |
| 129 EXPECT_TRUE(autocomplete_controller->done()); | 130 EXPECT_TRUE(autocomplete_controller->done()); |
| 130 EXPECT_TRUE(location_bar->GetInputString().empty()); | 131 EXPECT_TRUE(location_bar->GetInputString().empty()); |
| 131 EXPECT_TRUE(location_entry->GetText().empty()); | 132 EXPECT_TRUE(location_entry->GetText().empty()); |
| 132 EXPECT_TRUE(location_entry->IsSelectAll()); | 133 EXPECT_TRUE(location_entry->IsSelectAll()); |
| 133 const AutocompleteResult& result = autocomplete_controller->result(); | 134 const AutocompleteResult& result = autocomplete_controller->result(); |
| 134 // We get two matches because we have a provider for extension apps and the | 135 // We get two matches because we have a provider for extension apps and the |
| 135 // Chrome Web Store is a built-in Extension app. For this test, we only care | 136 // Chrome Web Store is a built-in Extension app. For this test, we only care |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 location_bar->FocusSearch(); | 253 location_bar->FocusSearch(); |
| 253 EXPECT_TRUE(location_bar->GetInputString().empty()); | 254 EXPECT_TRUE(location_bar->GetInputString().empty()); |
| 254 EXPECT_EQ(ASCIIToUTF16(" ?foo"), location_entry->GetText()); | 255 EXPECT_EQ(ASCIIToUTF16(" ?foo"), location_entry->GetText()); |
| 255 | 256 |
| 256 size_t selection_start, selection_end; | 257 size_t selection_start, selection_end; |
| 257 location_entry->GetSelectionBounds(&selection_start, &selection_end); | 258 location_entry->GetSelectionBounds(&selection_start, &selection_end); |
| 258 EXPECT_EQ(4U, std::min(selection_start, selection_end)); | 259 EXPECT_EQ(4U, std::min(selection_start, selection_end)); |
| 259 EXPECT_EQ(7U, std::max(selection_start, selection_end)); | 260 EXPECT_EQ(7U, std::max(selection_start, selection_end)); |
| 260 } | 261 } |
| 261 } | 262 } |
| OLD | NEW |