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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/socket_stream/socket_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 class SSLUITestBlock : public SSLUITest { 289 class SSLUITestBlock : public SSLUITest {
290 public: 290 public:
291 SSLUITestBlock() : SSLUITest() {} 291 SSLUITestBlock() : SSLUITest() {}
292 292
293 // Browser will neither run nor display insecure content. 293 // Browser will neither run nor display insecure content.
294 virtual void SetUpCommandLine(CommandLine* command_line) { 294 virtual void SetUpCommandLine(CommandLine* command_line) {
295 command_line->AppendSwitch(switches::kNoDisplayingInsecureContent); 295 command_line->AppendSwitch(switches::kNoDisplayingInsecureContent);
296 } 296 }
297 }; 297 };
298 298
299 class SSLUITestIgnoreCertErrors : public SSLUITest {
300 public:
301 SSLUITestIgnoreCertErrors() : SSLUITest() {}
302
303 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
304 // Browser will ignore certificate errors.
305 command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
306 }
307 };
308
299 // Visits a regular page over http. 309 // Visits a regular page over http.
300 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { 310 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) {
301 ASSERT_TRUE(test_server()->Start()); 311 ASSERT_TRUE(test_server()->Start());
302 312
303 ui_test_utils::NavigateToURL(browser(), 313 ui_test_utils::NavigateToURL(browser(),
304 test_server()->GetURL("files/ssl/google.html")); 314 test_server()->GetURL("files/ssl/google.html"));
305 315
306 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser())); 316 CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
307 } 317 }
308 318
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 "files/ssl/page_runs_insecure_content.html", 1452 "files/ssl/page_runs_insecure_content.html",
1443 test_server()->host_port_pair(), 1453 test_server()->host_port_pair(),
1444 &replacement_path)); 1454 &replacement_path));
1445 1455
1446 ui_test_utils::NavigateToURL(browser(), 1456 ui_test_utils::NavigateToURL(browser(),
1447 https_server_.GetURL(replacement_path)); 1457 https_server_.GetURL(replacement_path));
1448 1458
1449 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false); 1459 CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false);
1450 } 1460 }
1451 1461
1462 // Visit a page and establish a WebSocket connection over bad https with
1463 // --ignore-certificate-errors. The connection should be established without
1464 // interstitial page showing.
1465 IN_PROC_BROWSER_TEST_F(SSLUITestIgnoreCertErrors, TestWSS) {
1466 ASSERT_TRUE(test_server()->Start());
1467 ASSERT_TRUE(https_server_expired_.Start());
1468
1469 // Start pywebsocket with TLS.
1470 content::TestWebSocketServer wss_server;
1471 int port = wss_server.UseRandomPort();
1472 wss_server.UseTLS();
1473 FilePath wss_root_dir;
1474 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir));
1475 ASSERT_TRUE(wss_server.Start(wss_root_dir));
1476
1477 // Setup page title observer.
1478 WebContents* tab = chrome::GetActiveWebContents(browser());
1479 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
1480 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
1481
1482 // Visit bad HTTPS page.
1483 std::string url_path =
1484 StringPrintf("%s%d%s", "https://localhost:", port, "/wss.html");
1485 ui_test_utils::NavigateToURL(browser(), GURL(url_path));
1486
1487 // We shouldn't have an interstitial page showing here.
1488
1489 // Test page run a WebSocket wss connection test. The result will be shown
1490 // as page title.
1491 const string16 result = watcher.WaitAndGetTitle();
1492 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass"));
1493 }
1452 1494
1453 // TODO(jcampan): more tests to do below. 1495 // TODO(jcampan): more tests to do below.
1454 1496
1455 // Visit a page over https that contains a frame with a redirect. 1497 // Visit a page over https that contains a frame with a redirect.
1456 1498
1457 // XMLHttpRequest insecure content in synchronous mode. 1499 // XMLHttpRequest insecure content in synchronous mode.
1458 1500
1459 // XMLHttpRequest insecure content in asynchronous mode. 1501 // XMLHttpRequest insecure content in asynchronous mode.
1460 1502
1461 // XMLHttpRequest over bad ssl in synchronous mode. 1503 // XMLHttpRequest over bad ssl in synchronous mode.
1462 1504
1463 // XMLHttpRequest over OK ssl in synchronous mode. 1505 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« 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