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

Side by Side Diff: services/window_manager/focus_controller_unittest.cc

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased 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) 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 "services/window_manager/focus_controller.h" 5 #include "services/window_manager/focus_controller.h"
6 6
7 #include "ui/events/event_utils.h"
7 #include "mojo/converters/geometry/geometry_type_converters.h" 8 #include "mojo/converters/geometry/geometry_type_converters.h"
8 #include "services/window_manager/basic_focus_rules.h" 9 #include "services/window_manager/basic_focus_rules.h"
9 #include "services/window_manager/capture_controller.h" 10 #include "services/window_manager/capture_controller.h"
10 #include "services/window_manager/focus_controller_observer.h" 11 #include "services/window_manager/focus_controller_observer.h"
11 #include "services/window_manager/view_event_dispatcher.h" 12 #include "services/window_manager/view_event_dispatcher.h"
12 #include "services/window_manager/view_targeter.h" 13 #include "services/window_manager/view_targeter.h"
13 #include "services/window_manager/window_manager_test_util.h" 14 #include "services/window_manager/window_manager_test_util.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
16 17
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 View* GetViewById(int id) { return root_view_->GetChildById(id); } 407 View* GetViewById(int id) { return root_view_->GetChildById(id); }
407 408
408 void ClickLeftButton(View* view) { 409 void ClickLeftButton(View* view) {
409 // Get the center bounds of |target| in |root_view_| coordinate space. 410 // Get the center bounds of |target| in |root_view_| coordinate space.
410 gfx::Point center = 411 gfx::Point center =
411 gfx::Rect(view->bounds().To<gfx::Rect>().size()).CenterPoint(); 412 gfx::Rect(view->bounds().To<gfx::Rect>().size()).CenterPoint();
412 ViewTarget::ConvertPointToTarget(ViewTarget::TargetFromView(view), 413 ViewTarget::ConvertPointToTarget(ViewTarget::TargetFromView(view),
413 root_view_->target(), &center); 414 root_view_->target(), &center);
414 415
415 ui::MouseEvent button_down(ui::ET_MOUSE_PRESSED, center, center, 416 ui::MouseEvent button_down(ui::ET_MOUSE_PRESSED, center, center,
417 ui::EventTimeForNow(),
416 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_NONE); 418 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_NONE);
417 ui::EventDispatchDetails details = 419 ui::EventDispatchDetails details =
418 view_event_dispatcher_->OnEventFromSource(&button_down); 420 view_event_dispatcher_->OnEventFromSource(&button_down);
419 CHECK(!details.dispatcher_destroyed); 421 CHECK(!details.dispatcher_destroyed);
420 422
421 ui::MouseEvent button_up(ui::ET_MOUSE_RELEASED, center, center, 423 ui::MouseEvent button_up(ui::ET_MOUSE_RELEASED, center, center,
424 ui::EventTimeForNow(),
422 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_NONE); 425 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_NONE);
423 details = view_event_dispatcher_->OnEventFromSource(&button_up); 426 details = view_event_dispatcher_->OnEventFromSource(&button_up);
424 CHECK(!details.dispatcher_destroyed); 427 CHECK(!details.dispatcher_destroyed);
425 } 428 }
426 429
427 ViewTarget* GetRootViewTarget() { 430 ViewTarget* GetRootViewTarget() {
428 return ViewTarget::TargetFromView(root_view()); 431 return ViewTarget::TargetFromView(root_view());
429 } 432 }
430 433
431 View* root_view() { return root_view_; } 434 View* root_view() { return root_view_; }
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 1188
1186 // See description above DontPassDestroyedView() for details. 1189 // See description above DontPassDestroyedView() for details.
1187 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, DontPassDestroyedView); 1190 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, DontPassDestroyedView);
1188 1191
1189 // TODO(erg): Add the TextInputClient tests here. 1192 // TODO(erg): Add the TextInputClient tests here.
1190 1193
1191 // If a mouse event was handled, it should not activate a view. 1194 // If a mouse event was handled, it should not activate a view.
1192 FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent); 1195 FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent);
1193 1196
1194 } // namespace window_manager 1197 } // namespace window_manager
OLDNEW
« no previous file with comments | « mojo/converters/input_events/input_events_type_converters.cc ('k') | services/window_manager/view_target.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698