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_impl_private.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 ack_callback_count_++; | 165 ack_callback_count_++; |
166 EXPECT_EQ(mus::mojom::EventResult::HANDLED, result); | 166 EXPECT_EQ(mus::mojom::EventResult::HANDLED, result); |
167 } | 167 } |
168 | 168 |
169 // Returns a mouse pressed event inside the widget. Tests that place views | 169 // Returns a mouse pressed event inside the widget. Tests that place views |
170 // within the widget that respond to the event must be constructed within the | 170 // within the widget that respond to the event must be constructed within the |
171 // widget coordinate space such that they respond correctly. | 171 // widget coordinate space such that they respond correctly. |
172 std::unique_ptr<ui::MouseEvent> CreateMouseEvent() { | 172 std::unique_ptr<ui::MouseEvent> CreateMouseEvent() { |
173 return base::WrapUnique(new ui::MouseEvent( | 173 return base::WrapUnique(new ui::MouseEvent( |
174 ui::ET_MOUSE_PRESSED, gfx::Point(50, 50), gfx::Point(50, 50), | 174 ui::ET_MOUSE_PRESSED, gfx::Point(50, 50), gfx::Point(50, 50), |
175 base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); | 175 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
176 } | 176 } |
177 | 177 |
178 // Simulates an input event to the NativeWidget. | 178 // Simulates an input event to the NativeWidget. |
179 void OnWindowInputEvent( | 179 void OnWindowInputEvent( |
180 NativeWidgetMus* native_widget, | 180 NativeWidgetMus* native_widget, |
181 const ui::Event& event, | 181 const ui::Event& event, |
182 std::unique_ptr<base::Callback<void(mus::mojom::EventResult)>>* | 182 std::unique_ptr<base::Callback<void(mus::mojom::EventResult)>>* |
183 ack_callback) { | 183 ack_callback) { |
184 native_widget->OnWindowInputEvent(native_widget->window(), event, | 184 native_widget->OnWindowInputEvent(native_widget->window(), event, |
185 ack_callback); | 185 ack_callback); |
(...skipping 299 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 |