| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 GURL master_url(master_url_path); | 669 GURL master_url(master_url_path); |
| 670 std::string slave_url_path = base::StringPrintf("%s?%d", | 670 std::string slave_url_path = base::StringPrintf("%s?%d", |
| 671 test_server()->GetURL("files/ssl/wss_close_slave.html").spec().c_str(), | 671 test_server()->GetURL("files/ssl/wss_close_slave.html").spec().c_str(), |
| 672 wss_server_expired_.host_port_pair().port()); | 672 wss_server_expired_.host_port_pair().port()); |
| 673 GURL slave_url(slave_url_path); | 673 GURL slave_url(slave_url_path); |
| 674 | 674 |
| 675 // Create tabs and visit pages which keep on creating wss connections. | 675 // Create tabs and visit pages which keep on creating wss connections. |
| 676 WebContents* tabs[16]; | 676 WebContents* tabs[16]; |
| 677 for (int i = 0; i < 16; ++i) { | 677 for (int i = 0; i < 16; ++i) { |
| 678 tabs[i] = chrome::AddSelectedTabWithURL(browser(), slave_url, | 678 tabs[i] = chrome::AddSelectedTabWithURL(browser(), slave_url, |
| 679 content::PAGE_TRANSITION_LINK); | 679 ui::PAGE_TRANSITION_LINK); |
| 680 } | 680 } |
| 681 chrome::SelectNextTab(browser()); | 681 chrome::SelectNextTab(browser()); |
| 682 | 682 |
| 683 // Visit a page which waits for one TLS handshake failure. | 683 // Visit a page which waits for one TLS handshake failure. |
| 684 // The title will be changed to 'PASS'. | 684 // The title will be changed to 'PASS'. |
| 685 ui_test_utils::NavigateToURL(browser(), master_url); | 685 ui_test_utils::NavigateToURL(browser(), master_url); |
| 686 const base::string16 result = watcher.WaitAndGetTitle(); | 686 const base::string16 result = watcher.WaitAndGetTitle(); |
| 687 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); | 687 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); |
| 688 | 688 |
| 689 // Close tabs which contains the test page. | 689 // Close tabs which contains the test page. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 823 |
| 824 // Open a page with a HTTPS error in a tab with no prior navigation (through a | 824 // Open a page with a HTTPS error in a tab with no prior navigation (through a |
| 825 // link with a blank target). This is to test that the lack of navigation entry | 825 // link with a blank target). This is to test that the lack of navigation entry |
| 826 // does not cause any problems (it was causing a crasher, see | 826 // does not cause any problems (it was causing a crasher, see |
| 827 // http://crbug.com/19941). | 827 // http://crbug.com/19941). |
| 828 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) { | 828 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) { |
| 829 ASSERT_TRUE(https_server_expired_.Start()); | 829 ASSERT_TRUE(https_server_expired_.Start()); |
| 830 | 830 |
| 831 GURL url = https_server_expired_.GetURL("files/ssl/google.htm"); | 831 GURL url = https_server_expired_.GetURL("files/ssl/google.htm"); |
| 832 WebContents* tab2 = chrome::AddSelectedTabWithURL( | 832 WebContents* tab2 = chrome::AddSelectedTabWithURL( |
| 833 browser(), url, content::PAGE_TRANSITION_TYPED); | 833 browser(), url, ui::PAGE_TRANSITION_TYPED); |
| 834 content::WaitForLoadStop(tab2); | 834 content::WaitForLoadStop(tab2); |
| 835 | 835 |
| 836 // Verify our assumption that there was no prior navigation. | 836 // Verify our assumption that there was no prior navigation. |
| 837 EXPECT_FALSE(chrome::CanGoBack(browser())); | 837 EXPECT_FALSE(chrome::CanGoBack(browser())); |
| 838 | 838 |
| 839 // We should have an interstitial page showing. | 839 // We should have an interstitial page showing. |
| 840 ASSERT_TRUE(tab2->GetInterstitialPage()); | 840 ASSERT_TRUE(tab2->GetInterstitialPage()); |
| 841 } | 841 } |
| 842 | 842 |
| 843 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadHTTPSDownload) { | 843 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadHTTPSDownload) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 858 | 858 |
| 859 // Visit a non-dangerous page. | 859 // Visit a non-dangerous page. |
| 860 ui_test_utils::NavigateToURL(browser(), url_non_dangerous); | 860 ui_test_utils::NavigateToURL(browser(), url_non_dangerous); |
| 861 | 861 |
| 862 // Now, start a transition to dangerous download. | 862 // Now, start a transition to dangerous download. |
| 863 { | 863 { |
| 864 content::WindowedNotificationObserver observer( | 864 content::WindowedNotificationObserver observer( |
| 865 content::NOTIFICATION_LOAD_STOP, | 865 content::NOTIFICATION_LOAD_STOP, |
| 866 content::NotificationService::AllSources()); | 866 content::NotificationService::AllSources()); |
| 867 chrome::NavigateParams navigate_params(browser(), url_dangerous, | 867 chrome::NavigateParams navigate_params(browser(), url_dangerous, |
| 868 content::PAGE_TRANSITION_TYPED); | 868 ui::PAGE_TRANSITION_TYPED); |
| 869 chrome::Navigate(&navigate_params); | 869 chrome::Navigate(&navigate_params); |
| 870 observer.Wait(); | 870 observer.Wait(); |
| 871 } | 871 } |
| 872 | 872 |
| 873 // To exit the browser cleanly (and this test) we need to complete the | 873 // To exit the browser cleanly (and this test) we need to complete the |
| 874 // download after completing this test. | 874 // download after completing this test. |
| 875 content::DownloadTestObserverTerminal dangerous_download_observer( | 875 content::DownloadTestObserverTerminal dangerous_download_observer( |
| 876 content::BrowserContext::GetDownloadManager(browser()->profile()), | 876 content::BrowserContext::GetDownloadManager(browser()->profile()), |
| 877 1, | 877 1, |
| 878 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT); | 878 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 CheckAuthenticatedState(tab1, AuthState::NONE); | 1047 CheckAuthenticatedState(tab1, AuthState::NONE); |
| 1048 | 1048 |
| 1049 // Create a new tab. | 1049 // Create a new tab. |
| 1050 std::string replacement_path; | 1050 std::string replacement_path; |
| 1051 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1051 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 1052 "files/ssl/page_displays_insecure_content.html", | 1052 "files/ssl/page_displays_insecure_content.html", |
| 1053 test_server()->host_port_pair(), | 1053 test_server()->host_port_pair(), |
| 1054 &replacement_path)); | 1054 &replacement_path)); |
| 1055 | 1055 |
| 1056 GURL url = https_server_.GetURL(replacement_path); | 1056 GURL url = https_server_.GetURL(replacement_path); |
| 1057 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_TYPED); | 1057 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_TYPED); |
| 1058 params.disposition = NEW_FOREGROUND_TAB; | 1058 params.disposition = NEW_FOREGROUND_TAB; |
| 1059 params.tabstrip_index = 0; | 1059 params.tabstrip_index = 0; |
| 1060 params.source_contents = tab1; | 1060 params.source_contents = tab1; |
| 1061 content::WindowedNotificationObserver observer( | 1061 content::WindowedNotificationObserver observer( |
| 1062 content::NOTIFICATION_LOAD_STOP, | 1062 content::NOTIFICATION_LOAD_STOP, |
| 1063 content::NotificationService::AllSources()); | 1063 content::NotificationService::AllSources()); |
| 1064 chrome::Navigate(¶ms); | 1064 chrome::Navigate(¶ms); |
| 1065 WebContents* tab2 = params.target_contents; | 1065 WebContents* tab2 = params.target_contents; |
| 1066 observer.Wait(); | 1066 observer.Wait(); |
| 1067 | 1067 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1090 std::string replacement_path; | 1090 std::string replacement_path; |
| 1091 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1091 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 1092 "files/ssl/page_runs_insecure_content.html", | 1092 "files/ssl/page_runs_insecure_content.html", |
| 1093 test_server()->host_port_pair(), | 1093 test_server()->host_port_pair(), |
| 1094 &replacement_path)); | 1094 &replacement_path)); |
| 1095 | 1095 |
| 1096 // Create a new tab in the same process. Using a NEW_FOREGROUND_TAB | 1096 // Create a new tab in the same process. Using a NEW_FOREGROUND_TAB |
| 1097 // disposition won't usually stay in the same process, but this works | 1097 // disposition won't usually stay in the same process, but this works |
| 1098 // because we are using process-per-site in SetUpCommandLine. | 1098 // because we are using process-per-site in SetUpCommandLine. |
| 1099 GURL url = https_server_.GetURL(replacement_path); | 1099 GURL url = https_server_.GetURL(replacement_path); |
| 1100 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_TYPED); | 1100 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_TYPED); |
| 1101 params.disposition = NEW_FOREGROUND_TAB; | 1101 params.disposition = NEW_FOREGROUND_TAB; |
| 1102 params.source_contents = tab1; | 1102 params.source_contents = tab1; |
| 1103 content::WindowedNotificationObserver observer( | 1103 content::WindowedNotificationObserver observer( |
| 1104 content::NOTIFICATION_LOAD_STOP, | 1104 content::NOTIFICATION_LOAD_STOP, |
| 1105 content::NotificationService::AllSources()); | 1105 content::NotificationService::AllSources()); |
| 1106 chrome::Navigate(¶ms); | 1106 chrome::Navigate(¶ms); |
| 1107 WebContents* tab2 = params.target_contents; | 1107 WebContents* tab2 = params.target_contents; |
| 1108 observer.Wait(); | 1108 observer.Wait(); |
| 1109 | 1109 |
| 1110 // Both tabs should have the same process. | 1110 // Both tabs should have the same process. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 content::RunMessageLoop(); | 1284 content::RunMessageLoop(); |
| 1285 } | 1285 } |
| 1286 ASSERT_TRUE(IsShowingWebContentsModalDialog()); | 1286 ASSERT_TRUE(IsShowingWebContentsModalDialog()); |
| 1287 | 1287 |
| 1288 // Let's add another tab to make sure the browser does not exit when we close | 1288 // Let's add another tab to make sure the browser does not exit when we close |
| 1289 // the first tab. | 1289 // the first tab. |
| 1290 GURL url = test_server()->GetURL("files/ssl/google.html"); | 1290 GURL url = test_server()->GetURL("files/ssl/google.html"); |
| 1291 content::WindowedNotificationObserver observer( | 1291 content::WindowedNotificationObserver observer( |
| 1292 content::NOTIFICATION_LOAD_STOP, | 1292 content::NOTIFICATION_LOAD_STOP, |
| 1293 content::NotificationService::AllSources()); | 1293 content::NotificationService::AllSources()); |
| 1294 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); | 1294 chrome::AddSelectedTabWithURL(browser(), url, ui::PAGE_TRANSITION_TYPED); |
| 1295 observer.Wait(); | 1295 observer.Wait(); |
| 1296 | 1296 |
| 1297 // Close the first tab. | 1297 // Close the first tab. |
| 1298 chrome::CloseWebContents(browser(), tab1, false); | 1298 chrome::CloseWebContents(browser(), tab1, false); |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 // Visit a page over bad https that is a redirect to a page with good https. | 1301 // Visit a page over bad https that is a redirect to a page with good https. |
| 1302 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) { | 1302 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) { |
| 1303 ASSERT_TRUE(https_server_.Start()); | 1303 ASSERT_TRUE(https_server_.Start()); |
| 1304 ASSERT_TRUE(https_server_expired_.Start()); | 1304 ASSERT_TRUE(https_server_expired_.Start()); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1848 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1849 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); | 1849 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); |
| 1850 ui_test_utils::NavigateToURL( | 1850 ui_test_utils::NavigateToURL( |
| 1851 browser(), https_server_expired_.GetURL("files/ssl/google.html")); | 1851 browser(), https_server_expired_.GetURL("files/ssl/google.html")); |
| 1852 CheckAuthenticationBrokenState( | 1852 CheckAuthenticationBrokenState( |
| 1853 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); | 1853 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); |
| 1854 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); | 1854 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); |
| 1855 | 1855 |
| 1856 AddTabAtIndex(0, | 1856 AddTabAtIndex(0, |
| 1857 https_server_.GetURL("files/ssl/google.html"), | 1857 https_server_.GetURL("files/ssl/google.html"), |
| 1858 content::PAGE_TRANSITION_TYPED); | 1858 ui::PAGE_TRANSITION_TYPED); |
| 1859 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 1859 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
| 1860 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); | 1860 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 1861 EXPECT_EQ(tab, browser()->tab_strip_model()->GetWebContentsAt(1)); | 1861 EXPECT_EQ(tab, browser()->tab_strip_model()->GetWebContentsAt(1)); |
| 1862 EXPECT_FALSE(tab->GetRenderWidgetHostView()->IsShowing()); | 1862 EXPECT_FALSE(tab->GetRenderWidgetHostView()->IsShowing()); |
| 1863 | 1863 |
| 1864 browser()->tab_strip_model()->ActivateTabAt(1, true); | 1864 browser()->tab_strip_model()->ActivateTabAt(1, true); |
| 1865 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); | 1865 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); |
| 1866 } | 1866 } |
| 1867 | 1867 |
| 1868 // TODO(jcampan): more tests to do below. | 1868 // TODO(jcampan): more tests to do below. |
| 1869 | 1869 |
| 1870 // Visit a page over https that contains a frame with a redirect. | 1870 // Visit a page over https that contains a frame with a redirect. |
| 1871 | 1871 |
| 1872 // XMLHttpRequest insecure content in synchronous mode. | 1872 // XMLHttpRequest insecure content in synchronous mode. |
| 1873 | 1873 |
| 1874 // XMLHttpRequest insecure content in asynchronous mode. | 1874 // XMLHttpRequest insecure content in asynchronous mode. |
| 1875 | 1875 |
| 1876 // XMLHttpRequest over bad ssl in synchronous mode. | 1876 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1877 | 1877 |
| 1878 // XMLHttpRequest over OK ssl in synchronous mode. | 1878 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |