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