OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 712 |
713 // WidgetDelegate overrides. | 713 // WidgetDelegate overrides. |
714 ui::ModalType GetModalType() const override { return type_; } | 714 ui::ModalType GetModalType() const override { return type_; } |
715 | 715 |
716 private: | 716 private: |
717 ui::ModalType type_; | 717 ui::ModalType type_; |
718 | 718 |
719 DISALLOW_COPY_AND_ASSIGN(ModalDialogDelegate); | 719 DISALLOW_COPY_AND_ASSIGN(ModalDialogDelegate); |
720 }; | 720 }; |
721 | 721 |
| 722 // TODO(tapted): Implement modal widgets for Mac. |
| 723 #if defined(OS_MACOSX) && !defined(USE_AURA) |
| 724 #define MAYBE_WindowModalWindowDestroyedActivationTest \ |
| 725 DISABLED_WindowModalWindowDestroyedActivationTest |
| 726 #else |
| 727 #define MAYBE_WindowModalWindowDestroyedActivationTest \ |
| 728 WindowModalWindowDestroyedActivationTest |
| 729 #endif |
| 730 |
722 // Tests whether the focused window is set correctly when a modal window is | 731 // Tests whether the focused window is set correctly when a modal window is |
723 // created and destroyed. When it is destroyed it should focus the owner window. | 732 // created and destroyed. When it is destroyed it should focus the owner window. |
724 TEST_F(WidgetTestInteractive, WindowModalWindowDestroyedActivationTest) { | 733 TEST_F(WidgetTestInteractive, MAYBE_WindowModalWindowDestroyedActivationTest) { |
725 TestWidgetFocusChangeListener focus_listener; | 734 TestWidgetFocusChangeListener focus_listener; |
726 WidgetFocusManager::GetInstance()->AddFocusChangeListener(&focus_listener); | 735 WidgetFocusManager::GetInstance()->AddFocusChangeListener(&focus_listener); |
727 const std::vector<NativeViewPair>& focus_changes = | 736 const std::vector<NativeViewPair>& focus_changes = |
728 focus_listener.focus_changes(); | 737 focus_listener.focus_changes(); |
729 | 738 |
730 // Create a top level widget. | 739 // Create a top level widget. |
731 Widget top_level_widget; | 740 Widget top_level_widget; |
732 Widget::InitParams init_params = | 741 Widget::InitParams init_params = |
733 CreateParams(Widget::InitParams::TYPE_WINDOW); | 742 CreateParams(Widget::InitParams::TYPE_WINDOW); |
734 init_params.show_state = ui::SHOW_STATE_NORMAL; | 743 init_params.show_state = ui::SHOW_STATE_NORMAL; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 EXPECT_EQ(5u, focus_changes.size()); | 776 EXPECT_EQ(5u, focus_changes.size()); |
768 EXPECT_EQ(NativeViewPair(modal_native_view, top_level_native_view), | 777 EXPECT_EQ(NativeViewPair(modal_native_view, top_level_native_view), |
769 focus_changes[3]); | 778 focus_changes[3]); |
770 EXPECT_EQ(NativeViewPair(modal_native_view, top_level_native_view), | 779 EXPECT_EQ(NativeViewPair(modal_native_view, top_level_native_view), |
771 focus_changes[4]); | 780 focus_changes[4]); |
772 | 781 |
773 top_level_widget.CloseNow(); | 782 top_level_widget.CloseNow(); |
774 WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(&focus_listener); | 783 WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(&focus_listener); |
775 } | 784 } |
776 | 785 |
| 786 // Disabled on Mac. Desktop Mac doesn't have system modal widgets since Carbon |
| 787 // was deprecated. TODO(tapted): Implement modal windows and try out AppKit's |
| 788 // application modal windows here if needed. |
| 789 #if defined(OS_MACOSX) && !defined(USE_AURA) |
| 790 #define MAYBE_SystemModalWindowReleasesCapture \ |
| 791 DISABLED_SystemModalWindowReleasesCapture |
| 792 #else |
| 793 #define MAYBE_SystemModalWindowReleasesCapture \ |
| 794 SystemModalWindowReleasesCapture |
| 795 #endif |
| 796 |
777 // Test that when opening a system-modal window, capture is released. | 797 // Test that when opening a system-modal window, capture is released. |
778 TEST_F(WidgetTestInteractive, SystemModalWindowReleasesCapture) { | 798 TEST_F(WidgetTestInteractive, MAYBE_SystemModalWindowReleasesCapture) { |
779 TestWidgetFocusChangeListener focus_listener; | 799 TestWidgetFocusChangeListener focus_listener; |
780 WidgetFocusManager::GetInstance()->AddFocusChangeListener(&focus_listener); | 800 WidgetFocusManager::GetInstance()->AddFocusChangeListener(&focus_listener); |
781 | 801 |
782 // Create a top level widget. | 802 // Create a top level widget. |
783 Widget top_level_widget; | 803 Widget top_level_widget; |
784 Widget::InitParams init_params = | 804 Widget::InitParams init_params = |
785 CreateParams(Widget::InitParams::TYPE_WINDOW); | 805 CreateParams(Widget::InitParams::TYPE_WINDOW); |
786 init_params.show_state = ui::SHOW_STATE_NORMAL; | 806 init_params.show_state = ui::SHOW_STATE_NORMAL; |
787 gfx::Rect initial_bounds(0, 0, 500, 500); | 807 gfx::Rect initial_bounds(0, 0, 500, 500); |
788 init_params.bounds = initial_bounds; | 808 init_params.bounds = initial_bounds; |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 ui::EventDispatchDetails details = widget1.GetNativeWindow()-> | 1399 ui::EventDispatchDetails details = widget1.GetNativeWindow()-> |
1380 GetHost()->event_processor()->OnEventFromSource(&mouse_event); | 1400 GetHost()->event_processor()->OnEventFromSource(&mouse_event); |
1381 ASSERT_FALSE(details.dispatcher_destroyed); | 1401 ASSERT_FALSE(details.dispatcher_destroyed); |
1382 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); | 1402 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); |
1383 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); | 1403 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); |
1384 } | 1404 } |
1385 #endif // defined(OS_WIN) | 1405 #endif // defined(OS_WIN) |
1386 | 1406 |
1387 } // namespace test | 1407 } // namespace test |
1388 } // namespace views | 1408 } // namespace views |
OLD | NEW |