| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 | 874 |
| 875 private: | 875 private: |
| 876 ui::ModalType type_; | 876 ui::ModalType type_; |
| 877 | 877 |
| 878 DISALLOW_COPY_AND_ASSIGN(ModalDialogDelegate); | 878 DISALLOW_COPY_AND_ASSIGN(ModalDialogDelegate); |
| 879 }; | 879 }; |
| 880 | 880 |
| 881 // Tests whether the focused window is set correctly when a modal window is | 881 // Tests whether the focused window is set correctly when a modal window is |
| 882 // created and destroyed. When it is destroyed it should focus the owner window. | 882 // created and destroyed. When it is destroyed it should focus the owner window. |
| 883 TEST_F(WidgetTestInteractive, WindowModalWindowDestroyedActivationTest) { | 883 TEST_F(WidgetTestInteractive, WindowModalWindowDestroyedActivationTest) { |
| 884 // Fails on mus due to focus issues. http://crbug.com/611601 | |
| 885 if (IsMus()) | |
| 886 return; | |
| 887 | |
| 888 TestWidgetFocusChangeListener focus_listener; | 884 TestWidgetFocusChangeListener focus_listener; |
| 889 WidgetFocusManager::GetInstance()->AddFocusChangeListener(&focus_listener); | 885 WidgetFocusManager::GetInstance()->AddFocusChangeListener(&focus_listener); |
| 890 const std::vector<gfx::NativeView>& focus_changes = | 886 const std::vector<gfx::NativeView>& focus_changes = |
| 891 focus_listener.focus_changes(); | 887 focus_listener.focus_changes(); |
| 892 | 888 |
| 893 // Create a top level widget. | 889 // Create a top level widget. |
| 894 Widget top_level_widget; | 890 Widget top_level_widget; |
| 895 Widget::InitParams init_params = | 891 Widget::InitParams init_params = |
| 896 CreateParams(Widget::InitParams::TYPE_WINDOW); | 892 CreateParams(Widget::InitParams::TYPE_WINDOW); |
| 897 init_params.show_state = ui::SHOW_STATE_NORMAL; | 893 init_params.show_state = ui::SHOW_STATE_NORMAL; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 CreatePlatformDesktopNativeWidgetImpl(init_params, &widget, nullptr); | 1009 CreatePlatformDesktopNativeWidgetImpl(init_params, &widget, nullptr); |
| 1014 widget.Init(init_params); | 1010 widget.Init(init_params); |
| 1015 | 1011 |
| 1016 widget.Show(); | 1012 widget.Show(); |
| 1017 EXPECT_FALSE(widget.IsActive()); | 1013 EXPECT_FALSE(widget.IsActive()); |
| 1018 } | 1014 } |
| 1019 | 1015 |
| 1020 #if defined(USE_AURA) | 1016 #if defined(USE_AURA) |
| 1021 // Test that touch selection quick menu is not activated when opened. | 1017 // Test that touch selection quick menu is not activated when opened. |
| 1022 TEST_F(WidgetTestInteractive, TouchSelectionQuickMenuIsNotActivated) { | 1018 TEST_F(WidgetTestInteractive, TouchSelectionQuickMenuIsNotActivated) { |
| 1023 // Fails on mus because the USER_PRIVATE window container is not visible by | |
| 1024 // default. See http://crbug.com/611601 | |
| 1025 if (IsMus()) | |
| 1026 return; | |
| 1027 | |
| 1028 #if defined(OS_WIN) | 1019 #if defined(OS_WIN) |
| 1029 views_delegate()->set_use_desktop_native_widgets(true); | 1020 views_delegate()->set_use_desktop_native_widgets(true); |
| 1030 #endif // !defined(OS_WIN) | 1021 #endif // !defined(OS_WIN) |
| 1031 | 1022 |
| 1032 Widget* widget = CreateWidget(); | 1023 Widget* widget = CreateWidget(); |
| 1033 | 1024 |
| 1034 Textfield* textfield = new Textfield; | 1025 Textfield* textfield = new Textfield; |
| 1035 textfield->SetBounds(0, 0, 200, 20); | 1026 textfield->SetBounds(0, 0, 200, 20); |
| 1036 textfield->SetText(base::ASCIIToUTF16("some text")); | 1027 textfield->SetText(base::ASCIIToUTF16("some text")); |
| 1037 widget->GetRootView()->AddChildView(textfield); | 1028 widget->GetRootView()->AddChildView(textfield); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1049 textfield_test_api.touch_selection_controller())); | 1040 textfield_test_api.touch_selection_controller())); |
| 1050 | 1041 |
| 1051 EXPECT_TRUE(textfield->HasFocus()); | 1042 EXPECT_TRUE(textfield->HasFocus()); |
| 1052 EXPECT_TRUE(widget->IsActive()); | 1043 EXPECT_TRUE(widget->IsActive()); |
| 1053 EXPECT_TRUE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); | 1044 EXPECT_TRUE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
| 1054 widget->CloseNow(); | 1045 widget->CloseNow(); |
| 1055 } | 1046 } |
| 1056 #endif // defined(USE_AURA) | 1047 #endif // defined(USE_AURA) |
| 1057 | 1048 |
| 1058 TEST_F(WidgetTestInteractive, DisableViewDoesNotActivateWidget) { | 1049 TEST_F(WidgetTestInteractive, DisableViewDoesNotActivateWidget) { |
| 1059 // Fails on mus because the USER_PRIVATE window container is not visible by | 1050 // Times out on mus. See http://crbug.com/612193 |
| 1060 // default. See http://crbug.com/611601 | |
| 1061 if (IsMus()) | 1051 if (IsMus()) |
| 1062 return; | 1052 return; |
| 1063 | 1053 |
| 1064 #if defined(OS_WIN) | 1054 #if defined(OS_WIN) |
| 1065 views_delegate()->set_use_desktop_native_widgets(true); | 1055 views_delegate()->set_use_desktop_native_widgets(true); |
| 1066 #endif // !defined(OS_WIN) | 1056 #endif // !defined(OS_WIN) |
| 1067 | 1057 |
| 1068 // Create first widget and view, activate the widget, and focus the view. | 1058 // Create first widget and view, activate the widget, and focus the view. |
| 1069 Widget widget1; | 1059 Widget widget1; |
| 1070 Widget::InitParams params1 = CreateParams(Widget::InitParams::TYPE_POPUP); | 1060 Widget::InitParams params1 = CreateParams(Widget::InitParams::TYPE_POPUP); |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 | 1790 |
| 1801 ui::KeyEvent key_event2(key_event); | 1791 ui::KeyEvent key_event2(key_event); |
| 1802 widget->OnKeyEvent(&key_event2); | 1792 widget->OnKeyEvent(&key_event2); |
| 1803 EXPECT_FALSE(key_event2.stopped_propagation()); | 1793 EXPECT_FALSE(key_event2.stopped_propagation()); |
| 1804 | 1794 |
| 1805 widget->CloseNow(); | 1795 widget->CloseNow(); |
| 1806 } | 1796 } |
| 1807 | 1797 |
| 1808 } // namespace test | 1798 } // namespace test |
| 1809 } // namespace views | 1799 } // namespace views |
| OLD | NEW |