Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: ui/views/widget/widget_interactive_uitest.cc

Issue 1979323002: mus: Show USER_PRIVATE window container during views tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@widgetinteractive
Patch Set: rebase, fix linux Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/mus/views_mus_test_suite.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 915
916 Widget* modal_dialog_widget = views::DialogDelegate::CreateDialogWidget( 916 Widget* modal_dialog_widget = views::DialogDelegate::CreateDialogWidget(
917 dialog_delegate, NULL, top_level_widget.GetNativeView()); 917 dialog_delegate, NULL, top_level_widget.GetNativeView());
918 modal_dialog_widget->SetBounds(gfx::Rect(100, 100, 200, 200)); 918 modal_dialog_widget->SetBounds(gfx::Rect(100, 100, 200, 200));
919 919
920 // Note the dialog widget doesn't need a ShowSync. Since it is modal, it gains 920 // Note the dialog widget doesn't need a ShowSync. Since it is modal, it gains
921 // active status synchronously, even on Mac. 921 // active status synchronously, even on Mac.
922 modal_dialog_widget->Show(); 922 modal_dialog_widget->Show();
923 923
924 gfx::NativeView modal_native_view = modal_dialog_widget->GetNativeView(); 924 gfx::NativeView modal_native_view = modal_dialog_widget->GetNativeView();
925 EXPECT_EQ(3u, focus_changes.size()); 925 ASSERT_EQ(3u, focus_changes.size());
926 EXPECT_EQ(nullptr, focus_changes[1]); 926 EXPECT_EQ(nullptr, focus_changes[1]);
927 EXPECT_EQ(modal_native_view, focus_changes[2]); 927 EXPECT_EQ(modal_native_view, focus_changes[2]);
928 928
929 #if defined(OS_MACOSX) 929 #if defined(OS_MACOSX)
930 // Window modal dialogs on Mac are "sheets", which animate to close before 930 // Window modal dialogs on Mac are "sheets", which animate to close before
931 // activating their parent widget. 931 // activating their parent widget.
932 WidgetActivationWaiter waiter(&top_level_widget, true); 932 WidgetActivationWaiter waiter(&top_level_widget, true);
933 modal_dialog_widget->Close(); 933 modal_dialog_widget->Close();
934 waiter.Wait(); 934 waiter.Wait();
935 #else 935 #else
936 modal_dialog_widget->CloseNow(); 936 modal_dialog_widget->CloseNow();
937 #endif 937 #endif
938 938
939 EXPECT_EQ(5u, focus_changes.size()); 939 ASSERT_EQ(5u, focus_changes.size());
940 EXPECT_EQ(nullptr, focus_changes[3]); 940 EXPECT_EQ(nullptr, focus_changes[3]);
941 EXPECT_EQ(top_level_native_view, focus_changes[4]); 941 EXPECT_EQ(top_level_native_view, focus_changes[4]);
942 942
943 top_level_widget.CloseNow(); 943 top_level_widget.CloseNow();
944 WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(&focus_listener); 944 WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(&focus_listener);
945 } 945 }
946 946
947 // Disabled on Mac. Desktop Mac doesn't have system modal windows since Carbon 947 // Disabled on Mac. Desktop Mac doesn't have system modal windows since Carbon
948 // was deprecated. It does have application modal windows, but only Ash requests 948 // was deprecated. It does have application modal windows, but only Ash requests
949 // those. 949 // those.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 CreatePlatformDesktopNativeWidgetImpl(init_params, &widget, nullptr); 1013 CreatePlatformDesktopNativeWidgetImpl(init_params, &widget, nullptr);
1014 widget.Init(init_params); 1014 widget.Init(init_params);
1015 1015
1016 widget.Show(); 1016 widget.Show();
1017 EXPECT_FALSE(widget.IsActive()); 1017 EXPECT_FALSE(widget.IsActive());
1018 } 1018 }
1019 1019
1020 #if defined(USE_AURA) 1020 #if defined(USE_AURA)
1021 // Test that touch selection quick menu is not activated when opened. 1021 // Test that touch selection quick menu is not activated when opened.
1022 TEST_F(WidgetTestInteractive, TouchSelectionQuickMenuIsNotActivated) { 1022 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) 1023 #if defined(OS_WIN)
1029 views_delegate()->set_use_desktop_native_widgets(true); 1024 views_delegate()->set_use_desktop_native_widgets(true);
1030 #endif // !defined(OS_WIN) 1025 #endif // !defined(OS_WIN)
1031 1026
1032 Widget* widget = CreateWidget(); 1027 Widget* widget = CreateWidget();
1033 1028
1034 Textfield* textfield = new Textfield; 1029 Textfield* textfield = new Textfield;
1035 textfield->SetBounds(0, 0, 200, 20); 1030 textfield->SetBounds(0, 0, 200, 20);
1036 textfield->SetText(base::ASCIIToUTF16("some text")); 1031 textfield->SetText(base::ASCIIToUTF16("some text"));
1037 widget->GetRootView()->AddChildView(textfield); 1032 widget->GetRootView()->AddChildView(textfield);
(...skipping 11 matching lines...) Expand all
1049 textfield_test_api.touch_selection_controller())); 1044 textfield_test_api.touch_selection_controller()));
1050 1045
1051 EXPECT_TRUE(textfield->HasFocus()); 1046 EXPECT_TRUE(textfield->HasFocus());
1052 EXPECT_TRUE(widget->IsActive()); 1047 EXPECT_TRUE(widget->IsActive());
1053 EXPECT_TRUE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); 1048 EXPECT_TRUE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning());
1054 widget->CloseNow(); 1049 widget->CloseNow();
1055 } 1050 }
1056 #endif // defined(USE_AURA) 1051 #endif // defined(USE_AURA)
1057 1052
1058 TEST_F(WidgetTestInteractive, DisableViewDoesNotActivateWidget) { 1053 TEST_F(WidgetTestInteractive, DisableViewDoesNotActivateWidget) {
1059 // Fails on mus because the USER_PRIVATE window container is not visible by 1054 // Times out on mus. See http://crbug.com/612193
1060 // default. See http://crbug.com/611601
1061 if (IsMus()) 1055 if (IsMus())
1062 return; 1056 return;
1063 1057
1064 #if defined(OS_WIN) 1058 #if defined(OS_WIN)
1065 views_delegate()->set_use_desktop_native_widgets(true); 1059 views_delegate()->set_use_desktop_native_widgets(true);
1066 #endif // !defined(OS_WIN) 1060 #endif // !defined(OS_WIN)
1067 1061
1068 // Create first widget and view, activate the widget, and focus the view. 1062 // Create first widget and view, activate the widget, and focus the view.
1069 Widget widget1; 1063 Widget widget1;
1070 Widget::InitParams params1 = CreateParams(Widget::InitParams::TYPE_POPUP); 1064 Widget::InitParams params1 = CreateParams(Widget::InitParams::TYPE_POPUP);
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 1794
1801 ui::KeyEvent key_event2(key_event); 1795 ui::KeyEvent key_event2(key_event);
1802 widget->OnKeyEvent(&key_event2); 1796 widget->OnKeyEvent(&key_event2);
1803 EXPECT_FALSE(key_event2.stopped_propagation()); 1797 EXPECT_FALSE(key_event2.stopped_propagation());
1804 1798
1805 widget->CloseNow(); 1799 widget->CloseNow();
1806 } 1800 }
1807 1801
1808 } // namespace test 1802 } // namespace test
1809 } // namespace views 1803 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/views_mus_test_suite.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698