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

Side by Side 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 nested runloop 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/run_loop.h"
10 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_commands.h" 15 #include "chrome/browser/ui/browser_commands.h"
15 #include "chrome/browser/ui/browser_tabstrip.h" 16 #include "chrome/browser/ui/browser_tabstrip.h"
16 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/browser/ui/chrome_pages.h" 18 #include "chrome/browser/ui/chrome_pages.h"
18 #include "chrome/browser/ui/find_bar/find_bar_host_unittest_util.h" 19 #include "chrome/browser/ui/find_bar/find_bar_host_unittest_util.h"
19 #include "chrome/browser/ui/location_bar/location_bar.h" 20 #include "chrome/browser/ui/location_bar/location_bar.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 231 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
231 232
232 chrome::FocusLocationBar(browser()); 233 chrome::FocusLocationBar(browser());
233 ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); 234 ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX));
234 // Hide the window, show it again, the focus should not have changed. 235 // Hide the window, show it again, the focus should not have changed.
235 ui_test_utils::HideNativeWindow(window); 236 ui_test_utils::HideNativeWindow(window);
236 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window)); 237 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window));
237 ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); 238 ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX));
238 } 239 }
239 240
241 // This test is only for Linux Desktop.
242 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
243 #define MAYBE_BrowserDialogModalTest BrowserDialogModalTest
244 #else
245 #define MAYBE_BrowserDialogModalTest DISABLE_BrowserDialogModalTest
246 #endif
247 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_BrowserDialogModalTest) {
248 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
249 const GURL url = embedded_test_server()->GetURL(kSimplePage);
250 ui_test_utils::NavigateToURL(browser(), url);
251
252 browser()->OpenFile();
253
254 base::RunLoop run_loop;
255 base::MessageLoop::current()->PostTask(
256 FROM_HERE, run_loop.QuitClosure());
257 run_loop.Run();
258
259 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(gfx::Point(100, 100)));
sadrul 2015/08/27 19:56:17 How can you tell this point is not on the open-dia
260 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(
261 ui_controls::LEFT, ui_controls::DOWN));
262 // Create and show a test interstitial page.
263 // This page should not get focus due to modal dialog.
264 TestInterstitialPage* interstitial_page = new TestInterstitialPage(
265 browser()->tab_strip_model()->GetActiveWebContents());
266 EXPECT_FALSE(interstitial_page->HasFocus());
sadrul 2015/08/27 19:56:17 Why is it necessary to open the interstitial page?
267 }
268
240 // Tabs remember focus. 269 // Tabs remember focus.
241 // Disabled, http://crbug.com/62542. 270 // Disabled, http://crbug.com/62542.
242 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { 271 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) {
243 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 272 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
244 const GURL url = embedded_test_server()->GetURL(kSimplePage); 273 const GURL url = embedded_test_server()->GetURL(kSimplePage);
245 ui_test_utils::NavigateToURL(browser(), url); 274 ui_test_utils::NavigateToURL(browser(), url);
246 275
247 // Create several tabs. 276 // Create several tabs.
248 for (int i = 0; i < 4; ++i) { 277 for (int i = 0; i < 4; ++i) {
249 chrome::AddSelectedTabWithURL(browser(), url, 278 chrome::AddSelectedTabWithURL(browser(), url,
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 730 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
702 content::NotificationService::AllSources()); 731 content::NotificationService::AllSources());
703 chrome::GoForward(browser(), CURRENT_TAB); 732 chrome::GoForward(browser(), CURRENT_TAB);
704 forward_nav_observer.Wait(); 733 forward_nav_observer.Wait();
705 } 734 }
706 735
707 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); 736 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX));
708 } 737 }
709 738
710 } // namespace 739 } // namespace
OLDNEW
« 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