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

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 IN_PROC_BROWSER_TEST_F(SSLUITestIgnoreCertErrors, TestWSS) {
sky 2012/08/10 15:54:47 Add a description as to what this is testing.
bashi 2012/08/12 23:13:02 Done.
1463 ASSERT_TRUE(test_server()->Start());
1464 ASSERT_TRUE(https_server_expired_.Start());
1465
1466 // Start pywebsocket with TLS.
1467 content::TestWebSocketServer wss_server;
1468 int port = wss_server.UseRandomPort();
1469 wss_server.UseTLS();
1470 FilePath wss_root_dir;
1471 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir));
1472 ASSERT_TRUE(wss_server.Start(wss_root_dir));
1473
1474 // Setup page title observer.
1475 WebContents* tab = chrome::GetActiveWebContents(browser());
1476 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
1477 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
1478
1479 // Visit bad HTTPS page.
1480 std::string urlPath =
Yuta Kitamura 2012/08/10 06:56:24 url_path
bashi 2012/08/12 23:13:02 Done.
1481 StringPrintf("%s%d%s", "https://localhost:", port, "/wss.html");
1482 ui_test_utils::NavigateToURL(browser(), GURL(urlPath));
1483
1484 // We shouldn't have an interstitial page showing here.
1485
1486 // Test page run a WebSocket wss connection test. The result will be shown
1487 // as page title.
1488 const string16 result = watcher.WaitAndGetTitle();
1489 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass"));
1490 }
1452 1491
1453 // TODO(jcampan): more tests to do below. 1492 // TODO(jcampan): more tests to do below.
1454 1493
1455 // Visit a page over https that contains a frame with a redirect. 1494 // Visit a page over https that contains a frame with a redirect.
1456 1495
1457 // XMLHttpRequest insecure content in synchronous mode. 1496 // XMLHttpRequest insecure content in synchronous mode.
1458 1497
1459 // XMLHttpRequest insecure content in asynchronous mode. 1498 // XMLHttpRequest insecure content in asynchronous mode.
1460 1499
1461 // XMLHttpRequest over bad ssl in synchronous mode. 1500 // XMLHttpRequest over bad ssl in synchronous mode.
1462 1501
1463 // XMLHttpRequest over OK ssl in synchronous mode. 1502 // 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