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

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

Issue 10538039: Renamed BrowserWindow::GetNativeHandle() to GetNativeWindow() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update copyrights Created 8 years, 6 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 // Flaky, http://crbug.com/69034. 249 // Flaky, http://crbug.com/69034.
250 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_BrowsersRememberFocus) { 250 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_BrowsersRememberFocus) {
251 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 251 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
252 ASSERT_TRUE(test_server()->Start()); 252 ASSERT_TRUE(test_server()->Start());
253 253
254 // First we navigate to our test page. 254 // First we navigate to our test page.
255 GURL url = test_server()->GetURL(kSimplePage); 255 GURL url = test_server()->GetURL(kSimplePage);
256 ui_test_utils::NavigateToURL(browser(), url); 256 ui_test_utils::NavigateToURL(browser(), url);
257 257
258 gfx::NativeWindow window = browser()->window()->GetNativeHandle(); 258 gfx::NativeWindow window = browser()->window()->GetNativeWindow();
259 259
260 // The focus should be on the Tab contents. 260 // The focus should be on the Tab contents.
261 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 261 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
262 // Now hide the window, show it again, the focus should not have changed. 262 // Now hide the window, show it again, the focus should not have changed.
263 ui_test_utils::HideNativeWindow(window); 263 ui_test_utils::HideNativeWindow(window);
264 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window)); 264 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window));
265 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 265 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
266 266
267 browser()->FocusLocationBar(); 267 browser()->FocusLocationBar();
268 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); 268 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_));
269 // Hide the window, show it again, the focus should not have changed. 269 // Hide the window, show it again, the focus should not have changed.
270 ui_test_utils::HideNativeWindow(window); 270 ui_test_utils::HideNativeWindow(window);
271 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window)); 271 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window));
272 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); 272 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_));
273 273
274 // The rest of this test does not make sense on Linux because the behavior 274 // The rest of this test does not make sense on Linux because the behavior
275 // of Activate() is not well defined and can vary by window manager. 275 // of Activate() is not well defined and can vary by window manager.
276 #if defined(OS_WIN) 276 #if defined(OS_WIN)
277 // Open a new browser window. 277 // Open a new browser window.
278 Browser* browser2 = Browser::Create(browser()->profile()); 278 Browser* browser2 = Browser::Create(browser()->profile());
279 ASSERT_TRUE(browser2); 279 ASSERT_TRUE(browser2);
280 browser2->tab_strip_model()->delegate()->AddBlankTab(true); 280 browser2->tab_strip_model()->delegate()->AddBlankTab(true);
281 browser2->window()->Show(); 281 browser2->window()->Show();
282 ui_test_utils::NavigateToURL(browser2, url); 282 ui_test_utils::NavigateToURL(browser2, url);
283 283
284 gfx::NativeWindow window2 = browser2->window()->GetNativeHandle(); 284 gfx::NativeWindow window2 = browser2->window()->GetNativeWindow();
285 BrowserView* browser_view2 = 285 BrowserView* browser_view2 =
286 BrowserView::GetBrowserViewForBrowser(browser2); 286 BrowserView::GetBrowserViewForBrowser(browser2);
287 ASSERT_TRUE(browser_view2); 287 ASSERT_TRUE(browser_view2);
288 const views::Widget* widget2 = 288 const views::Widget* widget2 =
289 views::Widget::GetWidgetForNativeWindow(window2); 289 views::Widget::GetWidgetForNativeWindow(window2);
290 ASSERT_TRUE(widget2); 290 ASSERT_TRUE(widget2);
291 const views::FocusManager* focus_manager2 = widget2->GetFocusManager(); 291 const views::FocusManager* focus_manager2 = widget2->GetFocusManager();
292 ASSERT_TRUE(focus_manager2); 292 ASSERT_TRUE(focus_manager2);
293 EXPECT_EQ(browser_view2->GetTabContentsContainerView(), 293 EXPECT_EQ(browser_view2->GetTabContentsContainerView(),
294 focus_manager2->GetFocusedView()); 294 focus_manager2->GetFocusedView());
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 browser()->Reload(CURRENT_TAB); 925 browser()->Reload(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 browser()->ShowDownloadsTab(); 930 browser()->ShowDownloadsTab();
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/bookmarks/bookmark_editor.cc ('k') | chrome/browser/chromeos/extensions/file_browser_handler_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698