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

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

Issue 10696148: Move TabStripModelDelegate off Browser into its own class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 ui_test_utils::HideNativeWindow(window); 273 ui_test_utils::HideNativeWindow(window);
274 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window)); 274 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window));
275 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); 275 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_));
276 276
277 // The rest of this test does not make sense on Linux because the behavior 277 // The rest of this test does not make sense on Linux because the behavior
278 // of Activate() is not well defined and can vary by window manager. 278 // of Activate() is not well defined and can vary by window manager.
279 #if defined(OS_WIN) 279 #if defined(OS_WIN)
280 // Open a new browser window. 280 // Open a new browser window.
281 Browser* browser2 = Browser::Create(browser()->profile()); 281 Browser* browser2 = Browser::Create(browser()->profile());
282 ASSERT_TRUE(browser2); 282 ASSERT_TRUE(browser2);
283 browser2->tab_strip_model()->delegate()->AddBlankTab(true); 283 chrome::AddBlankTab(browser2, true);
284 browser2->window()->Show(); 284 browser2->window()->Show();
285 ui_test_utils::NavigateToURL(browser2, url); 285 ui_test_utils::NavigateToURL(browser2, url);
286 286
287 gfx::NativeWindow window2 = browser2->window()->GetNativeWindow(); 287 gfx::NativeWindow window2 = browser2->window()->GetNativeWindow();
288 BrowserView* browser_view2 = 288 BrowserView* browser_view2 =
289 BrowserView::GetBrowserViewForBrowser(browser2); 289 BrowserView::GetBrowserViewForBrowser(browser2);
290 ASSERT_TRUE(browser_view2); 290 ASSERT_TRUE(browser_view2);
291 const views::Widget* widget2 = 291 const views::Widget* widget2 =
292 views::Widget::GetWidgetForNativeWindow(window2); 292 views::Widget::GetWidgetForNativeWindow(window2);
293 ASSERT_TRUE(widget2); 293 ASSERT_TRUE(widget2);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // Background window does not steal focus. 427 // Background window does not steal focus.
428 // Flaky, http://crbug.com/62538. 428 // Flaky, http://crbug.com/62538.
429 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, 429 IN_PROC_BROWSER_TEST_F(BrowserFocusTest,
430 DISABLED_BackgroundBrowserDontStealFocus) { 430 DISABLED_BackgroundBrowserDontStealFocus) {
431 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 431 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
432 ASSERT_TRUE(test_server()->Start()); 432 ASSERT_TRUE(test_server()->Start());
433 433
434 // Open a new browser window. 434 // Open a new browser window.
435 Browser* browser2 = Browser::Create(browser()->profile()); 435 Browser* browser2 = Browser::Create(browser()->profile());
436 ASSERT_TRUE(browser2); 436 ASSERT_TRUE(browser2);
437 browser2->tab_strip_model()->delegate()->AddBlankTab(true); 437 chrome::AddBlankTab(browser2, true);
438 browser2->window()->Show(); 438 browser2->window()->Show();
439 439
440 Browser* focused_browser = NULL; 440 Browser* focused_browser = NULL;
441 Browser* unfocused_browser = NULL; 441 Browser* unfocused_browser = NULL;
442 #if defined(USE_X11) 442 #if defined(USE_X11)
443 // On X11, calling Activate() is not guaranteed to move focus, so we have 443 // On X11, calling Activate() is not guaranteed to move focus, so we have
444 // to figure out which browser does have focus. 444 // to figure out which browser does have focus.
445 if (browser2->window()->IsActive()) { 445 if (browser2->window()->IsActive()) {
446 focused_browser = browser2; 446 focused_browser = browser2;
447 unfocused_browser = browser(); 447 unfocused_browser = browser();
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 chrome::Reload(browser(), CURRENT_TAB); 927 chrome::Reload(browser(), CURRENT_TAB);
928 observer.Wait(); 928 observer.Wait();
929 } 929 }
930 930
931 // Focus should now be on the tab contents. 931 // Focus should now be on the tab contents.
932 chrome::ShowDownloads(browser()); 932 chrome::ShowDownloads(browser());
933 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 933 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
934 } 934 }
935 935
936 } // namespace 936 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/extensions/extension_install_ui_default.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698