OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <Windows.h> | 5 #include <Windows.h> |
6 #include <Wincrypt.h> | 6 #include <Wincrypt.h> |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, | 116 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, |
117 &mixed_content_state)); | 117 &mixed_content_state)); |
118 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); | 118 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); |
119 EXPECT_EQ(0, cert_status); | 119 EXPECT_EQ(0, cert_status); |
120 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 120 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
121 } | 121 } |
122 | 122 |
123 // Visits a page over http which includes broken https resources (status should | 123 // Visits a page over http which includes broken https resources (status should |
124 // be OK). | 124 // be OK). |
125 TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { | 125 TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { |
126 TestServer httpServer(kDocRoot); | 126 TestServer http_server(kDocRoot); |
127 HTTPSTestServer httpsServer(kHostName, kBadHTTPSPort, | 127 HTTPSTestServer httpsServer(kHostName, kBadHTTPSPort, |
128 kDocRoot, GetExpiredCertPath()); | 128 kDocRoot, GetExpiredCertPath()); |
129 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 129 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
130 | 130 |
131 NavigateTab(tab.get(), | 131 NavigateTab(tab.get(), |
132 httpServer.TestServerPageW(L"files/ssl/page_with_unsafe_contents.html")); | 132 http_server.TestServerPageW(L"files/ssl/page_with_unsafe_contents.html")); |
133 | 133 |
134 SecurityStyle security_style; | 134 SecurityStyle security_style; |
135 int cert_status; | 135 int cert_status; |
136 int mixed_content_state; | 136 int mixed_content_state; |
137 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, | 137 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, |
138 &mixed_content_state)); | 138 &mixed_content_state)); |
139 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); | 139 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); |
140 EXPECT_EQ(0, cert_status); | 140 EXPECT_EQ(0, cert_status); |
141 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 141 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
142 } | 142 } |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 NavigateTab(tab.get(), | 463 NavigateTab(tab.get(), |
464 https_server.TestServerPageW(L"files/ssl/page_with_refs.html#jp")); | 464 https_server.TestServerPageW(L"files/ssl/page_with_refs.html#jp")); |
465 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, | 465 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, |
466 &mixed_content_state)); | 466 &mixed_content_state)); |
467 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); | 467 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); |
468 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, | 468 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, |
469 cert_status & net::CERT_STATUS_ALL_ERRORS); | 469 cert_status & net::CERT_STATUS_ALL_ERRORS); |
470 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 470 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
471 } | 471 } |
472 | 472 |
| 473 // Tests that closing a page that has a unsafe pop-up does not crash the browser |
| 474 // (bug #1966). |
| 475 TEST_F(SSLUITest, TestCloseTabWithUnsafePopup) { |
| 476 TestServer http_server(kDocRoot); |
| 477 HTTPSTestServer bad_https_server(kHostName, kBadHTTPSPort, |
| 478 kDocRoot, GetExpiredCertPath()); |
| 479 |
| 480 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 481 NavigateTab(tab.get(), |
| 482 http_server.TestServerPageW( |
| 483 L"files/ssl/page_with_unsafe_popup.html")); |
| 484 |
| 485 int popup_count = 0; |
| 486 EXPECT_TRUE(tab->GetConstrainedWindowCount(&popup_count)); |
| 487 EXPECT_EQ(1, popup_count); |
| 488 |
| 489 // Let's add another tab to make sure the browser does not exit when we close |
| 490 // the first tab. |
| 491 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
| 492 EXPECT_TRUE(browser_proxy.get()); |
| 493 browser_proxy->AppendTab( |
| 494 http_server.TestServerPageW(L"files/ssl/google.html")); |
| 495 |
| 496 // Close the first tab. |
| 497 tab->Close(); |
| 498 } |
| 499 |
473 // TODO (jcampan): more tests to do below. | 500 // TODO (jcampan): more tests to do below. |
474 | 501 |
475 // Visit a page over bad https that is a redirect to a page with good https. | 502 // Visit a page over bad https that is a redirect to a page with good https. |
476 | 503 |
477 // Visit a page over good https that is a redirect to a page with bad https. | 504 // Visit a page over good https that is a redirect to a page with bad https. |
478 | 505 |
479 // Visit a page over http that is a redirect to a page with https (good and | 506 // Visit a page over http that is a redirect to a page with https (good and |
480 // bad). | 507 // bad). |
481 | 508 |
482 // Visit a page over https that is a redirect to a page with http. | 509 // Visit a page over https that is a redirect to a page with http. |
483 | 510 |
484 // Visit a page over https that contains a frame with a redirect. | 511 // Visit a page over https that contains a frame with a redirect. |
485 | 512 |
486 // Visits a page to which we could not connect (bad port) over http and https | 513 // Visits a page to which we could not connect (bad port) over http and https |
487 | 514 |
488 // XMLHttpRequest mixed in synchronous mode. | 515 // XMLHttpRequest mixed in synchronous mode. |
489 | 516 |
490 // XMLHttpRequest mixed in asynchronous mode. | 517 // XMLHttpRequest mixed in asynchronous mode. |
491 | 518 |
492 // XMLHttpRequest over bad ssl in synchronous mode. | 519 // XMLHttpRequest over bad ssl in synchronous mode. |
493 | 520 |
494 // XMLHttpRequest over OK ssl in synchronous mode. | 521 // XMLHttpRequest over OK ssl in synchronous mode. |
495 | 522 |
496 // | 523 // |
497 // Frame navigation | 524 // Frame navigation |
498 // | 525 // |
499 | 526 |
500 // Navigate to broken frame and back. | 527 // Navigate to broken frame and back. |
501 | 528 |
OLD | NEW |