OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/aura/mus/window_tree_client.h" | 5 #include "ui/aura/mus/window_tree_client.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 event_id, server_id(&child), window_tree_host.display_id(), | 722 event_id, server_id(&child), window_tree_host.display_id(), |
723 ui::Event::Clone(*ui_event.get()), 0); | 723 ui::Event::Clone(*ui_event.get()), 0); |
724 EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); | 724 EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); |
725 EXPECT_EQ(ui::mojom::EventResult::HANDLED, | 725 EXPECT_EQ(ui::mojom::EventResult::HANDLED, |
726 window_tree()->GetEventResult(event_id)); | 726 window_tree()->GetEventResult(event_id)); |
727 EXPECT_TRUE(window_delegate.got_move()); | 727 EXPECT_TRUE(window_delegate.got_move()); |
728 EXPECT_FALSE(window_delegate.was_acked()); | 728 EXPECT_FALSE(window_delegate.was_acked()); |
729 EXPECT_EQ(event_location_in_child, window_delegate.last_event_location()); | 729 EXPECT_EQ(event_location_in_child, window_delegate.last_event_location()); |
730 } | 730 } |
731 | 731 |
| 732 TEST_F(WindowTreeClientClientTest, InputEventPointerEvent) { |
| 733 InputEventBasicTestWindowDelegate window_delegate(window_tree()); |
| 734 WindowTreeHostMus window_tree_host(window_tree_client_impl(), |
| 735 cc::FrameSinkId(1, 1)); |
| 736 Window* top_level = window_tree_host.window(); |
| 737 const gfx::Rect bounds(0, 0, 100, 100); |
| 738 window_tree_host.SetBoundsInPixels(bounds); |
| 739 window_tree_host.InitHost(); |
| 740 window_tree_host.Show(); |
| 741 EXPECT_EQ(bounds, top_level->bounds()); |
| 742 EXPECT_EQ(bounds, window_tree_host.GetBoundsInPixels()); |
| 743 Window child(&window_delegate); |
| 744 child.Init(ui::LAYER_NOT_DRAWN); |
| 745 top_level->AddChild(&child); |
| 746 child.SetBounds(gfx::Rect(10, 10, 100, 100)); |
| 747 child.Show(); |
| 748 EXPECT_FALSE(window_delegate.got_move()); |
| 749 const gfx::Point event_location(2, 3); |
| 750 const uint32_t event_id = 1; |
| 751 window_delegate.set_event_id(event_id); |
| 752 std::unique_ptr<ui::PointerEvent> pointer_event(new ui::PointerEvent( |
| 753 ui::ET_POINTER_MOVED, event_location, gfx::Point(), ui::EF_NONE, 0, |
| 754 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, 0), |
| 755 base::TimeTicks())); |
| 756 window_tree_client()->OnWindowInputEvent( |
| 757 event_id, server_id(&child), window_tree_host.display_id(), |
| 758 ui::Event::Clone(*pointer_event.get()), 0); |
| 759 EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); |
| 760 EXPECT_EQ(ui::mojom::EventResult::HANDLED, |
| 761 window_tree()->GetEventResult(event_id)); |
| 762 EXPECT_TRUE(window_delegate.got_move()); |
| 763 EXPECT_EQ(event_location, window_delegate.last_event_location()); |
| 764 } |
| 765 |
732 TEST_F(WindowTreeClientClientTest, InputEventFindTargetAndConversion) { | 766 TEST_F(WindowTreeClientClientTest, InputEventFindTargetAndConversion) { |
733 WindowTreeHostMus window_tree_host(window_tree_client_impl(), | 767 WindowTreeHostMus window_tree_host(window_tree_client_impl(), |
734 cc::FrameSinkId(1, 1)); | 768 cc::FrameSinkId(1, 1)); |
735 Window* top_level = window_tree_host.window(); | 769 Window* top_level = window_tree_host.window(); |
736 const gfx::Rect bounds(0, 0, 100, 100); | 770 const gfx::Rect bounds(0, 0, 100, 100); |
737 window_tree_host.SetBoundsInPixels(bounds); | 771 window_tree_host.SetBoundsInPixels(bounds); |
738 window_tree_host.InitHost(); | 772 window_tree_host.InitHost(); |
739 window_tree_host.Show(); | 773 window_tree_host.Show(); |
740 EXPECT_EQ(bounds, top_level->bounds()); | 774 EXPECT_EQ(bounds, top_level->bounds()); |
741 EXPECT_EQ(bounds, window_tree_host.GetBoundsInPixels()); | 775 EXPECT_EQ(bounds, window_tree_host.GetBoundsInPixels()); |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 window_tree()->GetEventResult(event_id)); | 2191 window_tree()->GetEventResult(event_id)); |
2158 EXPECT_TRUE(window_delegate1.got_move()); | 2192 EXPECT_TRUE(window_delegate1.got_move()); |
2159 EXPECT_FALSE(window_delegate2.got_move()); | 2193 EXPECT_FALSE(window_delegate2.got_move()); |
2160 gfx::Point transformed_event_location_in_dip(event_location_in_dip.x() + 20, | 2194 gfx::Point transformed_event_location_in_dip(event_location_in_dip.x() + 20, |
2161 event_location_in_dip.y() + 30); | 2195 event_location_in_dip.y() + 30); |
2162 EXPECT_EQ(transformed_event_location_in_dip, | 2196 EXPECT_EQ(transformed_event_location_in_dip, |
2163 window_delegate1.last_event_location()); | 2197 window_delegate1.last_event_location()); |
2164 } | 2198 } |
2165 | 2199 |
2166 } // namespace aura | 2200 } // namespace aura |
OLD | NEW |