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

Side by Side Diff: ui/views/mus/native_widget_mus_unittest.cc

Issue 1939133002: StructTraits to map mus::mojom::Event to unique_ptr<ui::Event> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback. Created 4 years, 6 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
« no previous file with comments | « ui/events/mojo/typemaps.gni ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/views/mus/native_widget_mus.h" 5 #include "ui/views/mus/native_widget_mus.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "components/mus/public/cpp/property_type_converters.h" 9 #include "components/mus/public/cpp/property_type_converters.h"
10 #include "components/mus/public/cpp/tests/window_tree_client_private.h" 10 #include "components/mus/public/cpp/tests/window_tree_client_private.h"
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 content->SetBounds(10, 20, 90, 180); 410 content->SetBounds(10, 20, 90, 180);
411 widget->GetContentsView()->AddChildView(content); 411 widget->GetContentsView()->AddChildView(content);
412 412
413 ui::test::TestEventHandler handler; 413 ui::test::TestEventHandler handler;
414 content->AddPreTargetHandler(&handler); 414 content->AddPreTargetHandler(&handler);
415 415
416 std::unique_ptr<ui::MouseEvent> mouse = CreateMouseEvent(); 416 std::unique_ptr<ui::MouseEvent> mouse = CreateMouseEvent();
417 NativeWidgetMus* native_widget = 417 NativeWidgetMus* native_widget =
418 static_cast<NativeWidgetMus*>(widget->native_widget_private()); 418 static_cast<NativeWidgetMus*>(widget->native_widget_private());
419 mus::WindowTreeClientPrivate test_api(native_widget->window()); 419 mus::WindowTreeClientPrivate test_api(native_widget->window());
420 test_api.CallOnWindowInputEvent(native_widget->window(), *mouse); 420 test_api.CallOnWindowInputEvent(native_widget->window(), std::move(mouse));
421 EXPECT_EQ(1, handler.num_mouse_events()); 421 EXPECT_EQ(1, handler.num_mouse_events());
422 } 422 }
423 423
424 // Tests that an incoming UI event is acked with the handled status. 424 // Tests that an incoming UI event is acked with the handled status.
425 TEST_F(NativeWidgetMusTest, EventAcked) { 425 TEST_F(NativeWidgetMusTest, EventAcked) {
426 std::unique_ptr<Widget> widget(CreateWidget(nullptr)); 426 std::unique_ptr<Widget> widget(CreateWidget(nullptr));
427 widget->Show(); 427 widget->Show();
428 428
429 View* content = new HandleMousePressView; 429 View* content = new HandleMousePressView;
430 content->SetBounds(10, 20, 90, 180); 430 content->SetBounds(10, 20, 90, 180);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 mus_window->SetBounds(end_bounds); 515 mus_window->SetBounds(end_bounds);
516 516
517 EXPECT_EQ(end_bounds, mus_window->bounds()); 517 EXPECT_EQ(end_bounds, mus_window->bounds());
518 518
519 // Main check for this test: Setting |mus_window| bounds while bypassing 519 // Main check for this test: Setting |mus_window| bounds while bypassing
520 // |native_widget| must update window_tree_host bounds. 520 // |native_widget| must update window_tree_host bounds.
521 EXPECT_EQ(end_bounds, native_widget->window_tree_host()->GetBounds()); 521 EXPECT_EQ(end_bounds, native_widget->window_tree_host()->GetBounds());
522 } 522 }
523 523
524 } // namespace views 524 } // namespace views
OLDNEW
« no previous file with comments | « ui/events/mojo/typemaps.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698