| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 &ack_callback); | 429 &ack_callback); |
| 430 | 430 |
| 431 // The widget was deleted. | 431 // The widget was deleted. |
| 432 EXPECT_FALSE(widget.get()); | 432 EXPECT_FALSE(widget.get()); |
| 433 | 433 |
| 434 // The test took ownership of the callback and called it. | 434 // The test took ownership of the callback and called it. |
| 435 EXPECT_FALSE(ack_callback); | 435 EXPECT_FALSE(ack_callback); |
| 436 EXPECT_EQ(1, ack_callback_count()); | 436 EXPECT_EQ(1, ack_callback_count()); |
| 437 } | 437 } |
| 438 | 438 |
| 439 TEST_F(NativeWidgetMusTest, SetAndReleaseCapture) { |
| 440 std::unique_ptr<Widget> widget(CreateWidget(nullptr)); |
| 441 widget->Show(); |
| 442 View* content = new View; |
| 443 widget->GetContentsView()->AddChildView(content); |
| 444 internal::NativeWidgetPrivate* widget_private = |
| 445 widget->native_widget_private(); |
| 446 mus::Window* mus_window = |
| 447 static_cast<NativeWidgetMus*>(widget_private)->window(); |
| 448 EXPECT_FALSE(widget_private->HasCapture()); |
| 449 EXPECT_FALSE(mus_window->HasCapture()); |
| 450 |
| 451 widget->SetCapture(content); |
| 452 EXPECT_TRUE(widget_private->HasCapture()); |
| 453 EXPECT_TRUE(mus_window->HasCapture()); |
| 454 |
| 455 widget->ReleaseCapture(); |
| 456 EXPECT_FALSE(widget_private->HasCapture()); |
| 457 EXPECT_FALSE(mus_window->HasCapture()); |
| 458 } |
| 459 |
| 439 } // namespace views | 460 } // namespace views |
| OLD | NEW |