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

Unified Diff: chrome/browser/ui/browser_focus_uitest.cc

Issue 1233913009: Make File-Picker modal on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a timeout and more tests Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_focus_uitest.cc
diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc
index 9421bed46b90843725760bf897757322f3477b46..a3b2e38c175b90c726de2cc8538cba1c185fe835 100644
--- a/chrome/browser/ui/browser_focus_uitest.cc
+++ b/chrome/browser/ui/browser_focus_uitest.cc
@@ -7,8 +7,10 @@
#include "base/format_macros.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
+#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/test/test_timeouts.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
@@ -238,6 +240,44 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_BrowsersRememberFocus) {
ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX));
}
+// This test is only for Linux Desktop.
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#define MAYBE_BrowserDialogModalTest BrowserDialogModalTest
+#else
+#define MAYBE_BrowserDialogModalTest DISABLED_BrowserDialogModalTest
+#endif
+IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_BrowserDialogModalTest) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+ const GURL url = embedded_test_server()->GetURL(kSimplePage);
+ ui_test_utils::NavigateToURL(browser(), url);
+ ASSERT_TRUE(browser()->window()->IsActive());
+
+ browser()->OpenFile();
+
+ // Insert a delay to wait until the file-picker is opened and gets focus.
+ base::RunLoop run_loop;
+ base::MessageLoop::current()->PostDelayedTask(
+ FROM_HERE, run_loop.QuitClosure(),
+ base::TimeDelta::FromMilliseconds(1000));
msw 2015/09/11 00:13:57 Hmm, hardcoded timeouts aren't good either; now th
joone 2015/09/11 23:37:12 The timeout was removed and a WidgetObserver was a
+ run_loop.Run();
+ EXPECT_FALSE(browser()->window()->IsActive());
+
+ ClickOnView(VIEW_ID_TAB_CONTAINER);
+ // The window should not get focus due to modal dialog.
+ EXPECT_FALSE(browser()->window()->IsActive());
+
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+ EXPECT_FALSE(browser()->window()->IsActive());
+
+ gfx::NativeWindow window = browser()->window()->GetNativeWindow();
+ ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window));
+ EXPECT_FALSE(browser()->window()->IsActive());
+
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
+ browser(), ui::VKEY_TAB, false, false, true, false));
+ EXPECT_FALSE(browser()->window()->IsActive());
+}
+
// Tabs remember focus.
// Disabled, http://crbug.com/62542.
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) {
« no previous file with comments | « no previous file | chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698