| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // Now navigate the new tab to a different site. | 394 // Now navigate the new tab to a different site. |
| 395 content::WebContents* new_contents = chrome::GetActiveWebContents(browser()); | 395 content::WebContents* new_contents = chrome::GetActiveWebContents(browser()); |
| 396 ui_test_utils::NavigateToURL(browser(), | 396 ui_test_utils::NavigateToURL(browser(), |
| 397 https_server.GetURL("files/title1.html")); | 397 https_server.GetURL("files/title1.html")); |
| 398 scoped_refptr<SiteInstance> new_site_instance( | 398 scoped_refptr<SiteInstance> new_site_instance( |
| 399 new_contents->GetSiteInstance()); | 399 new_contents->GetSiteInstance()); |
| 400 EXPECT_NE(orig_site_instance, new_site_instance); | 400 EXPECT_NE(orig_site_instance, new_site_instance); |
| 401 | 401 |
| 402 // Clicking the original link in the first tab should cause us to swap back. | 402 // Clicking the original link in the first tab should cause us to swap back. |
| 403 chrome::ActivateTabAt(browser(), 0, true); | 403 chrome::ActivateTabAt(browser(), 0, true); |
| 404 ui_test_utils::WindowedNotificationObserver navigation_observer( | 404 content::WindowedNotificationObserver navigation_observer( |
| 405 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 405 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 406 content::Source<content::NavigationController>( | 406 content::Source<content::NavigationController>( |
| 407 &new_contents->GetController())); | 407 &new_contents->GetController())); |
| 408 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 408 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 409 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", | 409 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
| 410 L"window.domAutomationController.send(clickSameSiteTargetedLink());", | 410 L"window.domAutomationController.send(clickSameSiteTargetedLink());", |
| 411 &success)); | 411 &success)); |
| 412 EXPECT_TRUE(success); | 412 EXPECT_TRUE(success); |
| 413 navigation_observer.Wait(); | 413 navigation_observer.Wait(); |
| 414 | 414 |
| 415 // Should have swapped back and shown the new tab again. | 415 // Should have swapped back and shown the new tab again. |
| 416 EXPECT_EQ(1, browser()->active_index()); | 416 EXPECT_EQ(1, browser()->active_index()); |
| 417 scoped_refptr<SiteInstance> revisit_site_instance( | 417 scoped_refptr<SiteInstance> revisit_site_instance( |
| 418 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 418 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
| 419 EXPECT_EQ(orig_site_instance, revisit_site_instance); | 419 EXPECT_EQ(orig_site_instance, revisit_site_instance); |
| 420 | 420 |
| 421 // If it navigates away to another process, the original window should | 421 // If it navigates away to another process, the original window should |
| 422 // still be able to close it (using a cross-process close message). | 422 // still be able to close it (using a cross-process close message). |
| 423 ui_test_utils::NavigateToURL(browser(), | 423 ui_test_utils::NavigateToURL(browser(), |
| 424 https_server.GetURL("files/title1.html")); | 424 https_server.GetURL("files/title1.html")); |
| 425 EXPECT_EQ(new_site_instance, | 425 EXPECT_EQ(new_site_instance, |
| 426 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 426 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
| 427 chrome::ActivateTabAt(browser(), 0, true); | 427 chrome::ActivateTabAt(browser(), 0, true); |
| 428 ui_test_utils::WindowedNotificationObserver close_observer( | 428 content::WindowedNotificationObserver close_observer( |
| 429 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 429 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 430 content::Source<content::WebContents>(new_contents)); | 430 content::Source<content::WebContents>(new_contents)); |
| 431 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 431 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 432 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", | 432 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
| 433 L"window.domAutomationController.send(testCloseWindow());", | 433 L"window.domAutomationController.send(testCloseWindow());", |
| 434 &success)); | 434 &success)); |
| 435 EXPECT_TRUE(success); | 435 EXPECT_TRUE(success); |
| 436 close_observer.Wait(); | 436 close_observer.Wait(); |
| 437 } | 437 } |
| 438 | 438 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 // number of received messages below. | 532 // number of received messages below. |
| 533 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 533 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 534 foo_contents->GetRenderViewHost(), L"", | 534 foo_contents->GetRenderViewHost(), L"", |
| 535 L"window.domAutomationController.send(postToOpener('msg'," | 535 L"window.domAutomationController.send(postToOpener('msg'," |
| 536 L"'http://google.com'));", | 536 L"'http://google.com'));", |
| 537 &success)); | 537 &success)); |
| 538 EXPECT_TRUE(success); | 538 EXPECT_TRUE(success); |
| 539 | 539 |
| 540 // 3) Post a message from the foo window to the opener. The opener will | 540 // 3) Post a message from the foo window to the opener. The opener will |
| 541 // reply, causing the foo window to update its own title. | 541 // reply, causing the foo window to update its own title. |
| 542 ui_test_utils::WindowedNotificationObserver title_observer( | 542 content::WindowedNotificationObserver title_observer( |
| 543 content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, | 543 content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, |
| 544 content::Source<content::WebContents>(foo_contents)); | 544 content::Source<content::WebContents>(foo_contents)); |
| 545 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 545 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 546 foo_contents->GetRenderViewHost(), L"", | 546 foo_contents->GetRenderViewHost(), L"", |
| 547 L"window.domAutomationController.send(postToOpener('msg','*'));", | 547 L"window.domAutomationController.send(postToOpener('msg','*'));", |
| 548 &success)); | 548 &success)); |
| 549 EXPECT_TRUE(success); | 549 EXPECT_TRUE(success); |
| 550 title_observer.Wait(); | 550 title_observer.Wait(); |
| 551 | 551 |
| 552 // We should have received only 1 message in the opener and "foo" tabs, | 552 // We should have received only 1 message in the opener and "foo" tabs, |
| 553 // and updated the title. | 553 // and updated the title. |
| 554 int opener_received_messages = 0; | 554 int opener_received_messages = 0; |
| 555 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( | 555 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( |
| 556 opener_contents->GetRenderViewHost(), L"", | 556 opener_contents->GetRenderViewHost(), L"", |
| 557 L"window.domAutomationController.send(window.receivedMessages);", | 557 L"window.domAutomationController.send(window.receivedMessages);", |
| 558 &opener_received_messages)); | 558 &opener_received_messages)); |
| 559 int foo_received_messages = 0; | 559 int foo_received_messages = 0; |
| 560 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( | 560 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( |
| 561 foo_contents->GetRenderViewHost(), L"", | 561 foo_contents->GetRenderViewHost(), L"", |
| 562 L"window.domAutomationController.send(window.receivedMessages);", | 562 L"window.domAutomationController.send(window.receivedMessages);", |
| 563 &foo_received_messages)); | 563 &foo_received_messages)); |
| 564 EXPECT_EQ(1, foo_received_messages); | 564 EXPECT_EQ(1, foo_received_messages); |
| 565 EXPECT_EQ(1, opener_received_messages); | 565 EXPECT_EQ(1, opener_received_messages); |
| 566 EXPECT_EQ(ASCIIToUTF16("msg"), foo_contents->GetTitle()); | 566 EXPECT_EQ(ASCIIToUTF16("msg"), foo_contents->GetTitle()); |
| 567 | 567 |
| 568 // 4) Now post a message from the _blank window to the foo window. The | 568 // 4) Now post a message from the _blank window to the foo window. The |
| 569 // foo window will update its title and will not reply. | 569 // foo window will update its title and will not reply. |
| 570 ui_test_utils::WindowedNotificationObserver title_observer2( | 570 content::WindowedNotificationObserver title_observer2( |
| 571 content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, | 571 content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, |
| 572 content::Source<content::WebContents>(foo_contents)); | 572 content::Source<content::WebContents>(foo_contents)); |
| 573 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 573 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 574 new_contents->GetRenderViewHost(), L"", | 574 new_contents->GetRenderViewHost(), L"", |
| 575 L"window.domAutomationController.send(postToFoo('msg2'));", | 575 L"window.domAutomationController.send(postToFoo('msg2'));", |
| 576 &success)); | 576 &success)); |
| 577 EXPECT_TRUE(success); | 577 EXPECT_TRUE(success); |
| 578 title_observer2.Wait(); | 578 title_observer2.Wait(); |
| 579 EXPECT_EQ(ASCIIToUTF16("msg2"), foo_contents->GetTitle()); | 579 EXPECT_EQ(ASCIIToUTF16("msg2"), foo_contents->GetTitle()); |
| 580 | 580 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 // Now navigate the original (opener) tab to a different site. | 639 // Now navigate the original (opener) tab to a different site. |
| 640 chrome::ActivateTabAt(browser(), 0, true); | 640 chrome::ActivateTabAt(browser(), 0, true); |
| 641 ui_test_utils::NavigateToURL(browser(), | 641 ui_test_utils::NavigateToURL(browser(), |
| 642 https_server.GetURL("files/title1.html")); | 642 https_server.GetURL("files/title1.html")); |
| 643 scoped_refptr<SiteInstance> new_site_instance( | 643 scoped_refptr<SiteInstance> new_site_instance( |
| 644 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 644 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
| 645 EXPECT_NE(orig_site_instance, new_site_instance); | 645 EXPECT_NE(orig_site_instance, new_site_instance); |
| 646 | 646 |
| 647 // The opened tab should be able to navigate the opener back to its process. | 647 // The opened tab should be able to navigate the opener back to its process. |
| 648 chrome::ActivateTabAt(browser(), 1, true); | 648 chrome::ActivateTabAt(browser(), 1, true); |
| 649 ui_test_utils::WindowedNotificationObserver navigation_observer( | 649 content::WindowedNotificationObserver navigation_observer( |
| 650 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 650 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 651 content::Source<content::NavigationController>( | 651 content::Source<content::NavigationController>( |
| 652 &orig_contents->GetController())); | 652 &orig_contents->GetController())); |
| 653 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 653 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 654 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", | 654 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
| 655 L"window.domAutomationController.send(navigateOpener());", | 655 L"window.domAutomationController.send(navigateOpener());", |
| 656 &success)); | 656 &success)); |
| 657 EXPECT_TRUE(success); | 657 EXPECT_TRUE(success); |
| 658 navigation_observer.Wait(); | 658 navigation_observer.Wait(); |
| 659 | 659 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 EXPECT_NE(orig_site_instance, new_site_instance); | 728 EXPECT_NE(orig_site_instance, new_site_instance); |
| 729 | 729 |
| 730 // The original process should still be alive, since it is still used in the | 730 // The original process should still be alive, since it is still used in the |
| 731 // first tab. | 731 // first tab. |
| 732 content::RenderProcessHost* orig_process = orig_site_instance->GetProcess(); | 732 content::RenderProcessHost* orig_process = orig_site_instance->GetProcess(); |
| 733 EXPECT_TRUE(orig_process->HasConnection()); | 733 EXPECT_TRUE(orig_process->HasConnection()); |
| 734 | 734 |
| 735 // Navigate the first tab to a different site as well. The original process | 735 // Navigate the first tab to a different site as well. The original process |
| 736 // should exit, since all of its views are now swapped out. | 736 // should exit, since all of its views are now swapped out. |
| 737 chrome::ActivateTabAt(browser(), 0, true); | 737 chrome::ActivateTabAt(browser(), 0, true); |
| 738 ui_test_utils::WindowedNotificationObserver exit_observer( | 738 content::WindowedNotificationObserver exit_observer( |
| 739 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 739 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 740 content::Source<content::RenderProcessHost>(orig_process)); | 740 content::Source<content::RenderProcessHost>(orig_process)); |
| 741 ui_test_utils::NavigateToURL(browser(), | 741 ui_test_utils::NavigateToURL(browser(), |
| 742 https_server.GetURL("files/title1.html")); | 742 https_server.GetURL("files/title1.html")); |
| 743 exit_observer.Wait(); | 743 exit_observer.Wait(); |
| 744 scoped_refptr<SiteInstance> new_site_instance2( | 744 scoped_refptr<SiteInstance> new_site_instance2( |
| 745 chrome::GetActiveWebContents(browser())->GetSiteInstance()); | 745 chrome::GetActiveWebContents(browser())->GetSiteInstance()); |
| 746 EXPECT_EQ(new_site_instance, new_site_instance2); | 746 EXPECT_EQ(new_site_instance, new_site_instance2); |
| 747 } | 747 } |
| 748 | 748 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 content::WebContents* contents = chrome::GetActiveWebContents(browser()); | 858 content::WebContents* contents = chrome::GetActiveWebContents(browser()); |
| 859 EXPECT_EQ(5, contents->GetController().GetEntryCount()); | 859 EXPECT_EQ(5, contents->GetController().GetEntryCount()); |
| 860 | 860 |
| 861 // Open another tab in same process to keep this process alive. | 861 // Open another tab in same process to keep this process alive. |
| 862 ui_test_utils::NavigateToURLWithDisposition( | 862 ui_test_utils::NavigateToURLWithDisposition( |
| 863 browser(), https_server.GetURL(replacement_path_b1), | 863 browser(), https_server.GetURL(replacement_path_b1), |
| 864 NEW_BACKGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 864 NEW_BACKGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 865 | 865 |
| 866 // Go back three times to first site. | 866 // Go back three times to first site. |
| 867 { | 867 { |
| 868 ui_test_utils::WindowedNotificationObserver back_nav_load_observer( | 868 content::WindowedNotificationObserver back_nav_load_observer( |
| 869 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 869 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 870 content::Source<content::NavigationController>( | 870 content::Source<content::NavigationController>( |
| 871 &contents->GetController())); | 871 &contents->GetController())); |
| 872 chrome::GoBack(browser(), CURRENT_TAB); | 872 chrome::GoBack(browser(), CURRENT_TAB); |
| 873 back_nav_load_observer.Wait(); | 873 back_nav_load_observer.Wait(); |
| 874 } | 874 } |
| 875 { | 875 { |
| 876 ui_test_utils::WindowedNotificationObserver back_nav_load_observer( | 876 content::WindowedNotificationObserver back_nav_load_observer( |
| 877 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 877 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 878 content::Source<content::NavigationController>( | 878 content::Source<content::NavigationController>( |
| 879 &contents->GetController())); | 879 &contents->GetController())); |
| 880 chrome::GoBack(browser(), CURRENT_TAB); | 880 chrome::GoBack(browser(), CURRENT_TAB); |
| 881 back_nav_load_observer.Wait(); | 881 back_nav_load_observer.Wait(); |
| 882 } | 882 } |
| 883 { | 883 { |
| 884 ui_test_utils::WindowedNotificationObserver back_nav_load_observer( | 884 content::WindowedNotificationObserver back_nav_load_observer( |
| 885 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 885 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 886 content::Source<content::NavigationController>( | 886 content::Source<content::NavigationController>( |
| 887 &contents->GetController())); | 887 &contents->GetController())); |
| 888 chrome::GoBack(browser(), CURRENT_TAB); | 888 chrome::GoBack(browser(), CURRENT_TAB); |
| 889 back_nav_load_observer.Wait(); | 889 back_nav_load_observer.Wait(); |
| 890 } | 890 } |
| 891 | 891 |
| 892 // Now go forward twice to B2. Shouldn't be left spinning. | 892 // Now go forward twice to B2. Shouldn't be left spinning. |
| 893 { | 893 { |
| 894 ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( | 894 content::WindowedNotificationObserver forward_nav_load_observer( |
| 895 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 895 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 896 content::Source<content::NavigationController>( | 896 content::Source<content::NavigationController>( |
| 897 &contents->GetController())); | 897 &contents->GetController())); |
| 898 chrome::GoForward(browser(), CURRENT_TAB); | 898 chrome::GoForward(browser(), CURRENT_TAB); |
| 899 forward_nav_load_observer.Wait(); | 899 forward_nav_load_observer.Wait(); |
| 900 } | 900 } |
| 901 { | 901 { |
| 902 ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( | 902 content::WindowedNotificationObserver forward_nav_load_observer( |
| 903 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 903 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 904 content::Source<content::NavigationController>( | 904 content::Source<content::NavigationController>( |
| 905 &contents->GetController())); | 905 &contents->GetController())); |
| 906 chrome::GoForward(browser(), CURRENT_TAB); | 906 chrome::GoForward(browser(), CURRENT_TAB); |
| 907 forward_nav_load_observer.Wait(); | 907 forward_nav_load_observer.Wait(); |
| 908 } | 908 } |
| 909 | 909 |
| 910 // Go back twice to first site. | 910 // Go back twice to first site. |
| 911 { | 911 { |
| 912 ui_test_utils::WindowedNotificationObserver back_nav_load_observer( | 912 content::WindowedNotificationObserver back_nav_load_observer( |
| 913 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 913 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 914 content::Source<content::NavigationController>( | 914 content::Source<content::NavigationController>( |
| 915 &contents->GetController())); | 915 &contents->GetController())); |
| 916 chrome::GoBack(browser(), CURRENT_TAB); | 916 chrome::GoBack(browser(), CURRENT_TAB); |
| 917 back_nav_load_observer.Wait(); | 917 back_nav_load_observer.Wait(); |
| 918 } | 918 } |
| 919 { | 919 { |
| 920 ui_test_utils::WindowedNotificationObserver back_nav_load_observer( | 920 content::WindowedNotificationObserver back_nav_load_observer( |
| 921 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 921 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 922 content::Source<content::NavigationController>( | 922 content::Source<content::NavigationController>( |
| 923 &contents->GetController())); | 923 &contents->GetController())); |
| 924 chrome::GoBack(browser(), CURRENT_TAB); | 924 chrome::GoBack(browser(), CURRENT_TAB); |
| 925 back_nav_load_observer.Wait(); | 925 back_nav_load_observer.Wait(); |
| 926 } | 926 } |
| 927 | 927 |
| 928 // Now go forward directly to B3. Shouldn't be left spinning. | 928 // Now go forward directly to B3. Shouldn't be left spinning. |
| 929 { | 929 { |
| 930 ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( | 930 content::WindowedNotificationObserver forward_nav_load_observer( |
| 931 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 931 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 932 content::Source<content::NavigationController>( | 932 content::Source<content::NavigationController>( |
| 933 &contents->GetController())); | 933 &contents->GetController())); |
| 934 contents->GetController().GoToIndex(4); | 934 contents->GetController().GoToIndex(4); |
| 935 forward_nav_load_observer.Wait(); | 935 forward_nav_load_observer.Wait(); |
| 936 } | 936 } |
| 937 } | 937 } |
| 938 | 938 |
| 939 // Test for http://crbug.com/130016. | 939 // Test for http://crbug.com/130016. |
| 940 // Swapping out a render view should update its visiblity state. | 940 // Swapping out a render view should update its visiblity state. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 996 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 997 rvh, L"", | 997 rvh, L"", |
| 998 L"window.domAutomationController.send(" | 998 L"window.domAutomationController.send(" |
| 999 L"document.webkitVisibilityState == 'hidden');", | 999 L"document.webkitVisibilityState == 'hidden');", |
| 1000 &success)); | 1000 &success)); |
| 1001 EXPECT_TRUE(success); | 1001 EXPECT_TRUE(success); |
| 1002 | 1002 |
| 1003 // Going back should make the previously swapped-out view to become visible | 1003 // Going back should make the previously swapped-out view to become visible |
| 1004 // again. | 1004 // again. |
| 1005 { | 1005 { |
| 1006 ui_test_utils::WindowedNotificationObserver back_nav_load_observer( | 1006 content::WindowedNotificationObserver back_nav_load_observer( |
| 1007 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 1007 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 1008 content::Source<content::NavigationController>( | 1008 content::Source<content::NavigationController>( |
| 1009 &chrome::GetActiveWebContents(browser())->GetController())); | 1009 &chrome::GetActiveWebContents(browser())->GetController())); |
| 1010 chrome::GoBack(browser(), CURRENT_TAB); | 1010 chrome::GoBack(browser(), CURRENT_TAB); |
| 1011 back_nav_load_observer.Wait(); | 1011 back_nav_load_observer.Wait(); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 | 1014 |
| 1015 EXPECT_EQ("/files/navigate_opener.html", | 1015 EXPECT_EQ("/files/navigate_opener.html", |
| 1016 chrome::GetActiveWebContents(browser())->GetURL().path()); | 1016 chrome::GetActiveWebContents(browser())->GetURL().path()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 // Now navigate to a different instance so that we swap out again. | 1112 // Now navigate to a different instance so that we swap out again. |
| 1113 ui_test_utils::NavigateToURL(browser(), | 1113 ui_test_utils::NavigateToURL(browser(), |
| 1114 https_server.GetURL("files/title2.html")); | 1114 https_server.GetURL("files/title2.html")); |
| 1115 rvh_observers.AddObserverToRVH(chrome::GetActiveWebContents(browser())-> | 1115 rvh_observers.AddObserverToRVH(chrome::GetActiveWebContents(browser())-> |
| 1116 GetRenderViewHost()); | 1116 GetRenderViewHost()); |
| 1117 | 1117 |
| 1118 // This used to leak a render view host. | 1118 // This used to leak a render view host. |
| 1119 chrome::CloseWebContents(browser(), chrome::GetActiveWebContents(browser())); | 1119 chrome::CloseWebContents(browser(), chrome::GetActiveWebContents(browser())); |
| 1120 EXPECT_EQ(0U, rvh_observers.GetNumObservers()); | 1120 EXPECT_EQ(0U, rvh_observers.GetNumObservers()); |
| 1121 } | 1121 } |
| OLD | NEW |