| 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/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 void NavigateTab(TabProxy* tab_proxy, const GURL& url) { | 34 void NavigateTab(TabProxy* tab_proxy, const GURL& url) { |
| 35 ASSERT_TRUE(tab_proxy->NavigateToURL(url)); | 35 ASSERT_TRUE(tab_proxy->NavigateToURL(url)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void AppendTab(const GURL& url) { | 38 void AppendTab(const GURL& url) { |
| 39 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 39 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
| 40 EXPECT_TRUE(browser_proxy.get()); | 40 EXPECT_TRUE(browser_proxy.get()); |
| 41 EXPECT_TRUE(browser_proxy->AppendTab(url)); | 41 EXPECT_TRUE(browser_proxy->AppendTab(url)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 HTTPTestServer* PlainServer() { | 44 TestServer* PlainServer() { |
| 45 return HTTPTestServer::CreateServer(kDocRoot); | 45 return new TestServer(kDocRoot); |
| 46 } | 46 } |
| 47 | 47 |
| 48 HTTPSTestServer* GoodCertServer() { | 48 HTTPSTestServer* GoodCertServer() { |
| 49 return HTTPSTestServer::CreateServer(util_.kHostName, util_.kOKHTTPSPort, | 49 return new HTTPSTestServer(util_.kHostName, util_.kOKHTTPSPort, |
| 50 kDocRoot, util_.GetOKCertPath().ToWStringHack()); | 50 kDocRoot, util_.GetOKCertPath().ToWStringHack()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 HTTPSTestServer* BadCertServer() { | 53 HTTPSTestServer* BadCertServer() { |
| 54 return HTTPSTestServer::CreateServer(util_.kHostName, util_.kBadHTTPSPort, | 54 return new HTTPSTestServer(util_.kHostName, util_.kBadHTTPSPort, |
| 55 kDocRoot, util_.GetExpiredCertPath().ToWStringHack()); | 55 kDocRoot, util_.GetExpiredCertPath().ToWStringHack()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 protected: | 58 protected: |
| 59 SSLTestUtil util_; | 59 SSLTestUtil util_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(SSLUITest); | 61 DISALLOW_COPY_AND_ASSIGN(SSLUITest); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace | 64 } // namespace |
| 65 | 65 |
| 66 // Visits a regular page over http. | 66 // Visits a regular page over http. |
| 67 TEST_F(SSLUITest, TestHTTP) { | 67 TEST_F(SSLUITest, TestHTTP) { |
| 68 scoped_ptr<HTTPTestServer> server(PlainServer()); | 68 scoped_ptr<TestServer> server(PlainServer()); |
| 69 | 69 |
| 70 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 70 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 71 NavigateTab(tab.get(), server->TestServerPageW(L"files/ssl/google.html")); | 71 NavigateTab(tab.get(), server->TestServerPageW(L"files/ssl/google.html")); |
| 72 | 72 |
| 73 NavigationEntry::PageType page_type; | 73 NavigationEntry::PageType page_type; |
| 74 EXPECT_TRUE(tab->GetPageType(&page_type)); | 74 EXPECT_TRUE(tab->GetPageType(&page_type)); |
| 75 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); | 75 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); |
| 76 | 76 |
| 77 SecurityStyle security_style; | 77 SecurityStyle security_style; |
| 78 int cert_status; | 78 int cert_status; |
| 79 int mixed_content_state; | 79 int mixed_content_state; |
| 80 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, | 80 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, |
| 81 &mixed_content_state)); | 81 &mixed_content_state)); |
| 82 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); | 82 EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, security_style); |
| 83 EXPECT_EQ(0, cert_status); | 83 EXPECT_EQ(0, cert_status); |
| 84 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 84 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
| 85 } | 85 } |
| 86 | 86 |
| 87 // Visits a page over http which includes broken https resources (status should | 87 // Visits a page over http which includes broken https resources (status should |
| 88 // be OK). | 88 // be OK). |
| 89 TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { | 89 TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { |
| 90 scoped_ptr<HTTPTestServer> http_server(PlainServer()); | 90 scoped_ptr<TestServer> http_server(PlainServer()); |
| 91 scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer()); | 91 scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer()); |
| 92 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 92 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 93 | 93 |
| 94 NavigateTab(tab.get(), | 94 NavigateTab(tab.get(), |
| 95 http_server->TestServerPageW(L"files/ssl/page_with_unsafe_contents.html"))
; | 95 http_server->TestServerPageW(L"files/ssl/page_with_unsafe_contents.html"))
; |
| 96 | 96 |
| 97 SecurityStyle security_style; | 97 SecurityStyle security_style; |
| 98 int cert_status; | 98 int cert_status; |
| 99 int mixed_content_state; | 99 int mixed_content_state; |
| 100 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, | 100 EXPECT_TRUE(tab->GetSecurityState(&security_style, &cert_status, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 157 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
| 158 } | 158 } |
| 159 | 159 |
| 160 // | 160 // |
| 161 // Mixed contents | 161 // Mixed contents |
| 162 // | 162 // |
| 163 | 163 |
| 164 // Visits a page with mixed content. | 164 // Visits a page with mixed content. |
| 165 TEST_F(SSLUITest, TestMixedContents) { | 165 TEST_F(SSLUITest, TestMixedContents) { |
| 166 scoped_ptr<HTTPSTestServer> https_server(GoodCertServer()); | 166 scoped_ptr<HTTPSTestServer> https_server(GoodCertServer()); |
| 167 scoped_ptr<HTTPTestServer> http_server(PlainServer()); | 167 scoped_ptr<TestServer> http_server(PlainServer()); |
| 168 | 168 |
| 169 // Load a page with mixed-content, the default behavior is to show the mixed | 169 // Load a page with mixed-content, the default behavior is to show the mixed |
| 170 // content. | 170 // content. |
| 171 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 171 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 172 NavigateTab(tab.get(), | 172 NavigateTab(tab.get(), |
| 173 https_server->TestServerPageW(L"files/ssl/page_with_mixed_contents.html"))
; | 173 https_server->TestServerPageW(L"files/ssl/page_with_mixed_contents.html"))
; |
| 174 NavigationEntry::PageType page_type; | 174 NavigationEntry::PageType page_type; |
| 175 EXPECT_TRUE(tab->GetPageType(&page_type)); | 175 EXPECT_TRUE(tab->GetPageType(&page_type)); |
| 176 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); | 176 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); |
| 177 | 177 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 bool js_result = false; | 279 bool js_result = false; |
| 280 EXPECT_TRUE(tab->ExecuteAndExtractBool(L"", | 280 EXPECT_TRUE(tab->ExecuteAndExtractBool(L"", |
| 281 L"window.domAutomationController.send(IsFooSet());", | 281 L"window.domAutomationController.send(IsFooSet());", |
| 282 &js_result)); | 282 &js_result)); |
| 283 EXPECT_FALSE(js_result); | 283 EXPECT_FALSE(js_result); |
| 284 } | 284 } |
| 285 | 285 |
| 286 // Visits a page with mixed content loaded by JS (after the initial page load). | 286 // Visits a page with mixed content loaded by JS (after the initial page load). |
| 287 TEST_F(SSLUITest, TestMixedContentsLoadedFromJS) { | 287 TEST_F(SSLUITest, TestMixedContentsLoadedFromJS) { |
| 288 scoped_ptr<HTTPSTestServer> https_server(GoodCertServer()); | 288 scoped_ptr<HTTPSTestServer> https_server(GoodCertServer()); |
| 289 scoped_ptr<HTTPTestServer> http_server(PlainServer()); | 289 scoped_ptr<TestServer> http_server(PlainServer()); |
| 290 | 290 |
| 291 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 291 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 292 NavigateTab(tab.get(), https_server->TestServerPageW( | 292 NavigateTab(tab.get(), https_server->TestServerPageW( |
| 293 L"files/ssl/page_with_dynamic_mixed_contents.html")); | 293 L"files/ssl/page_with_dynamic_mixed_contents.html")); |
| 294 NavigationEntry::PageType page_type; | 294 NavigationEntry::PageType page_type; |
| 295 EXPECT_TRUE(tab->GetPageType(&page_type)); | 295 EXPECT_TRUE(tab->GetPageType(&page_type)); |
| 296 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); | 296 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); |
| 297 SecurityStyle security_style; | 297 SecurityStyle security_style; |
| 298 int cert_status; | 298 int cert_status; |
| 299 int mixed_content_state; | 299 int mixed_content_state; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 318 EXPECT_EQ(0, | 318 EXPECT_EQ(0, |
| 319 cert_status & net::CERT_STATUS_ALL_ERRORS); // No errors expected. | 319 cert_status & net::CERT_STATUS_ALL_ERRORS); // No errors expected. |
| 320 EXPECT_EQ(NavigationEntry::SSLStatus::MIXED_CONTENT, mixed_content_state); | 320 EXPECT_EQ(NavigationEntry::SSLStatus::MIXED_CONTENT, mixed_content_state); |
| 321 } | 321 } |
| 322 | 322 |
| 323 // Visits a page with an image over http. Visits another page over https | 323 // Visits a page with an image over http. Visits another page over https |
| 324 // referencing that same image over http (hoping it is coming from the webcore | 324 // referencing that same image over http (hoping it is coming from the webcore |
| 325 // memory cache). | 325 // memory cache). |
| 326 TEST_F(SSLUITest, TestCachedMixedContents) { | 326 TEST_F(SSLUITest, TestCachedMixedContents) { |
| 327 scoped_ptr<HTTPSTestServer> https_server(GoodCertServer()); | 327 scoped_ptr<HTTPSTestServer> https_server(GoodCertServer()); |
| 328 scoped_ptr<HTTPTestServer> http_server(PlainServer()); | 328 scoped_ptr<TestServer> http_server(PlainServer()); |
| 329 | 329 |
| 330 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 330 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 331 NavigateTab(tab.get(), http_server->TestServerPageW( | 331 NavigateTab(tab.get(), http_server->TestServerPageW( |
| 332 L"files/ssl/page_with_mixed_contents.html")); | 332 L"files/ssl/page_with_mixed_contents.html")); |
| 333 | 333 |
| 334 NavigationEntry::PageType page_type; | 334 NavigationEntry::PageType page_type; |
| 335 EXPECT_TRUE(tab->GetPageType(&page_type)); | 335 EXPECT_TRUE(tab->GetPageType(&page_type)); |
| 336 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); | 336 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, page_type); |
| 337 SecurityStyle security_style; | 337 SecurityStyle security_style; |
| 338 int cert_status; | 338 int cert_status; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 357 EXPECT_EQ(0, | 357 EXPECT_EQ(0, |
| 358 cert_status & net::CERT_STATUS_ALL_ERRORS); // No errors expected. | 358 cert_status & net::CERT_STATUS_ALL_ERRORS); // No errors expected. |
| 359 EXPECT_EQ(NavigationEntry::SSLStatus::MIXED_CONTENT, mixed_content_state); | 359 EXPECT_EQ(NavigationEntry::SSLStatus::MIXED_CONTENT, mixed_content_state); |
| 360 } | 360 } |
| 361 | 361 |
| 362 // This test ensures the CN invalid status does not 'stick' to a certificate | 362 // This test ensures the CN invalid status does not 'stick' to a certificate |
| 363 // (see bug #1044942) and that it depends on the host-name. | 363 // (see bug #1044942) and that it depends on the host-name. |
| 364 // TODO(jcampan): this test is flacky and fails sometimes (bug #1065095) | 364 // TODO(jcampan): this test is flacky and fails sometimes (bug #1065095) |
| 365 TEST_F(SSLUITest, DISABLED_TestCNInvalidStickiness) { | 365 TEST_F(SSLUITest, DISABLED_TestCNInvalidStickiness) { |
| 366 const std::string kLocalHost = "localhost"; | 366 const std::string kLocalHost = "localhost"; |
| 367 scoped_refptr<HTTPSTestServer> https_server = | 367 scoped_ptr<HTTPSTestServer> https_server( |
| 368 HTTPSTestServer::CreateServer(kLocalHost, util_.kOKHTTPSPort, | 368 new HTTPSTestServer(kLocalHost, util_.kOKHTTPSPort, |
| 369 kDocRoot, util_.GetOKCertPath().ToWStringHack()); | 369 kDocRoot, util_.GetOKCertPath().ToWStringHack())); |
| 370 ASSERT_TRUE(NULL != https_server.get()); | |
| 371 | 370 |
| 372 // First we hit the server with hostname, this generates an invalid policy | 371 // First we hit the server with hostname, this generates an invalid policy |
| 373 // error. | 372 // error. |
| 374 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 373 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 375 NavigateTab(tab.get(), https_server->TestServerPageW( | 374 NavigateTab(tab.get(), https_server->TestServerPageW( |
| 376 L"files/ssl/google.html")); | 375 L"files/ssl/google.html")); |
| 377 | 376 |
| 378 // We get an interstitial page as a result. | 377 // We get an interstitial page as a result. |
| 379 NavigationEntry::PageType page_type; | 378 NavigationEntry::PageType page_type; |
| 380 EXPECT_TRUE(tab->GetPageType(&page_type)); | 379 EXPECT_TRUE(tab->GetPageType(&page_type)); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); | 468 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); |
| 470 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, | 469 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, |
| 471 cert_status & net::CERT_STATUS_ALL_ERRORS); | 470 cert_status & net::CERT_STATUS_ALL_ERRORS); |
| 472 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 471 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
| 473 } | 472 } |
| 474 | 473 |
| 475 // Tests that closing a page that has a unsafe pop-up does not crash the browser | 474 // Tests that closing a page that has a unsafe pop-up does not crash the browser |
| 476 // (bug #1966). | 475 // (bug #1966). |
| 477 // Disabled because flaky (bug #2136). | 476 // Disabled because flaky (bug #2136). |
| 478 TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { | 477 TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { |
| 479 scoped_ptr<HTTPTestServer> http_server(PlainServer()); | 478 scoped_ptr<TestServer> http_server(PlainServer()); |
| 480 scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer()); | 479 scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer()); |
| 481 | 480 |
| 482 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 481 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 483 NavigateTab(tab.get(), | 482 NavigateTab(tab.get(), |
| 484 http_server->TestServerPageW( | 483 http_server->TestServerPageW( |
| 485 L"files/ssl/page_with_unsafe_popup.html")); | 484 L"files/ssl/page_with_unsafe_popup.html")); |
| 486 | 485 |
| 487 int popup_count = 0; | 486 int popup_count = 0; |
| 488 EXPECT_TRUE(tab->GetConstrainedWindowCount(&popup_count)); | 487 EXPECT_TRUE(tab->GetConstrainedWindowCount(&popup_count)); |
| 489 EXPECT_EQ(1, popup_count); | 488 EXPECT_EQ(1, popup_count); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 &mixed_content_state)); | 554 &mixed_content_state)); |
| 556 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); | 555 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); |
| 557 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, | 556 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, |
| 558 cert_status & net::CERT_STATUS_ALL_ERRORS); | 557 cert_status & net::CERT_STATUS_ALL_ERRORS); |
| 559 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 558 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
| 560 } | 559 } |
| 561 | 560 |
| 562 // Visit a page over http that is a redirect to a page with https (good and | 561 // Visit a page over http that is a redirect to a page with https (good and |
| 563 // bad). | 562 // bad). |
| 564 TEST_F(SSLUITest, TestRedirectHTTPToHTTPS) { | 563 TEST_F(SSLUITest, TestRedirectHTTPToHTTPS) { |
| 565 scoped_ptr<HTTPTestServer> http_server(PlainServer()); | 564 scoped_ptr<TestServer> http_server(PlainServer()); |
| 566 scoped_ptr<HTTPSTestServer> good_https_server(GoodCertServer()); | 565 scoped_ptr<HTTPSTestServer> good_https_server(GoodCertServer()); |
| 567 scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer()); | 566 scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer()); |
| 568 | 567 |
| 569 // HTTP redirects to good HTTPS. | 568 // HTTP redirects to good HTTPS. |
| 570 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 569 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 571 GURL http_url = http_server->TestServerPageW(L"server-redirect?"); | 570 GURL http_url = http_server->TestServerPageW(L"server-redirect?"); |
| 572 GURL good_https_url = | 571 GURL good_https_url = |
| 573 good_https_server->TestServerPageW(L"files/ssl/google.html"); | 572 good_https_server->TestServerPageW(L"files/ssl/google.html"); |
| 574 NavigateTab(tab.get(), GURL(http_url.spec() + good_https_url.spec())); | 573 NavigateTab(tab.get(), GURL(http_url.spec() + good_https_url.spec())); |
| 575 | 574 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 598 &mixed_content_state)); | 597 &mixed_content_state)); |
| 599 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); | 598 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); |
| 600 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, | 599 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, |
| 601 cert_status & net::CERT_STATUS_ALL_ERRORS); | 600 cert_status & net::CERT_STATUS_ALL_ERRORS); |
| 602 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 601 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
| 603 } | 602 } |
| 604 | 603 |
| 605 // Visit a page over https that is a redirect to a page with http (to make sure | 604 // Visit a page over https that is a redirect to a page with http (to make sure |
| 606 // we don't keep the secure state). | 605 // we don't keep the secure state). |
| 607 TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) { | 606 TEST_F(SSLUITest, TestRedirectHTTPSToHTTP) { |
| 608 scoped_ptr<HTTPTestServer> http_server(PlainServer()); | 607 scoped_ptr<TestServer> http_server(PlainServer()); |
| 609 scoped_ptr<HTTPSTestServer> https_server(GoodCertServer()); | 608 scoped_ptr<HTTPSTestServer> https_server(GoodCertServer()); |
| 610 | 609 |
| 611 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 610 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 612 GURL https_url = https_server->TestServerPageW(L"server-redirect?"); | 611 GURL https_url = https_server->TestServerPageW(L"server-redirect?"); |
| 613 GURL http_url = http_server->TestServerPageW(L"files/ssl/google.html"); | 612 GURL http_url = http_server->TestServerPageW(L"files/ssl/google.html"); |
| 614 NavigateTab(tab.get(), GURL(https_url.spec() + http_url.spec())); | 613 NavigateTab(tab.get(), GURL(https_url.spec() + http_url.spec())); |
| 615 | 614 |
| 616 SecurityStyle security_style; | 615 SecurityStyle security_style; |
| 617 int cert_status; | 616 int cert_status; |
| 618 int mixed_content_state; | 617 int mixed_content_state; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 // | 653 // |
| 655 // Frame navigation | 654 // Frame navigation |
| 656 // | 655 // |
| 657 | 656 |
| 658 // From a good HTTPS top frame: | 657 // From a good HTTPS top frame: |
| 659 // - navigate to an OK HTTPS frame | 658 // - navigate to an OK HTTPS frame |
| 660 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then | 659 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then |
| 661 // back | 660 // back |
| 662 // - navigate to HTTP (expect mixed content), then back | 661 // - navigate to HTTP (expect mixed content), then back |
| 663 TEST_F(SSLUITest, TestGoodFrameNavigation) { | 662 TEST_F(SSLUITest, TestGoodFrameNavigation) { |
| 664 scoped_ptr<HTTPTestServer> http_server(PlainServer()); | 663 scoped_ptr<TestServer> http_server(PlainServer()); |
| 665 scoped_ptr<HTTPSTestServer> good_https_server(GoodCertServer()); | 664 scoped_ptr<HTTPSTestServer> good_https_server(GoodCertServer()); |
| 666 scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer()); | 665 scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer()); |
| 667 | 666 |
| 668 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 667 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 669 NavigateTab(tab.get(), | 668 NavigateTab(tab.get(), |
| 670 good_https_server->TestServerPageW(L"files/ssl/top_frame.html")); | 669 good_https_server->TestServerPageW(L"files/ssl/top_frame.html")); |
| 671 | 670 |
| 672 SecurityStyle security_style; | 671 SecurityStyle security_style; |
| 673 int cert_status; | 672 int cert_status; |
| 674 int mixed_content_state; | 673 int mixed_content_state; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 &mixed_content_state)); | 791 &mixed_content_state)); |
| 793 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); | 792 EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, security_style); |
| 794 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, | 793 EXPECT_EQ(net::CERT_STATUS_DATE_INVALID, |
| 795 cert_status & net::CERT_STATUS_ALL_ERRORS); | 794 cert_status & net::CERT_STATUS_ALL_ERRORS); |
| 796 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); | 795 EXPECT_EQ(NavigationEntry::SSLStatus::NORMAL_CONTENT, mixed_content_state); |
| 797 } | 796 } |
| 798 | 797 |
| 799 // From an HTTP top frame, navigate to good and bad HTTPS (security state should | 798 // From an HTTP top frame, navigate to good and bad HTTPS (security state should |
| 800 // stay unauthenticated). | 799 // stay unauthenticated). |
| 801 TEST_F(SSLUITest, TestUnauthenticatedFrameNavigation) { | 800 TEST_F(SSLUITest, TestUnauthenticatedFrameNavigation) { |
| 802 scoped_ptr<HTTPTestServer> http_server(PlainServer()); | 801 scoped_ptr<TestServer> http_server(PlainServer()); |
| 803 scoped_ptr<HTTPSTestServer> good_https_server(GoodCertServer()); | 802 scoped_ptr<HTTPSTestServer> good_https_server(GoodCertServer()); |
| 804 scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer()); | 803 scoped_ptr<HTTPSTestServer> bad_https_server(BadCertServer()); |
| 805 | 804 |
| 806 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 805 scoped_ptr<TabProxy> tab(GetActiveTabProxy()); |
| 807 NavigateTab(tab.get(), | 806 NavigateTab(tab.get(), |
| 808 http_server->TestServerPageW(L"files/ssl/top_frame.html")); | 807 http_server->TestServerPageW(L"files/ssl/top_frame.html")); |
| 809 | 808 |
| 810 SecurityStyle security_style; | 809 SecurityStyle security_style; |
| 811 int cert_status; | 810 int cert_status; |
| 812 int mixed_content_state; | 811 int mixed_content_state; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 | 864 |
| 866 // Visit a page over https that contains a frame with a redirect. | 865 // Visit a page over https that contains a frame with a redirect. |
| 867 | 866 |
| 868 // XMLHttpRequest mixed in synchronous mode. | 867 // XMLHttpRequest mixed in synchronous mode. |
| 869 | 868 |
| 870 // XMLHttpRequest mixed in asynchronous mode. | 869 // XMLHttpRequest mixed in asynchronous mode. |
| 871 | 870 |
| 872 // XMLHttpRequest over bad ssl in synchronous mode. | 871 // XMLHttpRequest over bad ssl in synchronous mode. |
| 873 | 872 |
| 874 // XMLHttpRequest over OK ssl in synchronous mode. | 873 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |