OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/search_engines/template_url_service_factory.h" | |
9 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
11 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
12 #include "chrome/browser/ui/omnibox/location_bar.h" | 11 #include "chrome/browser/ui/omnibox/location_bar.h" |
13 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 12 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
14 #include "chrome/browser/ui/view_ids.h" | 13 #include "chrome/browser/ui/view_ids.h" |
15 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
16 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 15 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
17 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
18 #include "chrome/test/base/interactive_test_utils.h" | 17 #include "chrome/test/base/interactive_test_utils.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 ACMatches matches; | 263 ACMatches matches; |
265 AutocompleteMatch match; | 264 AutocompleteMatch match; |
266 match.destination_url = GURL("http://autocomplete-result/"); | 265 match.destination_url = GURL("http://autocomplete-result/"); |
267 match.allowed_to_be_default_match = true; | 266 match.allowed_to_be_default_match = true; |
268 match.type = AutocompleteMatchType::HISTORY_TITLE; | 267 match.type = AutocompleteMatchType::HISTORY_TITLE; |
269 match.relevance = 500; | 268 match.relevance = 500; |
270 matches.push_back(match); | 269 matches.push_back(match); |
271 match.destination_url = GURL("http://autocomplete-result2/"); | 270 match.destination_url = GURL("http://autocomplete-result2/"); |
272 matches.push_back(match); | 271 matches.push_back(match); |
273 results.AppendMatches(matches); | 272 results.AppendMatches(matches); |
274 results.SortAndCull( | 273 results.SortAndCull(AutocompleteInput(), browser()->profile()); |
275 AutocompleteInput(), | |
276 TemplateURLServiceFactory::GetForProfile(browser()->profile())); | |
277 | 274 |
278 // The omnibox popup should open with suggestions displayed. | 275 // The omnibox popup should open with suggestions displayed. |
279 omnibox_view->model()->popup_model()->OnResultChanged(); | 276 omnibox_view->model()->popup_model()->OnResultChanged(); |
280 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); | 277 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); |
281 | 278 |
282 // The omnibox text should be selected. | 279 // The omnibox text should be selected. |
283 EXPECT_TRUE(omnibox_view->IsSelectAll()); | 280 EXPECT_TRUE(omnibox_view->IsSelectAll()); |
284 | 281 |
285 // Simulate a mouse click before dragging the mouse. | 282 // Simulate a mouse click before dragging the mouse. |
286 gfx::Point point(omnibox_view_views->x(), omnibox_view_views->y()); | 283 gfx::Point point(omnibox_view_views->x(), omnibox_view_views->y()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // TextInputFocusManager completes. | 345 // TextInputFocusManager completes. |
349 chrome::FocusLocationBar(browser()); | 346 chrome::FocusLocationBar(browser()); |
350 OmniboxView* view = NULL; | 347 OmniboxView* view = NULL; |
351 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); | 348 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); |
352 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); | 349 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); |
353 ui::TextInputFocusManager* text_input_focus_manager = | 350 ui::TextInputFocusManager* text_input_focus_manager = |
354 ui::TextInputFocusManager::GetInstance(); | 351 ui::TextInputFocusManager::GetInstance(); |
355 EXPECT_EQ(omnibox_view_views->GetTextInputClient(), | 352 EXPECT_EQ(omnibox_view_views->GetTextInputClient(), |
356 text_input_focus_manager->GetFocusedTextInputClient()); | 353 text_input_focus_manager->GetFocusedTextInputClient()); |
357 } | 354 } |
OLD | NEW |