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

Side by Side Diff: chrome/browser/ui/libgtk2ui/select_file_dialog_interactive_uitest.cc

Issue 1594973009: Revert of Make File-Picker modal on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge-fix Created 4 years, 11 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.h" 5 #include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 int index, 94 int index,
95 void* params) override {} 95 void* params) override {}
96 private: 96 private:
97 // Dialog box used for opening and saving files. 97 // Dialog box used for opening and saving files.
98 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; 98 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(FilePicker); 100 DISALLOW_COPY_AND_ASSIGN(FilePicker);
101 }; 101 };
102 102
103 } // namespace libgtk2ui 103 } // namespace libgtk2ui
104
105 // Test that the file-picker is modal.
106 IN_PROC_BROWSER_TEST_F(BrowserSelectFileDialogTest, ModalTest) {
107 // Bring the native window to the foreground. Returns true on success.
108 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
109 ASSERT_TRUE(browser()->window()->IsActive());
110
111 // Leaks in GtkFileChooserDialog. http://crbug.com/537468
112 ANNOTATE_SCOPED_MEMORY_LEAK;
113 libgtk2ui::FilePicker file_picker(browser()->window());
114
115 gfx::NativeWindow window = browser()->window()->GetNativeWindow();
116 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window);
117 ASSERT_NE(nullptr, widget);
118
119 // Run a nested loop until the browser window becomes inactive
120 // so that the file-picker can be active.
121 WidgetActivationWaiter waiter_inactive(widget, false);
122 waiter_inactive.Wait();
123 EXPECT_FALSE(browser()->window()->IsActive());
124
125 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER);
126 // The window should not get focus due to modal dialog.
127 EXPECT_FALSE(browser()->window()->IsActive());
128
129 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
130 EXPECT_FALSE(browser()->window()->IsActive());
131
132 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window));
133 EXPECT_FALSE(browser()->window()->IsActive());
134
135 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
136 browser(), ui::VKEY_TAB, false, false, true, false));
137 EXPECT_FALSE(browser()->window()->IsActive());
138
139 file_picker.Close();
140
141 // Run a nested loop until the browser window becomes active.
142 WidgetActivationWaiter wait_active(widget, true);
143 wait_active.Wait();
144
145 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER);
146 EXPECT_TRUE(browser()->window()->IsActive());
147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698