| 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir)); | 594 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir)); |
| 595 ASSERT_TRUE(wss_server.Start(wss_root_dir)); | 595 ASSERT_TRUE(wss_server.Start(wss_root_dir)); |
| 596 | 596 |
| 597 // Setup page title observer. | 597 // Setup page title observer. |
| 598 WebContents* tab = chrome::GetActiveWebContents(browser()); | 598 WebContents* tab = chrome::GetActiveWebContents(browser()); |
| 599 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 599 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
| 600 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 600 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
| 601 | 601 |
| 602 // Visit bad HTTPS page. | 602 // Visit bad HTTPS page. |
| 603 std::string urlPath = | 603 std::string urlPath = |
| 604 StringPrintf("%s%d%s", "https://localhost:", port, "/wss.html"); | 604 StringPrintf("%s%d%s", "https://localhost:", port, "/ws.html"); |
| 605 ui_test_utils::NavigateToURL(browser(), GURL(urlPath)); | 605 ui_test_utils::NavigateToURL(browser(), GURL(urlPath)); |
| 606 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 606 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
| 607 false, true); // Interstitial showing | 607 false, true); // Interstitial showing |
| 608 | 608 |
| 609 // Proceed anyway. | 609 // Proceed anyway. |
| 610 ProceedThroughInterstitial(tab); | 610 ProceedThroughInterstitial(tab); |
| 611 | 611 |
| 612 // Test page run a WebSocket wss connection test. The result will be shown | 612 // Test page run a WebSocket wss connection test. The result will be shown |
| 613 // as page title. | 613 // as page title. |
| 614 const string16 result = watcher.WaitAndGetTitle(); | 614 const string16 result = watcher.WaitAndGetTitle(); |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir)); | 1497 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir)); |
| 1498 ASSERT_TRUE(wss_server.Start(wss_root_dir)); | 1498 ASSERT_TRUE(wss_server.Start(wss_root_dir)); |
| 1499 | 1499 |
| 1500 // Setup page title observer. | 1500 // Setup page title observer. |
| 1501 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1501 WebContents* tab = chrome::GetActiveWebContents(browser()); |
| 1502 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 1502 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
| 1503 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 1503 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
| 1504 | 1504 |
| 1505 // Visit bad HTTPS page. | 1505 // Visit bad HTTPS page. |
| 1506 std::string url_path = | 1506 std::string url_path = |
| 1507 StringPrintf("%s%d%s", "https://localhost:", port, "/wss.html"); | 1507 StringPrintf("%s%d%s", "https://localhost:", port, "/ws.html"); |
| 1508 ui_test_utils::NavigateToURL(browser(), GURL(url_path)); | 1508 ui_test_utils::NavigateToURL(browser(), GURL(url_path)); |
| 1509 | 1509 |
| 1510 // We shouldn't have an interstitial page showing here. | 1510 // We shouldn't have an interstitial page showing here. |
| 1511 | 1511 |
| 1512 // Test page run a WebSocket wss connection test. The result will be shown | 1512 // Test page run a WebSocket wss connection test. The result will be shown |
| 1513 // as page title. | 1513 // as page title. |
| 1514 const string16 result = watcher.WaitAndGetTitle(); | 1514 const string16 result = watcher.WaitAndGetTitle(); |
| 1515 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); | 1515 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); |
| 1516 } | 1516 } |
| 1517 | 1517 |
| 1518 // TODO(jcampan): more tests to do below. | 1518 // TODO(jcampan): more tests to do below. |
| 1519 | 1519 |
| 1520 // Visit a page over https that contains a frame with a redirect. | 1520 // Visit a page over https that contains a frame with a redirect. |
| 1521 | 1521 |
| 1522 // XMLHttpRequest insecure content in synchronous mode. | 1522 // XMLHttpRequest insecure content in synchronous mode. |
| 1523 | 1523 |
| 1524 // XMLHttpRequest insecure content in asynchronous mode. | 1524 // XMLHttpRequest insecure content in asynchronous mode. |
| 1525 | 1525 |
| 1526 // XMLHttpRequest over bad ssl in synchronous mode. | 1526 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1527 | 1527 |
| 1528 // XMLHttpRequest over OK ssl in synchronous mode. | 1528 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |