| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/format_macros.h" | 6 #include "base/format_macros.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_input.h" | 10 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 Profile::EXPLICIT_ACCESS)); | 131 Profile::EXPLICIT_ACCESS)); |
| 132 | 132 |
| 133 LocationBar* location_bar = GetLocationBar(); | 133 LocationBar* location_bar = GetLocationBar(); |
| 134 OmniboxView* omnibox_view = location_bar->GetOmniboxView(); | 134 OmniboxView* omnibox_view = location_bar->GetOmniboxView(); |
| 135 AutocompleteController* autocomplete_controller = GetAutocompleteController(); | 135 AutocompleteController* autocomplete_controller = GetAutocompleteController(); |
| 136 | 136 |
| 137 { | 137 { |
| 138 omnibox_view->model()->SetInputInProgress(true); | 138 omnibox_view->model()->SetInputInProgress(true); |
| 139 autocomplete_controller->Start(AutocompleteInput( | 139 autocomplete_controller->Start(AutocompleteInput( |
| 140 base::ASCIIToUTF16("chrome"), base::string16::npos, base::string16(), | 140 base::ASCIIToUTF16("chrome"), base::string16::npos, base::string16(), |
| 141 GURL(), AutocompleteInput::NTP, true, false, true, false)); | 141 GURL(), metrics::OmniboxEventProto::NTP, true, false, true, false)); |
| 142 | 142 |
| 143 EXPECT_TRUE(autocomplete_controller->done()); | 143 EXPECT_TRUE(autocomplete_controller->done()); |
| 144 EXPECT_FALSE(location_bar->GetDestinationURL().is_valid()); | 144 EXPECT_FALSE(location_bar->GetDestinationURL().is_valid()); |
| 145 EXPECT_TRUE(omnibox_view->GetText().empty()); | 145 EXPECT_TRUE(omnibox_view->GetText().empty()); |
| 146 EXPECT_TRUE(omnibox_view->IsSelectAll()); | 146 EXPECT_TRUE(omnibox_view->IsSelectAll()); |
| 147 const AutocompleteResult& result = autocomplete_controller->result(); | 147 const AutocompleteResult& result = autocomplete_controller->result(); |
| 148 // We get two matches because we have a provider for extension apps and the | 148 // We get two matches because we have a provider for extension apps and the |
| 149 // Chrome Web Store is a built-in Extension app. For this test, we only care | 149 // Chrome Web Store is a built-in Extension app. For this test, we only care |
| 150 // about the other match existing. | 150 // about the other match existing. |
| 151 ASSERT_GE(result.size(), 1U) << AutocompleteResultAsString(result); | 151 ASSERT_GE(result.size(), 1U) << AutocompleteResultAsString(result); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 location_bar->FocusSearch(); | 277 location_bar->FocusSearch(); |
| 278 EXPECT_FALSE(location_bar->GetDestinationURL().is_valid()); | 278 EXPECT_FALSE(location_bar->GetDestinationURL().is_valid()); |
| 279 EXPECT_EQ(base::ASCIIToUTF16(" ?foo"), omnibox_view->GetText()); | 279 EXPECT_EQ(base::ASCIIToUTF16(" ?foo"), omnibox_view->GetText()); |
| 280 | 280 |
| 281 size_t selection_start, selection_end; | 281 size_t selection_start, selection_end; |
| 282 omnibox_view->GetSelectionBounds(&selection_start, &selection_end); | 282 omnibox_view->GetSelectionBounds(&selection_start, &selection_end); |
| 283 EXPECT_EQ(4U, std::min(selection_start, selection_end)); | 283 EXPECT_EQ(4U, std::min(selection_start, selection_end)); |
| 284 EXPECT_EQ(7U, std::max(selection_start, selection_end)); | 284 EXPECT_EQ(7U, std::max(selection_start, selection_end)); |
| 285 } | 285 } |
| 286 } | 286 } |
| OLD | NEW |