| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 "files/downloads/dangerous/dangerous.exe"); | 636 "files/downloads/dangerous/dangerous.exe"); |
| 637 | 637 |
| 638 // Visit a non-dangerous page. | 638 // Visit a non-dangerous page. |
| 639 ui_test_utils::NavigateToURL(browser(), url_non_dangerous); | 639 ui_test_utils::NavigateToURL(browser(), url_non_dangerous); |
| 640 | 640 |
| 641 // Now, start a transition to dangerous download. | 641 // Now, start a transition to dangerous download. |
| 642 { | 642 { |
| 643 ui_test_utils::WindowedNotificationObserver observer( | 643 ui_test_utils::WindowedNotificationObserver observer( |
| 644 content::NOTIFICATION_LOAD_STOP, | 644 content::NOTIFICATION_LOAD_STOP, |
| 645 content::NotificationService::AllSources()); | 645 content::NotificationService::AllSources()); |
| 646 browser::NavigateParams navigate_params(browser(), url_dangerous, | 646 chrome::NavigateParams navigate_params(browser(), url_dangerous, |
| 647 content::PAGE_TRANSITION_TYPED); | 647 content::PAGE_TRANSITION_TYPED); |
| 648 browser::Navigate(&navigate_params); | 648 chrome::Navigate(&navigate_params); |
| 649 observer.Wait(); | 649 observer.Wait(); |
| 650 } | 650 } |
| 651 | 651 |
| 652 // Proceed through the SSL interstitial. This doesn't use | 652 // Proceed through the SSL interstitial. This doesn't use |
| 653 // |ProceedThroughInterstitial| since no page load will commit. | 653 // |ProceedThroughInterstitial| since no page load will commit. |
| 654 WebContents* tab = chrome::GetActiveWebContents(browser()); | 654 WebContents* tab = chrome::GetActiveWebContents(browser()); |
| 655 ASSERT_TRUE(tab != NULL); | 655 ASSERT_TRUE(tab != NULL); |
| 656 ASSERT_TRUE(tab->GetInterstitialPage() != NULL); | 656 ASSERT_TRUE(tab->GetInterstitialPage() != NULL); |
| 657 { | 657 { |
| 658 ui_test_utils::WindowedNotificationObserver observer( | 658 ui_test_utils::WindowedNotificationObserver observer( |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 CheckAuthenticatedState(tab1->web_contents(), false); | 795 CheckAuthenticatedState(tab1->web_contents(), false); |
| 796 | 796 |
| 797 // Create a new tab. | 797 // Create a new tab. |
| 798 std::string replacement_path; | 798 std::string replacement_path; |
| 799 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 799 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 800 "files/ssl/page_displays_insecure_content.html", | 800 "files/ssl/page_displays_insecure_content.html", |
| 801 test_server()->host_port_pair(), | 801 test_server()->host_port_pair(), |
| 802 &replacement_path)); | 802 &replacement_path)); |
| 803 | 803 |
| 804 GURL url = https_server_.GetURL(replacement_path); | 804 GURL url = https_server_.GetURL(replacement_path); |
| 805 browser::NavigateParams params( | 805 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_TYPED); |
| 806 browser(), url, content::PAGE_TRANSITION_TYPED); | |
| 807 params.disposition = NEW_FOREGROUND_TAB; | 806 params.disposition = NEW_FOREGROUND_TAB; |
| 808 params.tabstrip_index = 0; | 807 params.tabstrip_index = 0; |
| 809 params.source_contents = tab1; | 808 params.source_contents = tab1; |
| 810 ui_test_utils::WindowedNotificationObserver observer( | 809 ui_test_utils::WindowedNotificationObserver observer( |
| 811 content::NOTIFICATION_LOAD_STOP, | 810 content::NOTIFICATION_LOAD_STOP, |
| 812 content::NotificationService::AllSources()); | 811 content::NotificationService::AllSources()); |
| 813 browser::Navigate(¶ms); | 812 chrome::Navigate(¶ms); |
| 814 TabContents* tab2 = params.target_contents; | 813 TabContents* tab2 = params.target_contents; |
| 815 observer.Wait(); | 814 observer.Wait(); |
| 816 | 815 |
| 817 // The new tab has insecure content. | 816 // The new tab has insecure content. |
| 818 CheckAuthenticatedState(tab2->web_contents(), true); | 817 CheckAuthenticatedState(tab2->web_contents(), true); |
| 819 | 818 |
| 820 // The original tab should not be contaminated. | 819 // The original tab should not be contaminated. |
| 821 CheckAuthenticatedState(tab1->web_contents(), false); | 820 CheckAuthenticatedState(tab1->web_contents(), false); |
| 822 } | 821 } |
| 823 | 822 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 839 std::string replacement_path; | 838 std::string replacement_path; |
| 840 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 839 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 841 "files/ssl/page_runs_insecure_content.html", | 840 "files/ssl/page_runs_insecure_content.html", |
| 842 test_server()->host_port_pair(), | 841 test_server()->host_port_pair(), |
| 843 &replacement_path)); | 842 &replacement_path)); |
| 844 | 843 |
| 845 // Create a new tab in the same process. Using a NEW_FOREGROUND_TAB | 844 // Create a new tab in the same process. Using a NEW_FOREGROUND_TAB |
| 846 // disposition won't usually stay in the same process, but this works | 845 // disposition won't usually stay in the same process, but this works |
| 847 // because we are using process-per-site in SetUpCommandLine. | 846 // because we are using process-per-site in SetUpCommandLine. |
| 848 GURL url = https_server_.GetURL(replacement_path); | 847 GURL url = https_server_.GetURL(replacement_path); |
| 849 browser::NavigateParams params( | 848 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_TYPED); |
| 850 browser(), url, content::PAGE_TRANSITION_TYPED); | |
| 851 params.disposition = NEW_FOREGROUND_TAB; | 849 params.disposition = NEW_FOREGROUND_TAB; |
| 852 params.source_contents = tab1; | 850 params.source_contents = tab1; |
| 853 ui_test_utils::WindowedNotificationObserver observer( | 851 ui_test_utils::WindowedNotificationObserver observer( |
| 854 content::NOTIFICATION_LOAD_STOP, | 852 content::NOTIFICATION_LOAD_STOP, |
| 855 content::NotificationService::AllSources()); | 853 content::NotificationService::AllSources()); |
| 856 browser::Navigate(¶ms); | 854 chrome::Navigate(¶ms); |
| 857 TabContents* tab2 = params.target_contents; | 855 TabContents* tab2 = params.target_contents; |
| 858 observer.Wait(); | 856 observer.Wait(); |
| 859 | 857 |
| 860 // Both tabs should have the same process. | 858 // Both tabs should have the same process. |
| 861 EXPECT_EQ(tab1->web_contents()->GetRenderProcessHost(), | 859 EXPECT_EQ(tab1->web_contents()->GetRenderProcessHost(), |
| 862 tab2->web_contents()->GetRenderProcessHost()); | 860 tab2->web_contents()->GetRenderProcessHost()); |
| 863 | 861 |
| 864 // The new tab has insecure content. | 862 // The new tab has insecure content. |
| 865 CheckAuthenticationBrokenState(tab2->web_contents(), 0, true, false); | 863 CheckAuthenticationBrokenState(tab2->web_contents(), 0, true, false); |
| 866 | 864 |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 | 1455 |
| 1458 // Visit a page over https that contains a frame with a redirect. | 1456 // Visit a page over https that contains a frame with a redirect. |
| 1459 | 1457 |
| 1460 // XMLHttpRequest insecure content in synchronous mode. | 1458 // XMLHttpRequest insecure content in synchronous mode. |
| 1461 | 1459 |
| 1462 // XMLHttpRequest insecure content in asynchronous mode. | 1460 // XMLHttpRequest insecure content in asynchronous mode. |
| 1463 | 1461 |
| 1464 // XMLHttpRequest over bad ssl in synchronous mode. | 1462 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1465 | 1463 |
| 1466 // XMLHttpRequest over OK ssl in synchronous mode. | 1464 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |