OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); | 365 ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); |
366 } | 366 } |
367 | 367 |
368 // Background window does not steal focus. | 368 // Background window does not steal focus. |
369 // Flaky, http://crbug.com/62538. | 369 // Flaky, http://crbug.com/62538. |
370 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, | 370 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, |
371 DISABLED_BackgroundBrowserDontStealFocus) { | 371 DISABLED_BackgroundBrowserDontStealFocus) { |
372 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 372 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
373 | 373 |
374 // Open a new browser window. | 374 // Open a new browser window. |
375 Browser* browser2 = new Browser(Browser::CreateParams(browser()->profile())); | 375 Browser* browser2 = |
| 376 new Browser(Browser::CreateParams(browser()->profile(), true)); |
376 | 377 |
377 ASSERT_TRUE(browser2); | 378 ASSERT_TRUE(browser2); |
378 chrome::AddTabAt(browser2, GURL(), -1, true); | 379 chrome::AddTabAt(browser2, GURL(), -1, true); |
379 browser2->window()->Show(); | 380 browser2->window()->Show(); |
380 | 381 |
381 Browser* focused_browser = NULL; | 382 Browser* focused_browser = NULL; |
382 Browser* unfocused_browser = NULL; | 383 Browser* unfocused_browser = NULL; |
383 #if defined(USE_X11) | 384 #if defined(USE_X11) |
384 // On X11, calling Activate() is not guaranteed to move focus, so we have | 385 // On X11, calling Activate() is not guaranteed to move focus, so we have |
385 // to figure out which browser does have focus. | 386 // to figure out which browser does have focus. |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 // omnibox focus, since the navigation occurred in a different tab. Otherwise | 765 // omnibox focus, since the navigation occurred in a different tab. Otherwise |
765 // the focus may scroll the origin out of view, making a spoof possible. | 766 // the focus may scroll the origin out of view, making a spoof possible. |
766 const std::string go_back_script = "window.opener.history.back();"; | 767 const std::string go_back_script = "window.opener.history.back();"; |
767 content::TestNavigationObserver back_observer(opener_web_contents); | 768 content::TestNavigationObserver back_observer(opener_web_contents); |
768 ASSERT_TRUE(content::ExecuteScript(new_web_contents, go_back_script)); | 769 ASSERT_TRUE(content::ExecuteScript(new_web_contents, go_back_script)); |
769 back_observer.Wait(); | 770 back_observer.Wait(); |
770 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); | 771 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); |
771 } | 772 } |
772 | 773 |
773 } // namespace | 774 } // namespace |
OLD | NEW |