| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 // The omnibox popup should open with suggestions displayed. | 330 // The omnibox popup should open with suggestions displayed. |
| 331 omnibox_view->model()->popup_model()->OnResultChanged(); | 331 omnibox_view->model()->popup_model()->OnResultChanged(); |
| 332 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); | 332 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); |
| 333 | 333 |
| 334 // The omnibox text should be selected. | 334 // The omnibox text should be selected. |
| 335 EXPECT_TRUE(omnibox_view->IsSelectAll()); | 335 EXPECT_TRUE(omnibox_view->IsSelectAll()); |
| 336 | 336 |
| 337 // Simulate a mouse click before dragging the mouse. | 337 // Simulate a mouse click before dragging the mouse. |
| 338 gfx::Point point(omnibox_view_views->x(), omnibox_view_views->y()); | 338 gfx::Point point(omnibox_view_views->x(), omnibox_view_views->y()); |
| 339 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, point, point, | 339 ui::MouseEvent pressed( |
| 340 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, | 340 ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(), |
| 341 ui::EF_LEFT_MOUSE_BUTTON); | 341 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON, |
| 342 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 342 omnibox_view_views->OnMousePressed(pressed); | 343 omnibox_view_views->OnMousePressed(pressed); |
| 343 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); | 344 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); |
| 344 | 345 |
| 345 // Simulate a mouse drag of the omnibox text, and the omnibox should close. | 346 // Simulate a mouse drag of the omnibox text, and the omnibox should close. |
| 346 ui::MouseEvent dragged(ui::ET_MOUSE_DRAGGED, point, point, | 347 ui::MouseEvent dragged( |
| 347 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0); | 348 ui::ET_MOUSE_DRAGGED, point, point, ui::EventTimeForNow(), |
| 349 ui::EF_LEFT_MOUSE_BUTTON, 0, |
| 350 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 348 omnibox_view_views->OnMouseDragged(dragged); | 351 omnibox_view_views->OnMouseDragged(dragged); |
| 349 | 352 |
| 350 EXPECT_FALSE(omnibox_view->model()->popup_model()->IsOpen()); | 353 EXPECT_FALSE(omnibox_view->model()->popup_model()->IsOpen()); |
| 351 } | 354 } |
| 352 | 355 |
| 353 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, BackgroundIsOpaque) { | 356 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, BackgroundIsOpaque) { |
| 354 // The omnibox text should be rendered on an opaque background. Otherwise, we | 357 // The omnibox text should be rendered on an opaque background. Otherwise, we |
| 355 // can't use subpixel rendering. | 358 // can't use subpixel rendering. |
| 356 OmniboxViewViews* view = BrowserView::GetBrowserViewForBrowser(browser())-> | 359 OmniboxViewViews* view = BrowserView::GetBrowserViewForBrowser(browser())-> |
| 357 toolbar()->location_bar()->omnibox_view(); | 360 toolbar()->location_bar()->omnibox_view(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 386 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, FocusedTextInputClient) { | 389 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, FocusedTextInputClient) { |
| 387 chrome::FocusLocationBar(browser()); | 390 chrome::FocusLocationBar(browser()); |
| 388 OmniboxView* view = NULL; | 391 OmniboxView* view = NULL; |
| 389 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); | 392 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); |
| 390 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); | 393 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); |
| 391 ui::InputMethod* input_method = | 394 ui::InputMethod* input_method = |
| 392 omnibox_view_views->GetWidget()->GetInputMethod(); | 395 omnibox_view_views->GetWidget()->GetInputMethod(); |
| 393 EXPECT_EQ(static_cast<ui::TextInputClient*>(omnibox_view_views), | 396 EXPECT_EQ(static_cast<ui::TextInputClient*>(omnibox_view_views), |
| 394 input_method->GetTextInputClient()); | 397 input_method->GetTextInputClient()); |
| 395 } | 398 } |
| OLD | NEW |