Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3109)

Unified Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 10830256: Check ignore-certificate-erros in SocketStream (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/socket_stream/socket_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6be999e6fe7a0071a48f4c4fae7836b6748df930..0329ebcdc372558612719be1b5111ae2ea01ffed 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -296,6 +296,16 @@ class SSLUITestBlock : public SSLUITest {
}
};
+class SSLUITestIgnoreCertErrors : public SSLUITest {
+ public:
+ SSLUITestIgnoreCertErrors() : SSLUITest() {}
+
+ virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+ // Browser will ignore certificate errors.
+ command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
+ }
+};
+
// Visits a regular page over http.
IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) {
ASSERT_TRUE(test_server()->Start());
@@ -1449,6 +1459,38 @@ IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) {
CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false);
}
+// Visit a page and establish a WebSocket connection over bad https with
+// --ignore-certificate-errors. The connection should be established without
+// 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));
+
+ // Setup page title observer.
+ WebContents* tab = chrome::GetActiveWebContents(browser());
+ content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
+ watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
+
+ // Visit bad HTTPS page.
+ std::string url_path =
+ StringPrintf("%s%d%s", "https://localhost:", port, "/wss.html");
+ ui_test_utils::NavigateToURL(browser(), GURL(url_path));
+
+ // We shouldn't have an interstitial page showing here.
+
+ // Test page run a WebSocket wss connection test. The result will be shown
+ // as page title.
+ const string16 result = watcher.WaitAndGetTitle();
+ EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass"));
+}
// TODO(jcampan): more tests to do below.
« no previous file with comments | « no previous file | net/socket_stream/socket_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698