| 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 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 EXPECT_EQ(1, event_count_view->GetEventCount(ui::ET_MOUSE_RELEASED)); | 1737 EXPECT_EQ(1, event_count_view->GetEventCount(ui::ET_MOUSE_RELEASED)); |
| 1738 | 1738 |
| 1739 // For mus it's important we destroy the widget before the EventGenerator. | 1739 // For mus it's important we destroy the widget before the EventGenerator. |
| 1740 widget->CloseNow(); | 1740 widget->CloseNow(); |
| 1741 } | 1741 } |
| 1742 | 1742 |
| 1743 #endif // !defined(OS_MACOSX) || defined(USE_AURA) | 1743 #endif // !defined(OS_MACOSX) || defined(USE_AURA) |
| 1744 | 1744 |
| 1745 // Tests that when there is no active capture, that a mouse press causes capture | 1745 // Tests that when there is no active capture, that a mouse press causes capture |
| 1746 // to be set. | 1746 // to be set. |
| 1747 TEST_F(WidgetTest, MousePressCausesCapture) { | 1747 // Disabled on Mac (GetGlobalCapture() not yet implemented). |
| 1748 // http://crbug.com//622979. |
| 1749 #if defined(OS_MACOSX) |
| 1750 #define MAYBE_MousePressCausesCapture DISABLED_MousePressCausesCapture |
| 1751 #else |
| 1752 #define MAYBE_MousePressCausesCapture MousePressCausesCapture |
| 1753 #endif |
| 1754 TEST_F(WidgetTest, MAYBE_MousePressCausesCapture) { |
| 1748 Widget* widget = CreateTopLevelNativeWidget(); | 1755 Widget* widget = CreateTopLevelNativeWidget(); |
| 1749 widget->Show(); | 1756 widget->Show(); |
| 1750 widget->SetSize(gfx::Size(300, 300)); | 1757 widget->SetSize(gfx::Size(300, 300)); |
| 1751 | 1758 |
| 1752 EventCountView* event_count_view = new EventCountView(); | 1759 EventCountView* event_count_view = new EventCountView(); |
| 1753 event_count_view->SetBounds(0, 0, 300, 300); | 1760 event_count_view->SetBounds(0, 0, 300, 300); |
| 1754 widget->GetRootView()->AddChildView(event_count_view); | 1761 widget->GetRootView()->AddChildView(event_count_view); |
| 1755 | 1762 |
| 1756 // No capture has been set. | 1763 // No capture has been set. |
| 1757 EXPECT_EQ(nullptr, internal::NativeWidgetPrivate::GetGlobalCapture( | 1764 EXPECT_EQ(nullptr, internal::NativeWidgetPrivate::GetGlobalCapture( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 | 1807 |
| 1801 EventCountView* event_count_view_; | 1808 EventCountView* event_count_view_; |
| 1802 Widget* widget_; | 1809 Widget* widget_; |
| 1803 DISALLOW_COPY_AND_ASSIGN(CaptureEventConsumer); | 1810 DISALLOW_COPY_AND_ASSIGN(CaptureEventConsumer); |
| 1804 }; | 1811 }; |
| 1805 | 1812 |
| 1806 } // namespace | 1813 } // namespace |
| 1807 | 1814 |
| 1808 // Tests that if explicit capture occurs during a mouse press, that implicit | 1815 // Tests that if explicit capture occurs during a mouse press, that implicit |
| 1809 // capture is not applied. | 1816 // capture is not applied. |
| 1810 TEST_F(WidgetTest, CaptureDuringMousePressNotOverridden) { | 1817 // Disabled on Mac (GetGlobalCapture() not yet implemented). |
| 1818 // http://crbug.com//622979. |
| 1819 #if defined(OS_MACOSX) |
| 1820 #define MAYBE_CaptureDuringMousePressNotOverridden \ |
| 1821 DISABLED_CaptureDuringMousePressNotOverridden |
| 1822 #else |
| 1823 #define MAYBE_CaptureDuringMousePressNotOverridden \ |
| 1824 CaptureDuringMousePressNotOverridden |
| 1825 #endif |
| 1826 TEST_F(WidgetTest, MAYBE_CaptureDuringMousePressNotOverridden) { |
| 1811 Widget* widget = CreateTopLevelNativeWidget(); | 1827 Widget* widget = CreateTopLevelNativeWidget(); |
| 1812 widget->Show(); | 1828 widget->Show(); |
| 1813 widget->SetSize(gfx::Size(300, 300)); | 1829 widget->SetSize(gfx::Size(300, 300)); |
| 1814 | 1830 |
| 1815 EventCountView* event_count_view = new EventCountView(); | 1831 EventCountView* event_count_view = new EventCountView(); |
| 1816 event_count_view->SetBounds(0, 0, 300, 300); | 1832 event_count_view->SetBounds(0, 0, 300, 300); |
| 1817 widget->GetRootView()->AddChildView(event_count_view); | 1833 widget->GetRootView()->AddChildView(event_count_view); |
| 1818 | 1834 |
| 1819 EXPECT_EQ(nullptr, internal::NativeWidgetPrivate::GetGlobalCapture( | 1835 EXPECT_EQ(nullptr, internal::NativeWidgetPrivate::GetGlobalCapture( |
| 1820 widget->GetNativeView())); | 1836 widget->GetNativeView())); |
| (...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3136 views::Widget* widget_; | 3152 views::Widget* widget_; |
| 3137 bool fullscreen_layout_called_; | 3153 bool fullscreen_layout_called_; |
| 3138 | 3154 |
| 3139 DISALLOW_COPY_AND_ASSIGN(FullscreenAwareFrame); | 3155 DISALLOW_COPY_AND_ASSIGN(FullscreenAwareFrame); |
| 3140 }; | 3156 }; |
| 3141 | 3157 |
| 3142 } // namespace | 3158 } // namespace |
| 3143 | 3159 |
| 3144 // Tests that frame Layout is called when a widget goes fullscreen without | 3160 // Tests that frame Layout is called when a widget goes fullscreen without |
| 3145 // changing its size or title. | 3161 // changing its size or title. |
| 3146 TEST_F(WidgetTest, FullscreenFrameLayout) { | 3162 // Fails on Mac, but only on bots. http://crbug.com/607403. |
| 3163 #if defined(OS_MACOSX) |
| 3164 #define MAYBE_FullscreenFrameLayout DISABLED_FullscreenFrameLayout |
| 3165 #else |
| 3166 #define MAYBE_FullscreenFrameLayout FullscreenFrameLayout |
| 3167 #endif |
| 3168 TEST_F(WidgetTest, MAYBE_FullscreenFrameLayout) { |
| 3147 WidgetAutoclosePtr widget(CreateTopLevelPlatformWidget()); | 3169 WidgetAutoclosePtr widget(CreateTopLevelPlatformWidget()); |
| 3148 FullscreenAwareFrame* frame = new FullscreenAwareFrame(widget.get()); | 3170 FullscreenAwareFrame* frame = new FullscreenAwareFrame(widget.get()); |
| 3149 widget->non_client_view()->SetFrameView(frame); // Owns |frame|. | 3171 widget->non_client_view()->SetFrameView(frame); // Owns |frame|. |
| 3150 | 3172 |
| 3151 widget->Maximize(); | 3173 widget->Maximize(); |
| 3152 RunPendingMessages(); | 3174 RunPendingMessages(); |
| 3153 | 3175 |
| 3154 EXPECT_FALSE(frame->fullscreen_layout_called()); | 3176 EXPECT_FALSE(frame->fullscreen_layout_called()); |
| 3155 widget->SetFullscreen(true); | 3177 widget->SetFullscreen(true); |
| 3156 widget->Show(); | 3178 widget->Show(); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3700 EXPECT_FALSE(!!IsWindow(owned_hwnd)); | 3722 EXPECT_FALSE(!!IsWindow(owned_hwnd)); |
| 3701 EXPECT_TRUE(!!IsWindowEnabled(top_hwnd)); | 3723 EXPECT_TRUE(!!IsWindowEnabled(top_hwnd)); |
| 3702 | 3724 |
| 3703 top_level_widget.CloseNow(); | 3725 top_level_widget.CloseNow(); |
| 3704 } | 3726 } |
| 3705 | 3727 |
| 3706 #endif // defined(OS_WIN) | 3728 #endif // defined(OS_WIN) |
| 3707 | 3729 |
| 3708 } // namespace test | 3730 } // namespace test |
| 3709 } // namespace views | 3731 } // namespace views |
| OLD | NEW |