| 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 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
| 24 #include "content/public/browser/interstitial_page.h" | 24 #include "content/public/browser/interstitial_page.h" |
| 25 #include "content/public/browser/navigation_controller.h" | 25 #include "content/public/browser/navigation_controller.h" |
| 26 #include "content/public/browser/navigation_entry.h" | 26 #include "content/public/browser/navigation_entry.h" |
| 27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 28 #include "content/public/browser/render_view_host.h" | 28 #include "content/public/browser/render_view_host.h" |
| 29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
| 30 #include "content/public/browser/web_contents_observer.h" | 30 #include "content/public/browser/web_contents_observer.h" |
| 31 #include "content/public/common/security_style.h" | 31 #include "content/public/common/security_style.h" |
| 32 #include "content/public/common/ssl_status.h" | 32 #include "content/public/common/ssl_status.h" |
| 33 #include "content/public/test/browser_test_utils.h" |
| 33 #include "content/public/test/test_renderer_host.h" | 34 #include "content/public/test/test_renderer_host.h" |
| 34 #include "net/base/cert_status_flags.h" | 35 #include "net/base/cert_status_flags.h" |
| 35 #include "net/test/test_server.h" | 36 #include "net/test/test_server.h" |
| 36 | 37 |
| 37 using content::InterstitialPage; | 38 using content::InterstitialPage; |
| 38 using content::NavigationController; | 39 using content::NavigationController; |
| 39 using content::NavigationEntry; | 40 using content::NavigationEntry; |
| 40 using content::SSLStatus; | 41 using content::SSLStatus; |
| 41 using content::WebContents; | 42 using content::WebContents; |
| 42 | 43 |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 522 |
| 522 // Visit a HTTP page which request WSS connection to a server providing invalid | 523 // Visit a HTTP page which request WSS connection to a server providing invalid |
| 523 // certificate. Close the page while WSS connection waits for SSLManager's | 524 // certificate. Close the page while WSS connection waits for SSLManager's |
| 524 // response from UI thread. | 525 // response from UI thread. |
| 525 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndClose) { | 526 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndClose) { |
| 526 ASSERT_TRUE(test_server()->Start()); | 527 ASSERT_TRUE(test_server()->Start()); |
| 527 ASSERT_TRUE(https_server_expired_.Start()); | 528 ASSERT_TRUE(https_server_expired_.Start()); |
| 528 | 529 |
| 529 // Setup page title observer. | 530 // Setup page title observer. |
| 530 WebContents* tab = chrome::GetActiveWebContents(browser()); | 531 WebContents* tab = chrome::GetActiveWebContents(browser()); |
| 531 ui_test_utils::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 532 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
| 532 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 533 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
| 533 | 534 |
| 534 // Create GURLs to test pages. | 535 // Create GURLs to test pages. |
| 535 std::string masterUrlPath = StringPrintf("%s?%d", | 536 std::string masterUrlPath = StringPrintf("%s?%d", |
| 536 test_server()->GetURL("files/ssl/wss_close.html").spec().c_str(), | 537 test_server()->GetURL("files/ssl/wss_close.html").spec().c_str(), |
| 537 https_server_expired_.host_port_pair().port()); | 538 https_server_expired_.host_port_pair().port()); |
| 538 GURL masterUrl(masterUrlPath); | 539 GURL masterUrl(masterUrlPath); |
| 539 std::string slaveUrlPath = StringPrintf("%s?%d", | 540 std::string slaveUrlPath = StringPrintf("%s?%d", |
| 540 test_server()->GetURL("files/ssl/wss_close_slave.html").spec().c_str(), | 541 test_server()->GetURL("files/ssl/wss_close_slave.html").spec().c_str(), |
| 541 https_server_expired_.host_port_pair().port()); | 542 https_server_expired_.host_port_pair().port()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 571 // Start pywebsocket with TLS. | 572 // Start pywebsocket with TLS. |
| 572 ui_test_utils::TestWebSocketServer wss_server; | 573 ui_test_utils::TestWebSocketServer wss_server; |
| 573 int port = wss_server.UseRandomPort(); | 574 int port = wss_server.UseRandomPort(); |
| 574 wss_server.UseTLS(); | 575 wss_server.UseTLS(); |
| 575 FilePath wss_root_dir; | 576 FilePath wss_root_dir; |
| 576 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir)); | 577 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir)); |
| 577 ASSERT_TRUE(wss_server.Start(wss_root_dir)); | 578 ASSERT_TRUE(wss_server.Start(wss_root_dir)); |
| 578 | 579 |
| 579 // Setup page title observer. | 580 // Setup page title observer. |
| 580 WebContents* tab = chrome::GetActiveWebContents(browser()); | 581 WebContents* tab = chrome::GetActiveWebContents(browser()); |
| 581 ui_test_utils::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 582 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
| 582 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 583 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
| 583 | 584 |
| 584 // Visit bad HTTPS page. | 585 // Visit bad HTTPS page. |
| 585 std::string urlPath = | 586 std::string urlPath = |
| 586 StringPrintf("%s%d%s", "https://localhost:", port, "/wss.html"); | 587 StringPrintf("%s%d%s", "https://localhost:", port, "/wss.html"); |
| 587 ui_test_utils::NavigateToURL(browser(), GURL(urlPath)); | 588 ui_test_utils::NavigateToURL(browser(), GURL(urlPath)); |
| 588 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 589 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
| 589 false, true); // Interstitial showing | 590 false, true); // Interstitial showing |
| 590 | 591 |
| 591 // Proceed anyway. | 592 // Proceed anyway. |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 | 1454 |
| 1454 // Visit a page over https that contains a frame with a redirect. | 1455 // Visit a page over https that contains a frame with a redirect. |
| 1455 | 1456 |
| 1456 // XMLHttpRequest insecure content in synchronous mode. | 1457 // XMLHttpRequest insecure content in synchronous mode. |
| 1457 | 1458 |
| 1458 // XMLHttpRequest insecure content in asynchronous mode. | 1459 // XMLHttpRequest insecure content in asynchronous mode. |
| 1459 | 1460 |
| 1460 // XMLHttpRequest over bad ssl in synchronous mode. | 1461 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1461 | 1462 |
| 1462 // XMLHttpRequest over OK ssl in synchronous mode. | 1463 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |