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

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

Issue 1814002: Remove deprecated things from net test suite: (Closed)
Patch Set: Created 10 years, 7 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "chrome/browser/automation/ui_controls.h" 10 #include "chrome/browser/automation/ui_controls.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #define MAYBE_FocusTraversalOnInterstitial FocusTraversalOnInterstitial 43 #define MAYBE_FocusTraversalOnInterstitial FocusTraversalOnInterstitial
44 #define MAYBE_TabsRememberFocusFindInPage TabsRememberFocusFindInPage 44 #define MAYBE_TabsRememberFocusFindInPage TabsRememberFocusFindInPage
45 #endif 45 #endif
46 46
47 namespace { 47 namespace {
48 48
49 // The delay waited in some cases where we don't have a notifications for an 49 // The delay waited in some cases where we don't have a notifications for an
50 // action we take. 50 // action we take.
51 const int kActionDelayMs = 500; 51 const int kActionDelayMs = 500;
52 52
53 const wchar_t kSimplePage[] = L"files/focus/page_with_focus.html"; 53 const char kSimplePage[] = "files/focus/page_with_focus.html";
54 const wchar_t kStealFocusPage[] = L"files/focus/page_steals_focus.html"; 54 const char kStealFocusPage[] = "files/focus/page_steals_focus.html";
55 const wchar_t kTypicalPage[] = L"files/focus/typical_page.html"; 55 const char kTypicalPage[] = "files/focus/typical_page.html";
56 const char kTypicalPageName[] = "typical_page.html"; 56 const char kTypicalPageName[] = "typical_page.html";
57 57
58 class BrowserFocusTest : public InProcessBrowserTest { 58 class BrowserFocusTest : public InProcessBrowserTest {
59 public: 59 public:
60 BrowserFocusTest() { 60 BrowserFocusTest() {
61 set_show_window(true); 61 set_show_window(true);
62 EnableDOMAutomation(); 62 EnableDOMAutomation();
63 } 63 }
64 64
65 bool IsViewFocused(ViewID vid) { 65 bool IsViewFocused(ViewID vid) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 185 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
186 186
187 ClickOnView(VIEW_ID_LOCATION_BAR); 187 ClickOnView(VIEW_ID_LOCATION_BAR);
188 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); 188 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
189 } 189 }
190 190
191 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BrowsersRememberFocus) { 191 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BrowsersRememberFocus) {
192 HTTPTestServer* server = StartHTTPServer(); 192 HTTPTestServer* server = StartHTTPServer();
193 193
194 // First we navigate to our test page. 194 // First we navigate to our test page.
195 GURL url = server->TestServerPageW(kSimplePage); 195 GURL url = server->TestServerPage(kSimplePage);
196 ui_test_utils::NavigateToURL(browser(), url); 196 ui_test_utils::NavigateToURL(browser(), url);
197 197
198 gfx::NativeWindow window = browser()->window()->GetNativeHandle(); 198 gfx::NativeWindow window = browser()->window()->GetNativeHandle();
199 199
200 // The focus should be on the Tab contents. 200 // The focus should be on the Tab contents.
201 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 201 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
202 // Now hide the window, show it again, the focus should not have changed. 202 // Now hide the window, show it again, the focus should not have changed.
203 HideNativeWindow(window); 203 HideNativeWindow(window);
204 ShowNativeWindow(window); 204 ShowNativeWindow(window);
205 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 205 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // Close the 2nd browser to avoid a DCHECK(). 248 // Close the 2nd browser to avoid a DCHECK().
249 browser_view2->Close(); 249 browser_view2->Close();
250 #endif 250 #endif
251 } 251 }
252 252
253 // Tabs remember focus. 253 // Tabs remember focus.
254 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabsRememberFocus) { 254 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabsRememberFocus) {
255 HTTPTestServer* server = StartHTTPServer(); 255 HTTPTestServer* server = StartHTTPServer();
256 256
257 // First we navigate to our test page. 257 // First we navigate to our test page.
258 GURL url = server->TestServerPageW(kSimplePage); 258 GURL url = server->TestServerPage(kSimplePage);
259 ui_test_utils::NavigateToURL(browser(), url); 259 ui_test_utils::NavigateToURL(browser(), url);
260 260
261 // Create several tabs. 261 // Create several tabs.
262 for (int i = 0; i < 4; ++i) { 262 for (int i = 0; i < 4; ++i) {
263 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1, 263 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
264 Browser::ADD_SELECTED, NULL, std::string()); 264 Browser::ADD_SELECTED, NULL, std::string());
265 } 265 }
266 266
267 // Alternate focus for the tab. 267 // Alternate focus for the tab.
268 const bool kFocusPage[3][5] = { 268 const bool kFocusPage[3][5] = {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 ui_test_utils::RunMessageLoop(); 322 ui_test_utils::RunMessageLoop();
323 } 323 }
324 } 324 }
325 } 325 }
326 326
327 // Tabs remember focus with find-in-page box. 327 // Tabs remember focus with find-in-page box.
328 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocusFindInPage) { 328 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocusFindInPage) {
329 HTTPTestServer* server = StartHTTPServer(); 329 HTTPTestServer* server = StartHTTPServer();
330 330
331 // First we navigate to our test page. 331 // First we navigate to our test page.
332 GURL url = server->TestServerPageW(kSimplePage); 332 GURL url = server->TestServerPage(kSimplePage);
333 ui_test_utils::NavigateToURL(browser(), url); 333 ui_test_utils::NavigateToURL(browser(), url);
334 334
335 browser()->Find(); 335 browser()->Find();
336 ui_test_utils::FindInPage(browser()->GetSelectedTabContents(), 336 ui_test_utils::FindInPage(browser()->GetSelectedTabContents(),
337 ASCIIToUTF16("a"), true, false, NULL); 337 ASCIIToUTF16("a"), true, false, NULL);
338 ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); 338 ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
339 339
340 // Focus the location bar. 340 // Focus the location bar.
341 browser()->FocusLocationBar(); 341 browser()->FocusLocationBar();
342 342
(...skipping 17 matching lines...) Expand all
360 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 360 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
361 browser()->SelectTabContentsAt(0, true); 361 browser()->SelectTabContentsAt(0, true);
362 ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); 362 ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
363 } 363 }
364 364
365 // Background window does not steal focus. 365 // Background window does not steal focus.
366 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) { 366 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) {
367 HTTPTestServer* server = StartHTTPServer(); 367 HTTPTestServer* server = StartHTTPServer();
368 368
369 // First we navigate to our test page. 369 // First we navigate to our test page.
370 GURL url = server->TestServerPageW(kSimplePage); 370 GURL url = server->TestServerPage(kSimplePage);
371 ui_test_utils::NavigateToURL(browser(), url); 371 ui_test_utils::NavigateToURL(browser(), url);
372 372
373 // Open a new browser window. 373 // Open a new browser window.
374 Browser* browser2 = Browser::Create(browser()->profile()); 374 Browser* browser2 = Browser::Create(browser()->profile());
375 ASSERT_TRUE(browser2); 375 ASSERT_TRUE(browser2);
376 browser2->tabstrip_model()->delegate()->AddBlankTab(true); 376 browser2->tabstrip_model()->delegate()->AddBlankTab(true);
377 browser2->window()->Show(); 377 browser2->window()->Show();
378 378
379 Browser* focused_browser = NULL; 379 Browser* focused_browser = NULL;
380 Browser* unfocused_browser = NULL; 380 Browser* unfocused_browser = NULL;
381 #if defined(USE_X11) 381 #if defined(USE_X11)
382 // On X11, calling Activate() is not guaranteed to move focus, so we have 382 // On X11, calling Activate() is not guaranteed to move focus, so we have
383 // to figure out which browser does have focus. 383 // to figure out which browser does have focus.
384 if (browser2->window()->IsActive()) { 384 if (browser2->window()->IsActive()) {
385 focused_browser = browser2; 385 focused_browser = browser2;
386 unfocused_browser = browser(); 386 unfocused_browser = browser();
387 } else if (browser()->window()->IsActive()) { 387 } else if (browser()->window()->IsActive()) {
388 focused_browser = browser(); 388 focused_browser = browser();
389 unfocused_browser = browser2; 389 unfocused_browser = browser2;
390 } else { 390 } else {
391 ASSERT_TRUE(false); 391 ASSERT_TRUE(false);
392 } 392 }
393 #elif defined(OS_WIN) 393 #elif defined(OS_WIN)
394 focused_browser = browser(); 394 focused_browser = browser();
395 unfocused_browser = browser2; 395 unfocused_browser = browser2;
396 #endif 396 #endif
397 397
398 GURL steal_focus_url = server->TestServerPageW(kStealFocusPage); 398 GURL steal_focus_url = server->TestServerPage(kStealFocusPage);
399 ui_test_utils::NavigateToURL(unfocused_browser, steal_focus_url); 399 ui_test_utils::NavigateToURL(unfocused_browser, steal_focus_url);
400 400
401 // Activate the first browser. 401 // Activate the first browser.
402 focused_browser->window()->Activate(); 402 focused_browser->window()->Activate();
403 403
404 // Wait for the focus to be stolen by the other browser. 404 // Wait for the focus to be stolen by the other browser.
405 MessageLoop::current()->PostDelayedTask( 405 MessageLoop::current()->PostDelayedTask(
406 FROM_HERE, new MessageLoop::QuitTask(), 2000); 406 FROM_HERE, new MessageLoop::QuitTask(), 2000);
407 ui_test_utils::RunMessageLoop(); 407 ui_test_utils::RunMessageLoop();
408 408
409 // Make sure the first browser is still active. 409 // Make sure the first browser is still active.
410 EXPECT_TRUE(focused_browser->window()->IsActive()); 410 EXPECT_TRUE(focused_browser->window()->IsActive());
411 411
412 // Close the 2nd browser to avoid a DCHECK(). 412 // Close the 2nd browser to avoid a DCHECK().
413 browser2->window()->Close(); 413 browser2->window()->Close();
414 } 414 }
415 415
416 // Page cannot steal focus when focus is on location bar. 416 // Page cannot steal focus when focus is on location bar.
417 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) { 417 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) {
418 HTTPTestServer* server = StartHTTPServer(); 418 HTTPTestServer* server = StartHTTPServer();
419 419
420 // Open the page that steals focus. 420 // Open the page that steals focus.
421 GURL url = server->TestServerPageW(kStealFocusPage); 421 GURL url = server->TestServerPage(kStealFocusPage);
422 ui_test_utils::NavigateToURL(browser(), url); 422 ui_test_utils::NavigateToURL(browser(), url);
423 423
424 browser()->FocusLocationBar(); 424 browser()->FocusLocationBar();
425 425
426 // Wait for the page to steal focus. 426 // Wait for the page to steal focus.
427 PlatformThread::Sleep(2000); 427 PlatformThread::Sleep(2000);
428 428
429 // Make sure the location bar is still focused. 429 // Make sure the location bar is still focused.
430 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); 430 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
431 } 431 }
432 432
433 // Focus traversal on a regular page. 433 // Focus traversal on a regular page.
434 // Note that this test relies on a notification from the renderer that the 434 // Note that this test relies on a notification from the renderer that the
435 // focus has changed in the page. The notification in the renderer may change 435 // focus has changed in the page. The notification in the renderer may change
436 // at which point this test would fail (see comment in 436 // at which point this test would fail (see comment in
437 // RenderWidget::didFocus()). 437 // RenderWidget::didFocus()).
438 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusTraversal) { 438 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusTraversal) {
439 HTTPTestServer* server = StartHTTPServer(); 439 HTTPTestServer* server = StartHTTPServer();
440 440
441 // First we navigate to our test page. 441 // First we navigate to our test page.
442 GURL url = server->TestServerPageW(kTypicalPage); 442 GURL url = server->TestServerPage(kTypicalPage);
443 ui_test_utils::NavigateToURL(browser(), url); 443 ui_test_utils::NavigateToURL(browser(), url);
444 444
445 browser()->FocusLocationBar(); 445 browser()->FocusLocationBar();
446 446
447 const char* kExpElementIDs[] = { 447 const char* kExpElementIDs[] = {
448 "", // Initially no element in the page should be focused 448 "", // Initially no element in the page should be focused
449 // (the location bar is focused). 449 // (the location bar is focused).
450 "textEdit", "searchButton", "luckyButton", "googleLink", "gmailLink", 450 "textEdit", "searchButton", "luckyButton", "googleLink", "gmailLink",
451 "gmapLink" 451 "gmapLink"
452 }; 452 };
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 // We need to run the message loop to process it. 524 // We need to run the message loop to process it.
525 ui_test_utils::RunAllPendingInMessageLoop(); 525 ui_test_utils::RunAllPendingInMessageLoop();
526 } 526 }
527 } 527 }
528 528
529 // Focus traversal while an interstitial is showing. 529 // Focus traversal while an interstitial is showing.
530 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { 530 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) {
531 HTTPTestServer* server = StartHTTPServer(); 531 HTTPTestServer* server = StartHTTPServer();
532 532
533 // First we navigate to our test page. 533 // First we navigate to our test page.
534 GURL url = server->TestServerPageW(kSimplePage); 534 GURL url = server->TestServerPage(kSimplePage);
535 ui_test_utils::NavigateToURL(browser(), url); 535 ui_test_utils::NavigateToURL(browser(), url);
536 536
537 // Focus should be on the page. 537 // Focus should be on the page.
538 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 538 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
539 539
540 // Let's show an interstitial. 540 // Let's show an interstitial.
541 TestInterstitialPage* interstitial_page = 541 TestInterstitialPage* interstitial_page =
542 new TestInterstitialPage(browser()->GetSelectedTabContents(), 542 new TestInterstitialPage(browser()->GetSelectedTabContents(),
543 true, GURL("http://interstitial.com")); 543 true, GURL("http://interstitial.com"));
544 interstitial_page->Show(); 544 interstitial_page->Show();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // We need to run the message loop to process it. 614 // We need to run the message loop to process it.
615 ui_test_utils::RunAllPendingInMessageLoop(); 615 ui_test_utils::RunAllPendingInMessageLoop();
616 } 616 }
617 } 617 }
618 618
619 // Focus stays on page with interstitials. 619 // Focus stays on page with interstitials.
620 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, InterstitialFocus) { 620 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, InterstitialFocus) {
621 HTTPTestServer* server = StartHTTPServer(); 621 HTTPTestServer* server = StartHTTPServer();
622 622
623 // First we navigate to our test page. 623 // First we navigate to our test page.
624 GURL url = server->TestServerPageW(kSimplePage); 624 GURL url = server->TestServerPage(kSimplePage);
625 ui_test_utils::NavigateToURL(browser(), url); 625 ui_test_utils::NavigateToURL(browser(), url);
626 626
627 // Page should have focus. 627 // Page should have focus.
628 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 628 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
629 EXPECT_TRUE(browser()->GetSelectedTabContents()->render_view_host()->view()-> 629 EXPECT_TRUE(browser()->GetSelectedTabContents()->render_view_host()->view()->
630 HasFocus()); 630 HasFocus());
631 631
632 // Let's show an interstitial. 632 // Let's show an interstitial.
633 TestInterstitialPage* interstitial_page = 633 TestInterstitialPage* interstitial_page =
634 new TestInterstitialPage(browser()->GetSelectedTabContents(), 634 new TestInterstitialPage(browser()->GetSelectedTabContents(),
(...skipping 14 matching lines...) Expand all
649 649
650 // Focus should be back on the original page. 650 // Focus should be back on the original page.
651 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 651 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
652 } 652 }
653 653
654 // Make sure Find box can request focus, even when it is already open. 654 // Make sure Find box can request focus, even when it is already open.
655 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) { 655 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) {
656 HTTPTestServer* server = StartHTTPServer(); 656 HTTPTestServer* server = StartHTTPServer();
657 657
658 // Open some page (any page that doesn't steal focus). 658 // Open some page (any page that doesn't steal focus).
659 GURL url = server->TestServerPageW(kTypicalPage); 659 GURL url = server->TestServerPage(kTypicalPage);
660 ui_test_utils::NavigateToURL(browser(), url); 660 ui_test_utils::NavigateToURL(browser(), url);
661 661
662 gfx::NativeWindow window = browser()->window()->GetNativeHandle(); 662 gfx::NativeWindow window = browser()->window()->GetNativeHandle();
663 663
664 // Press Ctrl+F, which will make the Find box open and request focus. 664 // Press Ctrl+F, which will make the Find box open and request focus.
665 ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_F, true, 665 ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_F, true,
666 false, false, 666 false, false,
667 new MessageLoop::QuitTask()); 667 new MessageLoop::QuitTask());
668 ui_test_utils::RunMessageLoop(); 668 ui_test_utils::RunMessageLoop();
669 669
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 browser()->NewTab(); 736 browser()->NewTab();
737 737
738 ui_test_utils::RunAllPendingInMessageLoop(); 738 ui_test_utils::RunAllPendingInMessageLoop();
739 739
740 browser()->Reload(); 740 browser()->Reload();
741 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); 741 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
742 // Focus should stay on the location bar. 742 // Focus should stay on the location bar.
743 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); 743 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
744 744
745 // Open a regular page, focus the location bar, reload. 745 // Open a regular page, focus the location bar, reload.
746 ui_test_utils::NavigateToURL(browser(), server->TestServerPageW(kSimplePage)); 746 ui_test_utils::NavigateToURL(browser(), server->TestServerPage(kSimplePage));
747 browser()->FocusLocationBar(); 747 browser()->FocusLocationBar();
748 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); 748 ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
749 browser()->Reload(); 749 browser()->Reload();
750 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); 750 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
751 // Focus should now be on the tab contents. 751 // Focus should now be on the tab contents.
752 browser()->ShowDownloadsTab(); 752 browser()->ShowDownloadsTab();
753 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 753 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
754 } 754 }
755 755
756 // Tests that focus goes where expected when using reload on a crashed tab. 756 // Tests that focus goes where expected when using reload on a crashed tab.
757 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReloadCrashedTab) { 757 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReloadCrashedTab) {
758 HTTPTestServer* server = StartHTTPServer(); 758 HTTPTestServer* server = StartHTTPServer();
759 759
760 // Open a regular page, crash, reload. 760 // Open a regular page, crash, reload.
761 ui_test_utils::NavigateToURL(browser(), server->TestServerPageW(kSimplePage)); 761 ui_test_utils::NavigateToURL(browser(), server->TestServerPage(kSimplePage));
762 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); 762 ui_test_utils::CrashTab(browser()->GetSelectedTabContents());
763 browser()->Reload(); 763 browser()->Reload();
764 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); 764 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
765 // Focus should now be on the tab contents. 765 // Focus should now be on the tab contents.
766 browser()->ShowDownloadsTab(); 766 browser()->ShowDownloadsTab();
767 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 767 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
768 } 768 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_keyevents_browsertest.cc » ('j') | chrome/browser/history/redirect_uitest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698