Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc

Issue 1260453006: ui: events: Add a class to hold common touch and stylus properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address build problems, add accessor and unit tests. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/search_engines/template_url_service_factory.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 // The omnibox popup should open with suggestions displayed. 321 // The omnibox popup should open with suggestions displayed.
322 omnibox_view->model()->popup_model()->OnResultChanged(); 322 omnibox_view->model()->popup_model()->OnResultChanged();
323 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); 323 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen());
324 324
325 // The omnibox text should be selected. 325 // The omnibox text should be selected.
326 EXPECT_TRUE(omnibox_view->IsSelectAll()); 326 EXPECT_TRUE(omnibox_view->IsSelectAll());
327 327
328 // Simulate a mouse click before dragging the mouse. 328 // Simulate a mouse click before dragging the mouse.
329 gfx::Point point(omnibox_view_views->x(), omnibox_view_views->y()); 329 gfx::Point point(omnibox_view_views->x(), omnibox_view_views->y());
330 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, point, point, 330 ui::MouseEvent pressed(
331 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 331 ui::ET_MOUSE_PRESSED, point, point, ui::EventTimeForNow(),
332 ui::EF_LEFT_MOUSE_BUTTON); 332 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
333 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
333 omnibox_view_views->OnMousePressed(pressed); 334 omnibox_view_views->OnMousePressed(pressed);
334 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); 335 EXPECT_TRUE(omnibox_view->model()->popup_model()->IsOpen());
335 336
336 // Simulate a mouse drag of the omnibox text, and the omnibox should close. 337 // Simulate a mouse drag of the omnibox text, and the omnibox should close.
337 ui::MouseEvent dragged(ui::ET_MOUSE_DRAGGED, point, point, 338 ui::MouseEvent dragged(
338 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0); 339 ui::ET_MOUSE_DRAGGED, point, point, ui::EventTimeForNow(),
340 ui::EF_LEFT_MOUSE_BUTTON, 0,
341 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
339 omnibox_view_views->OnMouseDragged(dragged); 342 omnibox_view_views->OnMouseDragged(dragged);
340 343
341 EXPECT_FALSE(omnibox_view->model()->popup_model()->IsOpen()); 344 EXPECT_FALSE(omnibox_view->model()->popup_model()->IsOpen());
342 } 345 }
343 346
344 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, BackgroundIsOpaque) { 347 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, BackgroundIsOpaque) {
345 // The omnibox text should be rendered on an opaque background. Otherwise, we 348 // The omnibox text should be rendered on an opaque background. Otherwise, we
346 // can't use subpixel rendering. 349 // can't use subpixel rendering.
347 OmniboxViewViews* view = BrowserView::GetBrowserViewForBrowser(browser())-> 350 OmniboxViewViews* view = BrowserView::GetBrowserViewForBrowser(browser())->
348 toolbar()->location_bar()->omnibox_view(); 351 toolbar()->location_bar()->omnibox_view();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, FocusedTextInputClient) { 383 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, FocusedTextInputClient) {
381 chrome::FocusLocationBar(browser()); 384 chrome::FocusLocationBar(browser());
382 OmniboxView* view = NULL; 385 OmniboxView* view = NULL;
383 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); 386 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view));
384 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); 387 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view);
385 ui::InputMethod* input_method = 388 ui::InputMethod* input_method =
386 omnibox_view_views->GetWidget()->GetInputMethod(); 389 omnibox_view_views->GetWidget()->GetInputMethod();
387 EXPECT_EQ(static_cast<ui::TextInputClient*>(omnibox_view_views), 390 EXPECT_EQ(static_cast<ui::TextInputClient*>(omnibox_view_views),
388 input_method->GetTextInputClient()); 391 input_method->GetTextInputClient());
389 } 392 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698