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

Side by Side Diff: chrome/browser/browser_focus_uitest.cc

Issue 10692195: Consolidate Browser Creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); 269 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_));
270 // Hide the window, show it again, the focus should not have changed. 270 // Hide the window, show it again, the focus should not have changed.
271 ui_test_utils::HideNativeWindow(window); 271 ui_test_utils::HideNativeWindow(window);
272 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window)); 272 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window));
273 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); 273 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_));
274 274
275 // The rest of this test does not make sense on Linux because the behavior 275 // The rest of this test does not make sense on Linux because the behavior
276 // of Activate() is not well defined and can vary by window manager. 276 // of Activate() is not well defined and can vary by window manager.
277 #if defined(OS_WIN) 277 #if defined(OS_WIN)
278 // Open a new browser window. 278 // Open a new browser window.
279 Browser* browser2 = Browser::Create(browser()->profile()); 279 Browser* browser2 = new Browser(Browser::CreateParams(browser()->profile()));
280 ASSERT_TRUE(browser2); 280 ASSERT_TRUE(browser2);
281 chrome::AddBlankTab(browser2, true); 281 chrome::AddBlankTab(browser2, true);
282 browser2->window()->Show(); 282 browser2->window()->Show();
283 ui_test_utils::NavigateToURL(browser2, url); 283 ui_test_utils::NavigateToURL(browser2, url);
284 284
285 gfx::NativeWindow window2 = browser2->window()->GetNativeWindow(); 285 gfx::NativeWindow window2 = browser2->window()->GetNativeWindow();
286 BrowserView* browser_view2 = 286 BrowserView* browser_view2 =
287 BrowserView::GetBrowserViewForBrowser(browser2); 287 BrowserView::GetBrowserViewForBrowser(browser2);
288 ASSERT_TRUE(browser_view2); 288 ASSERT_TRUE(browser_view2);
289 const views::Widget* widget2 = 289 const views::Widget* widget2 =
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 423 }
424 424
425 // Background window does not steal focus. 425 // Background window does not steal focus.
426 // Flaky, http://crbug.com/62538. 426 // Flaky, http://crbug.com/62538.
427 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, 427 IN_PROC_BROWSER_TEST_F(BrowserFocusTest,
428 DISABLED_BackgroundBrowserDontStealFocus) { 428 DISABLED_BackgroundBrowserDontStealFocus) {
429 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 429 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
430 ASSERT_TRUE(test_server()->Start()); 430 ASSERT_TRUE(test_server()->Start());
431 431
432 // Open a new browser window. 432 // Open a new browser window.
433 Browser* browser2 = Browser::Create(browser()->profile()); 433 Browser* browser2 = new Browser(Browser::CreateParams(browser()->profile()));
434 ASSERT_TRUE(browser2); 434 ASSERT_TRUE(browser2);
435 chrome::AddBlankTab(browser2, true); 435 chrome::AddBlankTab(browser2, true);
436 browser2->window()->Show(); 436 browser2->window()->Show();
437 437
438 Browser* focused_browser = NULL; 438 Browser* focused_browser = NULL;
439 Browser* unfocused_browser = NULL; 439 Browser* unfocused_browser = NULL;
440 #if defined(USE_X11) 440 #if defined(USE_X11)
441 // On X11, calling Activate() is not guaranteed to move focus, so we have 441 // On X11, calling Activate() is not guaranteed to move focus, so we have
442 // to figure out which browser does have focus. 442 // to figure out which browser does have focus.
443 if (browser2->window()->IsActive()) { 443 if (browser2->window()->IsActive()) {
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 chrome::Reload(browser(), CURRENT_TAB); 925 chrome::Reload(browser(), CURRENT_TAB);
926 observer.Wait(); 926 observer.Wait();
927 } 927 }
928 928
929 // Focus should now be on the tab contents. 929 // Focus should now be on the tab contents.
930 chrome::ShowDownloads(browser()); 930 chrome::ShowDownloads(browser());
931 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 931 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
932 } 932 }
933 933
934 } // namespace 934 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/captive_portal/captive_portal_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698