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/platform_window_mus.h" | 5 #include "ui/views/mus/platform_window_mus.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 native_widget_ = | 81 native_widget_ = |
82 static_cast<NativeWidgetMus*>(widget_->native_widget_private()); | 82 static_cast<NativeWidgetMus*>(widget_->native_widget_private()); |
83 platform_window_ = native_widget_->window_tree_host()->platform_window(); | 83 platform_window_ = native_widget_->window_tree_host()->platform_window(); |
84 ASSERT_TRUE(platform_window_); | 84 ASSERT_TRUE(platform_window_); |
85 } | 85 } |
86 | 86 |
87 // Returns a mouse pressed event in the middle of the widget. | 87 // Returns a mouse pressed event in the middle of the widget. |
88 std::unique_ptr<ui::MouseEvent> CreateMouseEvent() { | 88 std::unique_ptr<ui::MouseEvent> CreateMouseEvent() { |
89 return base::WrapUnique(new ui::MouseEvent( | 89 return base::WrapUnique(new ui::MouseEvent( |
90 ui::ET_MOUSE_PRESSED, gfx::Point(50, 50), gfx::Point(50, 50), | 90 ui::ET_MOUSE_PRESSED, gfx::Point(50, 50), gfx::Point(50, 50), |
91 base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); | 91 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
92 } | 92 } |
93 | 93 |
94 // Simulates an input event to the PlatformWindow. | 94 // Simulates an input event to the PlatformWindow. |
95 void OnWindowInputEvent( | 95 void OnWindowInputEvent( |
96 const ui::Event& event, | 96 const ui::Event& event, |
97 std::unique_ptr<base::Callback<void(mus::mojom::EventResult)>>* | 97 std::unique_ptr<base::Callback<void(mus::mojom::EventResult)>>* |
98 ack_callback) { | 98 ack_callback) { |
99 platform_window_->OnWindowInputEvent(native_widget_->window(), event, | 99 platform_window_->OnWindowInputEvent(native_widget_->window(), event, |
100 ack_callback); | 100 ack_callback); |
101 } | 101 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 // The widget was deleted. | 146 // The widget was deleted. |
147 EXPECT_FALSE(widget_); | 147 EXPECT_FALSE(widget_); |
148 | 148 |
149 // The platform window took ownership of the callback and called it. | 149 // The platform window took ownership of the callback and called it. |
150 EXPECT_FALSE(ack_callback); | 150 EXPECT_FALSE(ack_callback); |
151 EXPECT_EQ(1, ack_callback_count()); | 151 EXPECT_EQ(1, ack_callback_count()); |
152 } | 152 } |
153 | 153 |
154 } // namespace views | 154 } // namespace views |
OLD | NEW |