Chromium Code Reviews| Index: chrome/browser/ssl/ssl_browser_tests.cc |
| diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc |
| index d87feeb16e70005e3d024dcaf742ccd1b534df19..4c881227bfd8b26b643a0aa34f8b790d108e2077 100644 |
| --- a/chrome/browser/ssl/ssl_browser_tests.cc |
| +++ b/chrome/browser/ssl/ssl_browser_tests.cc |
| @@ -47,6 +47,7 @@ using content::SSLStatus; |
| using content::WebContents; |
| const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); |
| +const FilePath::CharType kWsRoot[] = FILE_PATH_LITERAL("net/data/websocket"); |
| namespace { |
| @@ -83,6 +84,7 @@ class ProvisionalLoadWaiter : public content::WebContentsObserver { |
| } // namespace |
| class SSLUITest : public InProcessBrowserTest { |
| + protected: |
| typedef net::TestServer::SSLOptions SSLOptions; |
|
Ryan Sleevi
2012/10/10 17:59:57
style bug: Public -> Protected -> Private.
I real
Takashi Toyoshima
2012/10/11 05:53:28
You are right.
I moved this later in the file.
It
|
| public: |
| @@ -95,7 +97,10 @@ class SSLUITest : public InProcessBrowserTest { |
| FilePath(kDocRoot)), |
| https_server_mismatched_(net::TestServer::TYPE_HTTPS, |
| SSLOptions(SSLOptions::CERT_MISMATCHED_NAME), |
| - FilePath(kDocRoot)) {} |
| + FilePath(kDocRoot)), |
| + wss_server_expired_(net::TestServer::TYPE_WSS, |
| + SSLOptions(SSLOptions::CERT_EXPIRED), |
| + FilePath(kWsRoot)) {} |
|
Takashi Toyoshima
2012/10/10 08:14:44
I just follow existing style here.
What do you thi
Jay Civelli
2012/10/10 15:39:46
I am not sure I understand what you mean.
Takashi Toyoshima
2012/10/11 04:53:21
Sorry for vague comment.
Ryan and I have seen two
|
| virtual void SetUpCommandLine(CommandLine* command_line) { |
| // Browser will both run and display insecure content. |
| @@ -288,6 +293,7 @@ class SSLUITest : public InProcessBrowserTest { |
| net::TestServer https_server_; |
| net::TestServer https_server_expired_; |
| net::TestServer https_server_mismatched_; |
| + net::TestServer wss_server_expired_; |
| private: |
| DISALLOW_COPY_AND_ASSIGN(SSLUITest); |
| @@ -542,7 +548,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoForward) { |
| // response from UI thread. |
| IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndClose) { |
| ASSERT_TRUE(test_server()->Start()); |
| - ASSERT_TRUE(https_server_expired_.Start()); |
| + ASSERT_TRUE(wss_server_expired_.Start()); |
| // Setup page title observer. |
| WebContents* tab = chrome::GetActiveWebContents(browser()); |
| @@ -552,11 +558,11 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndClose) { |
| // Create GURLs to test pages. |
| std::string masterUrlPath = StringPrintf("%s?%d", |
| test_server()->GetURL("files/ssl/wss_close.html").spec().c_str(), |
| - https_server_expired_.host_port_pair().port()); |
| + wss_server_expired_.host_port_pair().port()); |
| GURL masterUrl(masterUrlPath); |
| std::string slaveUrlPath = StringPrintf("%s?%d", |
| test_server()->GetURL("files/ssl/wss_close_slave.html").spec().c_str(), |
| - https_server_expired_.host_port_pair().port()); |
| + wss_server_expired_.host_port_pair().port()); |
| GURL slaveUrl(slaveUrlPath); |
| // Create tabs and visit pages which keep on creating wss connections. |
| @@ -584,15 +590,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndClose) { |
| // share certificates policy with HTTPS correcly. |
| IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) { |
| ASSERT_TRUE(test_server()->Start()); |
| - ASSERT_TRUE(https_server_expired_.Start()); |
| - |
| - // Start pywebsocket with TLS. |
| - content::TestWebSocketServer wss_server; |
| - int port = wss_server.UseRandomPort(); |
| - wss_server.UseTLS(); |
| - FilePath wss_root_dir; |
| - ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir)); |
| - ASSERT_TRUE(wss_server.Start(wss_root_dir)); |
| + ASSERT_TRUE(wss_server_expired_.Start()); |
| // Setup page title observer. |
| WebContents* tab = chrome::GetActiveWebContents(browser()); |
| @@ -600,11 +598,10 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) { |
| watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
| // Visit bad HTTPS page. |
| - std::string urlPath = |
| - StringPrintf("%s%d%s", "https://localhost:", port, "/ws.html"); |
| - ui_test_utils::NavigateToURL(browser(), GURL(urlPath)); |
| - CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
| - false, true); // Interstitial showing |
| + ui_test_utils::NavigateToURL( |
| + browser(), wss_server_expired_.GetAlternateURL("connect_check.html")); |
| + CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| + true); // Interstitial showing |
| // Proceed anyway. |
| ProceedThroughInterstitial(tab); |
| @@ -1494,15 +1491,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) { |
| // interstitial page showing. |
| IN_PROC_BROWSER_TEST_F(SSLUITestIgnoreCertErrors, TestWSS) { |
| ASSERT_TRUE(test_server()->Start()); |
| - ASSERT_TRUE(https_server_expired_.Start()); |
| - |
| - // Start pywebsocket with TLS. |
| - content::TestWebSocketServer wss_server; |
| - int port = wss_server.UseRandomPort(); |
| - wss_server.UseTLS(); |
| - FilePath wss_root_dir; |
| - ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir)); |
| - ASSERT_TRUE(wss_server.Start(wss_root_dir)); |
| + ASSERT_TRUE(wss_server_expired_.Start()); |
| // Setup page title observer. |
| WebContents* tab = chrome::GetActiveWebContents(browser()); |
| @@ -1510,9 +1499,8 @@ IN_PROC_BROWSER_TEST_F(SSLUITestIgnoreCertErrors, TestWSS) { |
| watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
| // Visit bad HTTPS page. |
| - std::string url_path = |
| - StringPrintf("%s%d%s", "https://localhost:", port, "/ws.html"); |
| - ui_test_utils::NavigateToURL(browser(), GURL(url_path)); |
| + ui_test_utils::NavigateToURL( |
| + browser(), wss_server_expired_.GetAlternateURL("connect_check.html")); |
| // We shouldn't have an interstitial page showing here. |