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