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 "services/ui/public/cpp/property_type_converters.h" | 9 #include "services/ui/public/cpp/property_type_converters.h" |
10 #include "services/ui/public/cpp/tests/window_tree_client_private.h" | 10 #include "services/ui/public/cpp/tests/window_tree_client_private.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 void AckCallback(ui::mojom::EventResult result) { | 166 void AckCallback(ui::mojom::EventResult result) { |
167 ack_callback_count_++; | 167 ack_callback_count_++; |
168 EXPECT_EQ(ui::mojom::EventResult::HANDLED, result); | 168 EXPECT_EQ(ui::mojom::EventResult::HANDLED, result); |
169 } | 169 } |
170 | 170 |
171 // Returns a mouse pressed event inside the widget. Tests that place views | 171 // Returns a mouse pressed event inside the widget. Tests that place views |
172 // within the widget that respond to the event must be constructed within the | 172 // within the widget that respond to the event must be constructed within the |
173 // widget coordinate space such that they respond correctly. | 173 // widget coordinate space such that they respond correctly. |
174 std::unique_ptr<ui::MouseEvent> CreateMouseEvent() { | 174 std::unique_ptr<ui::MouseEvent> CreateMouseEvent() { |
175 return base::WrapUnique(new ui::MouseEvent( | 175 return base::MakeUnique<ui::MouseEvent>( |
176 ui::ET_MOUSE_PRESSED, gfx::Point(50, 50), gfx::Point(50, 50), | 176 ui::ET_MOUSE_PRESSED, gfx::Point(50, 50), gfx::Point(50, 50), |
177 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); | 177 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
178 } | 178 } |
179 | 179 |
180 // Simulates an input event to the NativeWidget. | 180 // Simulates an input event to the NativeWidget. |
181 void OnWindowInputEvent( | 181 void OnWindowInputEvent( |
182 NativeWidgetMus* native_widget, | 182 NativeWidgetMus* native_widget, |
183 const ui::Event& event, | 183 const ui::Event& event, |
184 std::unique_ptr<base::Callback<void(ui::mojom::EventResult)>>* | 184 std::unique_ptr<base::Callback<void(ui::mojom::EventResult)>>* |
185 ack_callback) { | 185 ack_callback) { |
186 native_widget->OnWindowInputEvent(native_widget->window(), event, | 186 native_widget->OnWindowInputEvent(native_widget->window(), event, |
187 ack_callback); | 187 ack_callback); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 params.native_widget = new NativeWidgetMus(widget.get(), window, | 603 params.native_widget = new NativeWidgetMus(widget.get(), window, |
604 ui::mojom::SurfaceType::DEFAULT); | 604 ui::mojom::SurfaceType::DEFAULT); |
605 widget->Init(params); | 605 widget->Init(params); |
606 window->SetSharedProperty<int32_t>( | 606 window->SetSharedProperty<int32_t>( |
607 ui::mojom::WindowManager::kShowState_Property, | 607 ui::mojom::WindowManager::kShowState_Property, |
608 static_cast<uint32_t>(ui::mojom::ShowState::MAXIMIZED)); | 608 static_cast<uint32_t>(ui::mojom::ShowState::MAXIMIZED)); |
609 EXPECT_TRUE(widget->IsMaximized()); | 609 EXPECT_TRUE(widget->IsMaximized()); |
610 } | 610 } |
611 | 611 |
612 } // namespace views | 612 } // namespace views |
OLD | NEW |