Commit 69bdf142 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Enable a views desktop widget test on Chrome OS.

DesktopWidgetTestInteractive.WindowModalWindowDestroyedActivationTest
works with a slight tweak. To provide full coverage, we will probably
want to add more unit tests to WindowTreeClient (a lot of which are
disabled right now).

Bug: 916272
Change-Id: I0e04a651ea7cadbce4a96c060cc9cc762ca56400
Reviewed-on: https://chromium-review.googlesource.com/c/1457118
Commit-Queue: Scott Violet <sky@chromium.org>
Auto-Submit: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630168}
parent 693df943
...@@ -998,7 +998,6 @@ TEST_F(WidgetTestInteractive, FullscreenMaximizedWindowBounds) { ...@@ -998,7 +998,6 @@ TEST_F(WidgetTestInteractive, FullscreenMaximizedWindowBounds) {
} }
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#if !defined(OS_CHROMEOS)
// Provides functionality to create a window modal dialog. // Provides functionality to create a window modal dialog.
class ModalDialogDelegate : public DialogDelegateView { class ModalDialogDelegate : public DialogDelegateView {
public: public:
...@@ -1039,9 +1038,15 @@ TEST_F(DesktopWidgetTestInteractive, WindowModalWindowDestroyedActivationTest) { ...@@ -1039,9 +1038,15 @@ TEST_F(DesktopWidgetTestInteractive, WindowModalWindowDestroyedActivationTest) {
EXPECT_EQ(top_level_native_view, focus_changes[0]); EXPECT_EQ(top_level_native_view, focus_changes[0]);
// Create a modal dialog. // Create a modal dialog.
ui::ModalType modal_type = ui::MODAL_TYPE_WINDOW;
#if defined(OS_CHROMEOS)
// On Chrome OS this only works for MODAL_TYPE_CHILD, which makes a widget
// backed by NativeWidgetAura. Restoring focus to the parent window from a
// closed MODAL_TYPE_WINDOW requires help from the window service.
modal_type = ui::MODAL_TYPE_CHILD;
#endif
// This instance will be destroyed when the dialog is destroyed. // This instance will be destroyed when the dialog is destroyed.
ModalDialogDelegate* dialog_delegate = ModalDialogDelegate* dialog_delegate = new ModalDialogDelegate(modal_type);
new ModalDialogDelegate(ui::MODAL_TYPE_WINDOW);
Widget* modal_dialog_widget = views::DialogDelegate::CreateDialogWidget( Widget* modal_dialog_widget = views::DialogDelegate::CreateDialogWidget(
dialog_delegate, NULL, top_level_widget.GetNativeView()); dialog_delegate, NULL, top_level_widget.GetNativeView());
...@@ -1078,6 +1083,11 @@ TEST_F(DesktopWidgetTestInteractive, WindowModalWindowDestroyedActivationTest) { ...@@ -1078,6 +1083,11 @@ TEST_F(DesktopWidgetTestInteractive, WindowModalWindowDestroyedActivationTest) {
// was deprecated. It does have application modal windows, but only Ash requests // was deprecated. It does have application modal windows, but only Ash requests
// those. // those.
#if defined(OS_MACOSX) && !defined(USE_AURA) #if defined(OS_MACOSX) && !defined(USE_AURA)
#define MAYBE_SystemModalWindowReleasesCapture \
DISABLED_SystemModalWindowReleasesCapture
#elif defined(OS_CHROMEOS)
// Investigate enabling for Chrome OS. It probably requires help from the window
// service.
#define MAYBE_SystemModalWindowReleasesCapture \ #define MAYBE_SystemModalWindowReleasesCapture \
DISABLED_SystemModalWindowReleasesCapture DISABLED_SystemModalWindowReleasesCapture
#else #else
...@@ -1124,8 +1134,6 @@ TEST_F(DesktopWidgetTestInteractive, MAYBE_SystemModalWindowReleasesCapture) { ...@@ -1124,8 +1134,6 @@ TEST_F(DesktopWidgetTestInteractive, MAYBE_SystemModalWindowReleasesCapture) {
WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(&focus_listener); WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(&focus_listener);
} }
#endif // !defined(OS_CHROMEOS)
TEST_F(DesktopWidgetTestInteractive, CanActivateFlagIsHonored) { TEST_F(DesktopWidgetTestInteractive, CanActivateFlagIsHonored) {
Widget widget; Widget widget;
Widget::InitParams init_params = Widget::InitParams init_params =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment