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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 event_id, server_id(&child), window_tree_host.display_id(), | 757 event_id, server_id(&child), window_tree_host.display_id(), |
758 ui::Event::Clone(*ui_event.get()), 0); | 758 ui::Event::Clone(*ui_event.get()), 0); |
759 EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); | 759 EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); |
760 EXPECT_EQ(ui::mojom::EventResult::HANDLED, | 760 EXPECT_EQ(ui::mojom::EventResult::HANDLED, |
761 window_tree()->GetEventResult(event_id)); | 761 window_tree()->GetEventResult(event_id)); |
762 EXPECT_TRUE(window_delegate.got_move()); | 762 EXPECT_TRUE(window_delegate.got_move()); |
763 EXPECT_FALSE(window_delegate.was_acked()); | 763 EXPECT_FALSE(window_delegate.was_acked()); |
764 EXPECT_EQ(event_location_in_child, window_delegate.last_event_location()); | 764 EXPECT_EQ(event_location_in_child, window_delegate.last_event_location()); |
765 } | 765 } |
766 | 766 |
| 767 TEST_F(WindowTreeClientClientTest, InputEventPointerEvent) { |
| 768 InputEventBasicTestWindowDelegate window_delegate(window_tree()); |
| 769 WindowTreeHostMus window_tree_host(window_tree_client_impl(), |
| 770 cc::FrameSinkId(1, 1)); |
| 771 Window* top_level = window_tree_host.window(); |
| 772 const gfx::Rect bounds(0, 0, 100, 100); |
| 773 window_tree_host.SetBoundsInPixels(bounds); |
| 774 window_tree_host.InitHost(); |
| 775 window_tree_host.Show(); |
| 776 EXPECT_EQ(bounds, top_level->bounds()); |
| 777 EXPECT_EQ(bounds, window_tree_host.GetBoundsInPixels()); |
| 778 Window child(&window_delegate); |
| 779 child.Init(ui::LAYER_NOT_DRAWN); |
| 780 top_level->AddChild(&child); |
| 781 child.SetBounds(gfx::Rect(10, 10, 100, 100)); |
| 782 child.Show(); |
| 783 EXPECT_FALSE(window_delegate.got_move()); |
| 784 const gfx::Point event_location(2, 3); |
| 785 const uint32_t event_id = 1; |
| 786 window_delegate.set_event_id(event_id); |
| 787 ui::PointerEvent pointer_event( |
| 788 ui::ET_POINTER_MOVED, event_location, gfx::Point(), ui::EF_NONE, 0, |
| 789 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, 0), |
| 790 base::TimeTicks()); |
| 791 window_tree_client()->OnWindowInputEvent(event_id, server_id(&child), |
| 792 window_tree_host.display_id(), |
| 793 ui::Event::Clone(pointer_event), 0); |
| 794 EXPECT_TRUE(window_tree()->WasEventAcked(event_id)); |
| 795 EXPECT_EQ(ui::mojom::EventResult::HANDLED, |
| 796 window_tree()->GetEventResult(event_id)); |
| 797 EXPECT_TRUE(window_delegate.got_move()); |
| 798 EXPECT_EQ(event_location, window_delegate.last_event_location()); |
| 799 } |
| 800 |
767 TEST_F(WindowTreeClientClientTest, InputEventFindTargetAndConversion) { | 801 TEST_F(WindowTreeClientClientTest, InputEventFindTargetAndConversion) { |
768 WindowTreeHostMus window_tree_host(window_tree_client_impl(), | 802 WindowTreeHostMus window_tree_host(window_tree_client_impl(), |
769 cc::FrameSinkId(1, 1)); | 803 cc::FrameSinkId(1, 1)); |
770 Window* top_level = window_tree_host.window(); | 804 Window* top_level = window_tree_host.window(); |
771 const gfx::Rect bounds(0, 0, 100, 100); | 805 const gfx::Rect bounds(0, 0, 100, 100); |
772 window_tree_host.SetBoundsInPixels(bounds); | 806 window_tree_host.SetBoundsInPixels(bounds); |
773 window_tree_host.InitHost(); | 807 window_tree_host.InitHost(); |
774 window_tree_host.Show(); | 808 window_tree_host.Show(); |
775 EXPECT_EQ(bounds, top_level->bounds()); | 809 EXPECT_EQ(bounds, top_level->bounds()); |
776 EXPECT_EQ(bounds, window_tree_host.GetBoundsInPixels()); | 810 EXPECT_EQ(bounds, window_tree_host.GetBoundsInPixels()); |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 window_tree()->GetEventResult(event_id)); | 2226 window_tree()->GetEventResult(event_id)); |
2193 EXPECT_TRUE(window_delegate1.got_move()); | 2227 EXPECT_TRUE(window_delegate1.got_move()); |
2194 EXPECT_FALSE(window_delegate2.got_move()); | 2228 EXPECT_FALSE(window_delegate2.got_move()); |
2195 gfx::Point transformed_event_location_in_dip(event_location_in_dip.x() + 20, | 2229 gfx::Point transformed_event_location_in_dip(event_location_in_dip.x() + 20, |
2196 event_location_in_dip.y() + 30); | 2230 event_location_in_dip.y() + 30); |
2197 EXPECT_EQ(transformed_event_location_in_dip, | 2231 EXPECT_EQ(transformed_event_location_in_dip, |
2198 window_delegate1.last_event_location()); | 2232 window_delegate1.last_event_location()); |
2199 } | 2233 } |
2200 | 2234 |
2201 } // namespace aura | 2235 } // namespace aura |
OLD | NEW |