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_private.h" | 10 #include "components/mus/public/cpp/tests/window_tree_client_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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 mus_window->SetBounds(end_bounds); | 515 mus_window->SetBounds(end_bounds); |
516 | 516 |
517 EXPECT_EQ(end_bounds, mus_window->bounds()); | 517 EXPECT_EQ(end_bounds, mus_window->bounds()); |
518 | 518 |
519 // Main check for this test: Setting |mus_window| bounds while bypassing | 519 // Main check for this test: Setting |mus_window| bounds while bypassing |
520 // |native_widget| must update window_tree_host bounds. | 520 // |native_widget| must update window_tree_host bounds. |
521 EXPECT_EQ(end_bounds, native_widget->window_tree_host()->GetBounds()); | 521 EXPECT_EQ(end_bounds, native_widget->window_tree_host()->GetBounds()); |
522 } | 522 } |
523 | 523 |
524 } // namespace views | 524 } // namespace views |
OLD | NEW |