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/common/filter_policy.h" | 10 #include "chrome/common/filter_policy.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 80 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
81 } | 81 } |
82 | 82 |
83 // Visits a page over http which includes broken https resources (status should | 83 // Visits a page over http which includes broken https resources (status should |
84 // be OK). | 84 // be OK). |
85 TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { | 85 TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { |
86 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 86 scoped_refptr<HTTPTestServer> http_server = PlainServer(); |
87 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 87 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); |
88 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 88 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
89 | 89 |
90 NavigateTab(tab.get(), | 90 NavigateTab( |
91 http_server->TestServerPageW(L"files/ssl/page_with_unsafe_contents.html"))
; | 91 tab.get(), |
| 92 http_server->TestServerPageW( |
| 93 L"files/ssl/page_with_unsafe_contents.html")); |
92 | 94 |
93 SecurityStyle security_style; | 95 SecurityStyle security_style; |
94 int cert_status; | 96 int cert_status; |
95 int mixed_content_state; | 97 int mixed_content_state; |
96 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, | 98 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, |
97 &mixed_content_state)); | 99 &mixed_content_state)); |
98 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); | 100 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); |
99 EXPECT_EQ(0, cert_status); | 101 EXPECT_EQ(0, cert_status); |
100 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 102 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
101 } | 103 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // | 218 // |
217 | 219 |
218 // Visits a page with mixed content. | 220 // Visits a page with mixed content. |
219 TEST_F(SSLUITest, TestMixedContents) { | 221 TEST_F(SSLUITest, TestMixedContents) { |
220 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 222 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); |
221 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 223 scoped_refptr<HTTPTestServer> http_server = PlainServer(); |
222 | 224 |
223 // Load a page with mixed-content, the default behavior is to show the mixed | 225 // Load a page with mixed-content, the default behavior is to show the mixed |
224 // content. | 226 // content. |
225 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 227 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
226 NavigateTab(tab.get(), | 228 NavigateTab( |
227 https_server->TestServerPageW(L"files/ssl/page_with_mixed_contents.html"))
; | 229 tab.get(), |
| 230 https_server->TestServerPageW( |
| 231 L"files/ssl/page_with_mixed_contents.html")); |
228 NavigationEntry::PageType page_type; | 232 NavigationEntry::PageType page_type; |
229 EXPECT_TRUE(tab->GetPageType(&page_type)); | 233 EXPECT_TRUE(tab->GetPageType(&page_type)); |
230 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); | 234 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); |
231 | 235 |
232 SecurityStyle security_style; | 236 SecurityStyle security_style; |
233 int cert_status; | 237 int cert_status; |
234 int mixed_content_state; | 238 int mixed_content_state; |
235 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, | 239 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, |
236 &mixed_content_state)); | 240 &mixed_content_state)); |
237 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style); | 241 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, security_style); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); | 485 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); |
482 EXPECT_EQ(net::CERT_STATUS_COMMON_NAME_INVALID, | 486 EXPECT_EQ(net::CERT_STATUS_COMMON_NAME_INVALID, |
483 cert_status & net::CERT_STATUS_ALL_ERRORS); | 487 cert_status & net::CERT_STATUS_ALL_ERRORS); |
484 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 488 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
485 } | 489 } |
486 | 490 |
487 // Test that navigating to a #ref does not change a bad security state. | 491 // Test that navigating to a #ref does not change a bad security state. |
488 TEST_F(SSLUITest, TestRefNavigation) { | 492 TEST_F(SSLUITest, TestRefNavigation) { |
489 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 493 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); |
490 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 494 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
491 NavigateTab(tab.get(), | 495 NavigateTab( |
492 bad_https_server->TestServerPageW(L"files/ssl/page_with_refs.html"
)); | 496 tab.get(), |
| 497 bad_https_server->TestServerPageW(L"files/ssl/page_with_refs.html")); |
493 | 498 |
494 NavigationEntry::PageType page_type; | 499 NavigationEntry::PageType page_type; |
495 EXPECT_TRUE(tab->GetPageType(&page_type)); | 500 EXPECT_TRUE(tab->GetPageType(&page_type)); |
496 EXPECT_EQ(page_type, NavigationEntry::INTERSTITIAL_PAGE); | 501 EXPECT_EQ(page_type, NavigationEntry::INTERSTITIAL_PAGE); |
497 | 502 |
498 SecurityStyle security_style; | 503 SecurityStyle security_style; |
499 int cert_status; | 504 int cert_status; |
500 int mixed_content_state; | 505 int mixed_content_state; |
501 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, | 506 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, |
502 &mixed_content_state)); | 507 &mixed_content_state)); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 | 923 |
919 // Visit a page over https that contains a frame with a redirect. | 924 // Visit a page over https that contains a frame with a redirect. |
920 | 925 |
921 // XMLHttpRequest mixed in synchronous mode. | 926 // XMLHttpRequest mixed in synchronous mode. |
922 | 927 |
923 // XMLHttpRequest mixed in asynchronous mode. | 928 // XMLHttpRequest mixed in asynchronous mode. |
924 | 929 |
925 // XMLHttpRequest over bad ssl in synchronous mode. | 930 // XMLHttpRequest over bad ssl in synchronous mode. |
926 | 931 |
927 // XMLHttpRequest over OK ssl in synchronous mode. | 932 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |