OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 #include <memory> | 6 #include <memory> |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1767 | 1767 |
1768 EXPECT_EQ(1, event_count_view->GetEventCount(ui::ET_MOUSE_PRESSED)); | 1768 EXPECT_EQ(1, event_count_view->GetEventCount(ui::ET_MOUSE_PRESSED)); |
1769 EXPECT_EQ( | 1769 EXPECT_EQ( |
1770 widget->GetNativeView(), | 1770 widget->GetNativeView(), |
1771 internal::NativeWidgetPrivate::GetGlobalCapture(widget->GetNativeView())); | 1771 internal::NativeWidgetPrivate::GetGlobalCapture(widget->GetNativeView())); |
1772 | 1772 |
1773 // For mus it's important we destroy the widget before the EventGenerator. | 1773 // For mus it's important we destroy the widget before the EventGenerator. |
1774 widget->CloseNow(); | 1774 widget->CloseNow(); |
1775 } | 1775 } |
1776 | 1776 |
1777 // Verify capture is correctly set on a widget. Test for crbug.com/622201. | |
tapted
2016/06/23 02:26:28
This doesn't describe the test well. It should be
karandeepb
2016/06/23 07:58:32
Done.
| |
1778 TEST_F(WidgetTest, VerifyWindowCapture) { | |
1779 Widget* widget = CreateTopLevelNativeWidget(); | |
tapted
2016/06/23 02:26:28
We should use CreateNativeDesktopWidget() for bett
karandeepb
2016/06/23 07:58:32
Why is moving to widget_interactive_uitest.cc need
tapted
2016/06/24 07:11:58
Capture has complex interactions with the OS somet
| |
1780 widget->Show(); | |
1781 widget->native_widget_private()->SetCapture(); | |
1782 EXPECT_TRUE(widget->HasCapture()); | |
1783 widget->CloseNow(); | |
tapted
2016/06/23 02:26:28
We should test asynchronous Close() as well, since
karandeepb
2016/06/23 07:58:32
Done.
| |
1784 } | |
1785 | |
1777 namespace { | 1786 namespace { |
1778 | 1787 |
1779 // An EventHandler which shows a Wiget upon receiving a mouse event. The Widget | 1788 // An EventHandler which shows a Wiget upon receiving a mouse event. The Widget |
1780 // proceeds to take capture. | 1789 // proceeds to take capture. |
1781 class CaptureEventConsumer : public ui::EventHandler { | 1790 class CaptureEventConsumer : public ui::EventHandler { |
1782 public: | 1791 public: |
1783 CaptureEventConsumer(Widget* widget) | 1792 CaptureEventConsumer(Widget* widget) |
1784 : event_count_view_(new EventCountView()), widget_(widget) {} | 1793 : event_count_view_(new EventCountView()), widget_(widget) {} |
1785 ~CaptureEventConsumer() override { widget_->CloseNow(); } | 1794 ~CaptureEventConsumer() override { widget_->CloseNow(); } |
1786 | 1795 |
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3700 EXPECT_FALSE(!!IsWindow(owned_hwnd)); | 3709 EXPECT_FALSE(!!IsWindow(owned_hwnd)); |
3701 EXPECT_TRUE(!!IsWindowEnabled(top_hwnd)); | 3710 EXPECT_TRUE(!!IsWindowEnabled(top_hwnd)); |
3702 | 3711 |
3703 top_level_widget.CloseNow(); | 3712 top_level_widget.CloseNow(); |
3704 } | 3713 } |
3705 | 3714 |
3706 #endif // defined(OS_WIN) | 3715 #endif // defined(OS_WIN) |
3707 | 3716 |
3708 } // namespace test | 3717 } // namespace test |
3709 } // namespace views | 3718 } // namespace views |
OLD | NEW |