| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 EXPECT_EQ(1, event_count_view->GetEventCount(ui::ET_MOUSE_RELEASED)); | 1761 EXPECT_EQ(1, event_count_view->GetEventCount(ui::ET_MOUSE_RELEASED)); |
| 1762 | 1762 |
| 1763 // For mus it's important we destroy the widget before the EventGenerator. | 1763 // For mus it's important we destroy the widget before the EventGenerator. |
| 1764 widget->CloseNow(); | 1764 widget->CloseNow(); |
| 1765 } | 1765 } |
| 1766 | 1766 |
| 1767 #endif // !defined(OS_MACOSX) || defined(USE_AURA) | 1767 #endif // !defined(OS_MACOSX) || defined(USE_AURA) |
| 1768 | 1768 |
| 1769 // Tests that when there is no active capture, that a mouse press causes capture | 1769 // Tests that when there is no active capture, that a mouse press causes capture |
| 1770 // to be set. | 1770 // to be set. |
| 1771 // Disabled on Mac (GetGlobalCapture() not yet implemented). | 1771 TEST_F(WidgetTest, MousePressCausesCapture) { |
| 1772 // http://crbug.com//622979. | |
| 1773 #if defined(OS_MACOSX) | |
| 1774 #define MAYBE_MousePressCausesCapture DISABLED_MousePressCausesCapture | |
| 1775 #else | |
| 1776 #define MAYBE_MousePressCausesCapture MousePressCausesCapture | |
| 1777 #endif | |
| 1778 TEST_F(WidgetTest, MAYBE_MousePressCausesCapture) { | |
| 1779 Widget* widget = CreateTopLevelNativeWidget(); | 1772 Widget* widget = CreateTopLevelNativeWidget(); |
| 1780 widget->Show(); | 1773 widget->Show(); |
| 1781 widget->SetSize(gfx::Size(300, 300)); | 1774 widget->SetSize(gfx::Size(300, 300)); |
| 1782 | 1775 |
| 1783 EventCountView* event_count_view = new EventCountView(); | 1776 EventCountView* event_count_view = new EventCountView(); |
| 1784 event_count_view->SetBounds(0, 0, 300, 300); | 1777 event_count_view->SetBounds(0, 0, 300, 300); |
| 1785 widget->GetRootView()->AddChildView(event_count_view); | 1778 widget->GetRootView()->AddChildView(event_count_view); |
| 1786 | 1779 |
| 1787 // No capture has been set. | 1780 // No capture has been set. |
| 1788 EXPECT_EQ(nullptr, internal::NativeWidgetPrivate::GetGlobalCapture( | 1781 EXPECT_EQ(nullptr, internal::NativeWidgetPrivate::GetGlobalCapture( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 | 1824 |
| 1832 EventCountView* event_count_view_; | 1825 EventCountView* event_count_view_; |
| 1833 Widget* widget_; | 1826 Widget* widget_; |
| 1834 DISALLOW_COPY_AND_ASSIGN(CaptureEventConsumer); | 1827 DISALLOW_COPY_AND_ASSIGN(CaptureEventConsumer); |
| 1835 }; | 1828 }; |
| 1836 | 1829 |
| 1837 } // namespace | 1830 } // namespace |
| 1838 | 1831 |
| 1839 // Tests that if explicit capture occurs during a mouse press, that implicit | 1832 // Tests that if explicit capture occurs during a mouse press, that implicit |
| 1840 // capture is not applied. | 1833 // capture is not applied. |
| 1841 // Disabled on Mac (GetGlobalCapture() not yet implemented). | 1834 TEST_F(WidgetTest, CaptureDuringMousePressNotOverridden) { |
| 1842 // http://crbug.com//622979. | |
| 1843 #if defined(OS_MACOSX) | |
| 1844 #define MAYBE_CaptureDuringMousePressNotOverridden \ | |
| 1845 DISABLED_CaptureDuringMousePressNotOverridden | |
| 1846 #else | |
| 1847 #define MAYBE_CaptureDuringMousePressNotOverridden \ | |
| 1848 CaptureDuringMousePressNotOverridden | |
| 1849 #endif | |
| 1850 TEST_F(WidgetTest, MAYBE_CaptureDuringMousePressNotOverridden) { | |
| 1851 Widget* widget = CreateTopLevelNativeWidget(); | 1835 Widget* widget = CreateTopLevelNativeWidget(); |
| 1852 widget->Show(); | 1836 widget->Show(); |
| 1853 widget->SetSize(gfx::Size(300, 300)); | 1837 widget->SetSize(gfx::Size(300, 300)); |
| 1854 | 1838 |
| 1855 EventCountView* event_count_view = new EventCountView(); | 1839 EventCountView* event_count_view = new EventCountView(); |
| 1856 event_count_view->SetBounds(0, 0, 300, 300); | 1840 event_count_view->SetBounds(0, 0, 300, 300); |
| 1857 widget->GetRootView()->AddChildView(event_count_view); | 1841 widget->GetRootView()->AddChildView(event_count_view); |
| 1858 | 1842 |
| 1859 EXPECT_EQ(nullptr, internal::NativeWidgetPrivate::GetGlobalCapture( | 1843 EXPECT_EQ(nullptr, internal::NativeWidgetPrivate::GetGlobalCapture( |
| 1860 widget->GetNativeView())); | 1844 widget->GetNativeView())); |
| (...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3817 CreateParams(Widget::InitParams::TYPE_WINDOW), | 3801 CreateParams(Widget::InitParams::TYPE_WINDOW), |
| 3818 Widget::InitParams::TRANSLUCENT_WINDOW); | 3802 Widget::InitParams::TRANSLUCENT_WINDOW); |
| 3819 EXPECT_EQ(IsNativeWindowTransparent(widget.GetNativeWindow()), | 3803 EXPECT_EQ(IsNativeWindowTransparent(widget.GetNativeWindow()), |
| 3820 widget.ShouldWindowContentsBeTransparent()); | 3804 widget.ShouldWindowContentsBeTransparent()); |
| 3821 } | 3805 } |
| 3822 | 3806 |
| 3823 #endif // !defined(OS_CHROMEOS) | 3807 #endif // !defined(OS_CHROMEOS) |
| 3824 | 3808 |
| 3825 } // namespace test | 3809 } // namespace test |
| 3826 } // namespace views | 3810 } // namespace views |
| OLD | NEW |