OLD | NEW |
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_impl_private.h" | 10 #include "components/mus/public/cpp/tests/window_tree_client_private.h" |
11 #include "components/mus/public/cpp/window.h" | 11 #include "components/mus/public/cpp/window.h" |
12 #include "components/mus/public/cpp/window_property.h" | 12 #include "components/mus/public/cpp/window_property.h" |
13 #include "components/mus/public/cpp/window_tree_connection.h" | 13 #include "components/mus/public/cpp/window_tree_client.h" |
14 #include "components/mus/public/interfaces/window_manager.mojom.h" | 14 #include "components/mus/public/interfaces/window_manager.mojom.h" |
15 #include "components/mus/public/interfaces/window_tree.mojom.h" | 15 #include "components/mus/public/interfaces/window_tree.mojom.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
18 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
20 #include "ui/events/event.h" | 20 #include "ui/events/event.h" |
21 #include "ui/events/test/test_event_handler.h" | 21 #include "ui/events/test/test_event_handler.h" |
22 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
23 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 View* content = new HandleMousePressView; | 406 View* content = new HandleMousePressView; |
407 content->SetBounds(10, 20, 90, 180); | 407 content->SetBounds(10, 20, 90, 180); |
408 widget->GetContentsView()->AddChildView(content); | 408 widget->GetContentsView()->AddChildView(content); |
409 | 409 |
410 ui::test::TestEventHandler handler; | 410 ui::test::TestEventHandler handler; |
411 content->AddPreTargetHandler(&handler); | 411 content->AddPreTargetHandler(&handler); |
412 | 412 |
413 std::unique_ptr<ui::MouseEvent> mouse = CreateMouseEvent(); | 413 std::unique_ptr<ui::MouseEvent> mouse = CreateMouseEvent(); |
414 NativeWidgetMus* native_widget = | 414 NativeWidgetMus* native_widget = |
415 static_cast<NativeWidgetMus*>(widget->native_widget_private()); | 415 static_cast<NativeWidgetMus*>(widget->native_widget_private()); |
416 mus::WindowTreeClientImplPrivate test_api(native_widget->window()); | 416 mus::WindowTreeClientPrivate test_api(native_widget->window()); |
417 test_api.CallOnWindowInputEvent(native_widget->window(), *mouse); | 417 test_api.CallOnWindowInputEvent(native_widget->window(), *mouse); |
418 EXPECT_EQ(1, handler.num_mouse_events()); | 418 EXPECT_EQ(1, handler.num_mouse_events()); |
419 } | 419 } |
420 | 420 |
421 // Tests that an incoming UI event is acked with the handled status. | 421 // Tests that an incoming UI event is acked with the handled status. |
422 TEST_F(NativeWidgetMusTest, EventAcked) { | 422 TEST_F(NativeWidgetMusTest, EventAcked) { |
423 std::unique_ptr<Widget> widget(CreateWidget(nullptr)); | 423 std::unique_ptr<Widget> widget(CreateWidget(nullptr)); |
424 widget->Show(); | 424 widget->Show(); |
425 | 425 |
426 View* content = new HandleMousePressView; | 426 View* content = new HandleMousePressView; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 widget->SetCapture(content); | 485 widget->SetCapture(content); |
486 EXPECT_TRUE(widget_private->HasCapture()); | 486 EXPECT_TRUE(widget_private->HasCapture()); |
487 EXPECT_TRUE(mus_window->HasCapture()); | 487 EXPECT_TRUE(mus_window->HasCapture()); |
488 | 488 |
489 widget->ReleaseCapture(); | 489 widget->ReleaseCapture(); |
490 EXPECT_FALSE(widget_private->HasCapture()); | 490 EXPECT_FALSE(widget_private->HasCapture()); |
491 EXPECT_FALSE(mus_window->HasCapture()); | 491 EXPECT_FALSE(mus_window->HasCapture()); |
492 } | 492 } |
493 | 493 |
494 } // namespace views | 494 } // namespace views |
OLD | NEW |