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" | |
7 #include "base/string_util.h" | |
8 #include "base/stringprintf.h" | |
6 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | |
7 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/tabs/tab_strip_model.h" | 12 #include "chrome/browser/tabs/tab_strip_model.h" |
9 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_navigator.h" | 14 #include "chrome/browser/ui/browser_navigator.h" |
11 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 15 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
13 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
18 #include "chrome/common/chrome_paths.h" | |
14 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
17 #include "content/public/browser/interstitial_page.h" | 22 #include "content/public/browser/interstitial_page.h" |
18 #include "content/public/browser/navigation_controller.h" | 23 #include "content/public/browser/navigation_controller.h" |
19 #include "content/public/browser/navigation_entry.h" | 24 #include "content/public/browser/navigation_entry.h" |
20 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
22 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
23 #include "content/public/browser/web_contents_observer.h" | 28 #include "content/public/browser/web_contents_observer.h" |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 } | 510 } |
506 | 511 |
507 // We should be showing the second good page. | 512 // We should be showing the second good page. |
508 EXPECT_FALSE(browser()->GetSelectedWebContents()->GetInterstitialPage()); | 513 EXPECT_FALSE(browser()->GetSelectedWebContents()->GetInterstitialPage()); |
509 CheckUnauthenticatedState(tab); | 514 CheckUnauthenticatedState(tab); |
510 EXPECT_FALSE(tab->GetController().CanGoForward()); | 515 EXPECT_FALSE(tab->GetController().CanGoForward()); |
511 NavigationEntry* entry4 = tab->GetController().GetActiveEntry(); | 516 NavigationEntry* entry4 = tab->GetController().GetActiveEntry(); |
512 EXPECT_TRUE(entry2 == entry4); | 517 EXPECT_TRUE(entry2 == entry4); |
513 } | 518 } |
514 | 519 |
520 // Visits a HTTPS page and proceeds despite an invalid certificate. The page | |
521 // requests WSS connection to the same origin host to check if WSS connection | |
522 // share certificates policy with HTTPS correcly. | |
523 IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) { | |
524 ASSERT_TRUE(test_server()->Start()); | |
525 ASSERT_TRUE(https_server_expired_.Start()); | |
526 | |
527 // Start pywebsocket with TLS. | |
528 ui_test_utils::TestWebSocketServer wss_server; | |
529 int port = wss_server.UseRandomPort(); | |
530 wss_server.UseTLS(); | |
531 FilePath wss_root_dir; | |
532 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &wss_root_dir)); | |
533 ASSERT_TRUE(wss_server.Start(wss_root_dir)); | |
Takashi Toyoshima
2012/04/02 12:21:49
TestWebSocketServer uses new-run-webkit-websockets
| |
534 | |
535 // Setup page title observer. | |
536 WebContents* tab = browser()->GetSelectedWebContents(); | |
537 ui_test_utils::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | |
538 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | |
539 | |
540 // Visits bad HTTPS page. | |
541 std::string urlPath = | |
542 StringPrintf("%s%d%s", "https://localhost:", port, "/wss.html"); | |
543 ui_test_utils::NavigateToURL(browser(), GURL(urlPath)); | |
544 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | |
545 false, true); // Interstitial showing | |
546 | |
547 // Proceeds anyway. | |
548 ProceedThroughInterstitial(tab); | |
549 | |
550 // Test page run a WebSocket wss connection test. The result will be shown | |
551 // as page title. | |
552 const string16 result = watcher.WaitAndGetTitle(); | |
553 EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); | |
554 } | |
555 | |
515 // Flaky on CrOS http://crbug.com/92292 | 556 // Flaky on CrOS http://crbug.com/92292 |
516 #if defined(OS_CHROMEOS) | 557 #if defined(OS_CHROMEOS) |
517 #define MAYBE_TestHTTPSErrorWithNoNavEntry \ | 558 #define MAYBE_TestHTTPSErrorWithNoNavEntry \ |
518 DISABLED_TestHTTPSErrorWithNoNavEntry | 559 DISABLED_TestHTTPSErrorWithNoNavEntry |
519 #else | 560 #else |
520 #define MAYBE_TestHTTPSErrorWithNoNavEntry TestHTTPSErrorWithNoNavEntry | 561 #define MAYBE_TestHTTPSErrorWithNoNavEntry TestHTTPSErrorWithNoNavEntry |
521 #endif // defined(OS_CHROMEOS) | 562 #endif // defined(OS_CHROMEOS) |
522 | 563 |
523 // Open a page with a HTTPS error in a tab with no prior navigation (through a | 564 // Open a page with a HTTPS error in a tab with no prior navigation (through a |
524 // link with a blank target). This is to test that the lack of navigation entry | 565 // link with a blank target). This is to test that the lack of navigation entry |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1364 | 1405 |
1365 // Visit a page over https that contains a frame with a redirect. | 1406 // Visit a page over https that contains a frame with a redirect. |
1366 | 1407 |
1367 // XMLHttpRequest insecure content in synchronous mode. | 1408 // XMLHttpRequest insecure content in synchronous mode. |
1368 | 1409 |
1369 // XMLHttpRequest insecure content in asynchronous mode. | 1410 // XMLHttpRequest insecure content in asynchronous mode. |
1370 | 1411 |
1371 // XMLHttpRequest over bad ssl in synchronous mode. | 1412 // XMLHttpRequest over bad ssl in synchronous mode. |
1372 | 1413 |
1373 // XMLHttpRequest over OK ssl in synchronous mode. | 1414 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |