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/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 #if defined(OS_WIN) && defined(USE_ASH) | 122 #if defined(OS_WIN) && defined(USE_ASH) |
123 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 123 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
124 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 124 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
125 switches::kAshBrowserTests)) | 125 switches::kAshBrowserTests)) |
126 return; | 126 return; |
127 #endif | 127 #endif |
128 | 128 |
129 WaitForTemplateURLServiceToLoad(); | 129 WaitForTemplateURLServiceToLoad(); |
130 // The results depend on the history backend being loaded. Make sure it is | 130 // The results depend on the history backend being loaded. Make sure it is |
131 // loaded so that the autocomplete results are consistent. | 131 // loaded so that the autocomplete results are consistent. |
132 ui_test_utils::WaitForHistoryToLoad( | 132 ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( |
133 HistoryServiceFactory::GetForProfile(browser()->profile(), | 133 browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS)); |
134 Profile::EXPLICIT_ACCESS)); | |
135 | 134 |
136 LocationBar* location_bar = GetLocationBar(); | 135 LocationBar* location_bar = GetLocationBar(); |
137 OmniboxView* omnibox_view = location_bar->GetOmniboxView(); | 136 OmniboxView* omnibox_view = location_bar->GetOmniboxView(); |
138 AutocompleteController* autocomplete_controller = GetAutocompleteController(); | 137 AutocompleteController* autocomplete_controller = GetAutocompleteController(); |
139 | 138 |
140 { | 139 { |
141 omnibox_view->model()->SetInputInProgress(true); | 140 omnibox_view->model()->SetInputInProgress(true); |
142 autocomplete_controller->Start(AutocompleteInput( | 141 autocomplete_controller->Start(AutocompleteInput( |
143 base::ASCIIToUTF16("chrome"), base::string16::npos, std::string(), | 142 base::ASCIIToUTF16("chrome"), base::string16::npos, std::string(), |
144 GURL(), metrics::OmniboxEventProto::NTP, true, false, true, false, | 143 GURL(), metrics::OmniboxEventProto::NTP, true, false, true, false, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 location_bar->FocusSearch(); | 279 location_bar->FocusSearch(); |
281 EXPECT_FALSE(location_bar->GetDestinationURL().is_valid()); | 280 EXPECT_FALSE(location_bar->GetDestinationURL().is_valid()); |
282 EXPECT_EQ(base::ASCIIToUTF16(" ?foo"), omnibox_view->GetText()); | 281 EXPECT_EQ(base::ASCIIToUTF16(" ?foo"), omnibox_view->GetText()); |
283 | 282 |
284 size_t selection_start, selection_end; | 283 size_t selection_start, selection_end; |
285 omnibox_view->GetSelectionBounds(&selection_start, &selection_end); | 284 omnibox_view->GetSelectionBounds(&selection_start, &selection_end); |
286 EXPECT_EQ(4U, std::min(selection_start, selection_end)); | 285 EXPECT_EQ(4U, std::min(selection_start, selection_end)); |
287 EXPECT_EQ(7U, std::max(selection_start, selection_end)); | 286 EXPECT_EQ(7U, std::max(selection_start, selection_end)); |
288 } | 287 } |
289 } | 288 } |
OLD | NEW |