| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ssl/security_state_model.h" | 5 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "chrome/browser/ssl/cert_verifier_browser_test.h" | 12 #include "chrome/browser/ssl/cert_verifier_browser_test.h" |
| 13 #include "chrome/browser/ssl/chrome_security_state_model_client.h" | 13 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 14 #include "chrome/browser/ssl/ssl_blocking_page.h" | 14 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 31 #include "net/cert/cert_status_flags.h" | 31 #include "net/cert/cert_status_flags.h" |
| 32 #include "net/cert/cert_verify_result.h" | 32 #include "net/cert/cert_verify_result.h" |
| 33 #include "net/cert/mock_cert_verifier.h" | 33 #include "net/cert/mock_cert_verifier.h" |
| 34 #include "net/cert/x509_certificate.h" | 34 #include "net/cert/x509_certificate.h" |
| 35 #include "net/dns/mock_host_resolver.h" | 35 #include "net/dns/mock_host_resolver.h" |
| 36 #include "net/test/embedded_test_server/embedded_test_server.h" | 36 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 37 #include "net/test/embedded_test_server/request_handler_util.h" | 37 #include "net/test/embedded_test_server/request_handler_util.h" |
| 38 #include "net/test/url_request/url_request_failed_job.h" | 38 #include "net/test/url_request/url_request_failed_job.h" |
| 39 #include "net/url_request/url_request_filter.h" | 39 #include "net/url_request/url_request_filter.h" |
| 40 | 40 |
| 41 using security_state::SecurityStateModel; |
| 42 |
| 41 namespace { | 43 namespace { |
| 42 | 44 |
| 43 const base::FilePath::CharType kDocRoot[] = | 45 const base::FilePath::CharType kDocRoot[] = |
| 44 FILE_PATH_LITERAL("chrome/test/data"); | 46 FILE_PATH_LITERAL("chrome/test/data"); |
| 45 | 47 |
| 46 void CheckSecurityInfoForSecure( | 48 void CheckSecurityInfoForSecure( |
| 47 content::WebContents* contents, | 49 content::WebContents* contents, |
| 48 SecurityStateModel::SecurityLevel expect_security_level, | 50 SecurityStateModel::SecurityLevel expect_security_level, |
| 49 SecurityStateModel::SHA1DeprecationStatus expect_sha1_status, | 51 SecurityStateModel::SHA1DeprecationStatus expect_sha1_status, |
| 50 SecurityStateModel::MixedContentStatus expect_mixed_content_status, | 52 SecurityStateModel::MixedContentStatus expect_mixed_content_status, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 security_info.sha1_deprecation_status); | 85 security_info.sha1_deprecation_status); |
| 84 EXPECT_EQ(SecurityStateModel::NO_MIXED_CONTENT, | 86 EXPECT_EQ(SecurityStateModel::NO_MIXED_CONTENT, |
| 85 security_info.mixed_content_status); | 87 security_info.mixed_content_status); |
| 86 EXPECT_TRUE(security_info.sct_verify_statuses.empty()); | 88 EXPECT_TRUE(security_info.sct_verify_statuses.empty()); |
| 87 EXPECT_FALSE(security_info.scheme_is_cryptographic); | 89 EXPECT_FALSE(security_info.scheme_is_cryptographic); |
| 88 EXPECT_FALSE(net::IsCertStatusError(security_info.cert_status)); | 90 EXPECT_FALSE(net::IsCertStatusError(security_info.cert_status)); |
| 89 EXPECT_EQ(-1, security_info.security_bits); | 91 EXPECT_EQ(-1, security_info.security_bits); |
| 90 EXPECT_EQ(0, security_info.cert_id); | 92 EXPECT_EQ(0, security_info.cert_id); |
| 91 } | 93 } |
| 92 | 94 |
| 93 class SecurityStateModelTest : public CertVerifierBrowserTest { | 95 class ChromeSecurityStateModelClientTest : public CertVerifierBrowserTest { |
| 94 public: | 96 public: |
| 95 SecurityStateModelTest() | 97 ChromeSecurityStateModelClientTest() |
| 96 : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { | 98 : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { |
| 97 https_server_.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); | 99 https_server_.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); |
| 98 } | 100 } |
| 99 | 101 |
| 100 void SetUpCommandLine(base::CommandLine* command_line) override { | 102 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 101 // Browser will both run and display insecure content. | 103 // Browser will both run and display insecure content. |
| 102 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); | 104 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); |
| 103 } | 105 } |
| 104 | 106 |
| 105 void ProceedThroughInterstitial(content::WebContents* tab) { | 107 void ProceedThroughInterstitial(content::WebContents* tab) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 134 verify_result.verified_cert = cert; | 136 verify_result.verified_cert = cert; |
| 135 verify_result.cert_status = cert_status; | 137 verify_result.cert_status = cert_status; |
| 136 | 138 |
| 137 mock_cert_verifier()->AddResultForCert(cert.get(), verify_result, | 139 mock_cert_verifier()->AddResultForCert(cert.get(), verify_result, |
| 138 net_result); | 140 net_result); |
| 139 } | 141 } |
| 140 | 142 |
| 141 net::EmbeddedTestServer https_server_; | 143 net::EmbeddedTestServer https_server_; |
| 142 | 144 |
| 143 private: | 145 private: |
| 144 DISALLOW_COPY_AND_ASSIGN(SecurityStateModelTest); | 146 DISALLOW_COPY_AND_ASSIGN(ChromeSecurityStateModelClientTest); |
| 145 }; | 147 }; |
| 146 | 148 |
| 147 IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, HttpPage) { | 149 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, HttpPage) { |
| 148 ASSERT_TRUE(embedded_test_server()->Start()); | 150 ASSERT_TRUE(embedded_test_server()->Start()); |
| 149 ui_test_utils::NavigateToURL( | 151 ui_test_utils::NavigateToURL( |
| 150 browser(), embedded_test_server()->GetURL("/ssl/google.html")); | 152 browser(), embedded_test_server()->GetURL("/ssl/google.html")); |
| 151 content::WebContents* contents = | 153 content::WebContents* contents = |
| 152 browser()->tab_strip_model()->GetActiveWebContents(); | 154 browser()->tab_strip_model()->GetActiveWebContents(); |
| 153 ASSERT_TRUE(contents); | 155 ASSERT_TRUE(contents); |
| 154 | 156 |
| 155 ChromeSecurityStateModelClient* model_client = | 157 ChromeSecurityStateModelClient* model_client = |
| 156 ChromeSecurityStateModelClient::FromWebContents(contents); | 158 ChromeSecurityStateModelClient::FromWebContents(contents); |
| 157 ASSERT_TRUE(model_client); | 159 ASSERT_TRUE(model_client); |
| 158 const SecurityStateModel::SecurityInfo& security_info = | 160 const SecurityStateModel::SecurityInfo& security_info = |
| 159 model_client->GetSecurityInfo(); | 161 model_client->GetSecurityInfo(); |
| 160 EXPECT_EQ(SecurityStateModel::NONE, security_info.security_level); | 162 EXPECT_EQ(SecurityStateModel::NONE, security_info.security_level); |
| 161 EXPECT_EQ(SecurityStateModel::NO_DEPRECATED_SHA1, | 163 EXPECT_EQ(SecurityStateModel::NO_DEPRECATED_SHA1, |
| 162 security_info.sha1_deprecation_status); | 164 security_info.sha1_deprecation_status); |
| 163 EXPECT_EQ(SecurityStateModel::NO_MIXED_CONTENT, | 165 EXPECT_EQ(SecurityStateModel::NO_MIXED_CONTENT, |
| 164 security_info.mixed_content_status); | 166 security_info.mixed_content_status); |
| 165 EXPECT_TRUE(security_info.sct_verify_statuses.empty()); | 167 EXPECT_TRUE(security_info.sct_verify_statuses.empty()); |
| 166 EXPECT_FALSE(security_info.scheme_is_cryptographic); | 168 EXPECT_FALSE(security_info.scheme_is_cryptographic); |
| 167 EXPECT_FALSE(net::IsCertStatusError(security_info.cert_status)); | 169 EXPECT_FALSE(net::IsCertStatusError(security_info.cert_status)); |
| 168 EXPECT_EQ(0, security_info.cert_id); | 170 EXPECT_EQ(0, security_info.cert_id); |
| 169 EXPECT_EQ(-1, security_info.security_bits); | 171 EXPECT_EQ(-1, security_info.security_bits); |
| 170 EXPECT_EQ(0, security_info.connection_status); | 172 EXPECT_EQ(0, security_info.connection_status); |
| 171 } | 173 } |
| 172 | 174 |
| 173 IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, HttpsPage) { | 175 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, HttpsPage) { |
| 174 ASSERT_TRUE(https_server_.Start()); | 176 ASSERT_TRUE(https_server_.Start()); |
| 175 SetUpMockCertVerifierForHttpsServer(0, net::OK); | 177 SetUpMockCertVerifierForHttpsServer(0, net::OK); |
| 176 | 178 |
| 177 ui_test_utils::NavigateToURL(browser(), | 179 ui_test_utils::NavigateToURL(browser(), |
| 178 https_server_.GetURL("/ssl/google.html")); | 180 https_server_.GetURL("/ssl/google.html")); |
| 179 CheckSecurityInfoForSecure( | 181 CheckSecurityInfoForSecure( |
| 180 browser()->tab_strip_model()->GetActiveWebContents(), | 182 browser()->tab_strip_model()->GetActiveWebContents(), |
| 181 SecurityStateModel::SECURE, SecurityStateModel::NO_DEPRECATED_SHA1, | 183 SecurityStateModel::SECURE, SecurityStateModel::NO_DEPRECATED_SHA1, |
| 182 SecurityStateModel::NO_MIXED_CONTENT, | 184 SecurityStateModel::NO_MIXED_CONTENT, |
| 183 false /* expect cert status error */); | 185 false /* expect cert status error */); |
| 184 } | 186 } |
| 185 | 187 |
| 186 IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, SHA1Broken) { | 188 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, SHA1Broken) { |
| 187 ASSERT_TRUE(https_server_.Start()); | 189 ASSERT_TRUE(https_server_.Start()); |
| 188 // The test server uses a long-lived cert by default, so a SHA1 | 190 // The test server uses a long-lived cert by default, so a SHA1 |
| 189 // signature in it will register as a "broken" condition rather than | 191 // signature in it will register as a "broken" condition rather than |
| 190 // "warning". | 192 // "warning". |
| 191 SetUpMockCertVerifierForHttpsServer(net::CERT_STATUS_SHA1_SIGNATURE_PRESENT, | 193 SetUpMockCertVerifierForHttpsServer(net::CERT_STATUS_SHA1_SIGNATURE_PRESENT, |
| 192 net::OK); | 194 net::OK); |
| 193 | 195 |
| 194 ui_test_utils::NavigateToURL(browser(), | 196 ui_test_utils::NavigateToURL(browser(), |
| 195 https_server_.GetURL("/ssl/google.html")); | 197 https_server_.GetURL("/ssl/google.html")); |
| 196 CheckSecurityInfoForSecure( | 198 CheckSecurityInfoForSecure( |
| 197 browser()->tab_strip_model()->GetActiveWebContents(), | 199 browser()->tab_strip_model()->GetActiveWebContents(), |
| 198 SecurityStateModel::SECURITY_ERROR, | 200 SecurityStateModel::SECURITY_ERROR, |
| 199 SecurityStateModel::DEPRECATED_SHA1_MAJOR, | 201 SecurityStateModel::DEPRECATED_SHA1_MAJOR, |
| 200 SecurityStateModel::NO_MIXED_CONTENT, | 202 SecurityStateModel::NO_MIXED_CONTENT, |
| 201 false /* expect cert status error */); | 203 false /* expect cert status error */); |
| 202 } | 204 } |
| 203 | 205 |
| 204 IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, MixedContent) { | 206 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, MixedContent) { |
| 205 ASSERT_TRUE(embedded_test_server()->Start()); | 207 ASSERT_TRUE(embedded_test_server()->Start()); |
| 206 ASSERT_TRUE(https_server_.Start()); | 208 ASSERT_TRUE(https_server_.Start()); |
| 207 SetUpMockCertVerifierForHttpsServer(0, net::OK); | 209 SetUpMockCertVerifierForHttpsServer(0, net::OK); |
| 208 | 210 |
| 209 // Navigate to an HTTPS page that displays mixed content. | 211 // Navigate to an HTTPS page that displays mixed content. |
| 210 std::string replacement_path; | 212 std::string replacement_path; |
| 211 GetFilePathWithHostAndPortReplacement( | 213 GetFilePathWithHostAndPortReplacement( |
| 212 "/ssl/page_displays_insecure_content.html", | 214 "/ssl/page_displays_insecure_content.html", |
| 213 embedded_test_server()->host_port_pair(), &replacement_path); | 215 embedded_test_server()->host_port_pair(), &replacement_path); |
| 214 ui_test_utils::NavigateToURL(browser(), | 216 ui_test_utils::NavigateToURL(browser(), |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 https_server_.GetURL(replacement_path)); | 285 https_server_.GetURL(replacement_path)); |
| 284 CheckSecurityInfoForSecure( | 286 CheckSecurityInfoForSecure( |
| 285 browser()->tab_strip_model()->GetActiveWebContents(), | 287 browser()->tab_strip_model()->GetActiveWebContents(), |
| 286 SecurityStateModel::SECURITY_ERROR, | 288 SecurityStateModel::SECURITY_ERROR, |
| 287 SecurityStateModel::NO_DEPRECATED_SHA1, | 289 SecurityStateModel::NO_DEPRECATED_SHA1, |
| 288 SecurityStateModel::RAN_MIXED_CONTENT, | 290 SecurityStateModel::RAN_MIXED_CONTENT, |
| 289 false /* expect cert status error */); | 291 false /* expect cert status error */); |
| 290 } | 292 } |
| 291 | 293 |
| 292 // Same as the test above but with a long-lived SHA1 cert. | 294 // Same as the test above but with a long-lived SHA1 cert. |
| 293 IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, MixedContentWithBrokenSHA1) { | 295 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
| 296 MixedContentWithBrokenSHA1) { |
| 294 ASSERT_TRUE(embedded_test_server()->Start()); | 297 ASSERT_TRUE(embedded_test_server()->Start()); |
| 295 ASSERT_TRUE(https_server_.Start()); | 298 ASSERT_TRUE(https_server_.Start()); |
| 296 // The test server uses a long-lived cert by default, so a SHA1 | 299 // The test server uses a long-lived cert by default, so a SHA1 |
| 297 // signature in it will register as a "broken" condition rather than | 300 // signature in it will register as a "broken" condition rather than |
| 298 // "warning". | 301 // "warning". |
| 299 SetUpMockCertVerifierForHttpsServer(net::CERT_STATUS_SHA1_SIGNATURE_PRESENT, | 302 SetUpMockCertVerifierForHttpsServer(net::CERT_STATUS_SHA1_SIGNATURE_PRESENT, |
| 300 net::OK); | 303 net::OK); |
| 301 | 304 |
| 302 // Navigate to an HTTPS page that displays mixed content. | 305 // Navigate to an HTTPS page that displays mixed content. |
| 303 std::string replacement_path; | 306 std::string replacement_path; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 ui_test_utils::NavigateToURL(browser(), | 361 ui_test_utils::NavigateToURL(browser(), |
| 359 https_server_.GetURL(replacement_path)); | 362 https_server_.GetURL(replacement_path)); |
| 360 CheckSecurityInfoForSecure( | 363 CheckSecurityInfoForSecure( |
| 361 browser()->tab_strip_model()->GetActiveWebContents(), | 364 browser()->tab_strip_model()->GetActiveWebContents(), |
| 362 SecurityStateModel::SECURITY_ERROR, | 365 SecurityStateModel::SECURITY_ERROR, |
| 363 SecurityStateModel::DEPRECATED_SHA1_MAJOR, | 366 SecurityStateModel::DEPRECATED_SHA1_MAJOR, |
| 364 SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT, | 367 SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT, |
| 365 false /* expect cert status error */); | 368 false /* expect cert status error */); |
| 366 } | 369 } |
| 367 | 370 |
| 368 IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, BrokenHTTPS) { | 371 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, BrokenHTTPS) { |
| 369 ASSERT_TRUE(embedded_test_server()->Start()); | 372 ASSERT_TRUE(embedded_test_server()->Start()); |
| 370 ASSERT_TRUE(https_server_.Start()); | 373 ASSERT_TRUE(https_server_.Start()); |
| 371 SetUpMockCertVerifierForHttpsServer(net::CERT_STATUS_DATE_INVALID, | 374 SetUpMockCertVerifierForHttpsServer(net::CERT_STATUS_DATE_INVALID, |
| 372 net::ERR_CERT_DATE_INVALID); | 375 net::ERR_CERT_DATE_INVALID); |
| 373 | 376 |
| 374 ui_test_utils::NavigateToURL(browser(), | 377 ui_test_utils::NavigateToURL(browser(), |
| 375 https_server_.GetURL("/ssl/google.html")); | 378 https_server_.GetURL("/ssl/google.html")); |
| 376 CheckSecurityInfoForSecure( | 379 CheckSecurityInfoForSecure( |
| 377 browser()->tab_strip_model()->GetActiveWebContents(), | 380 browser()->tab_strip_model()->GetActiveWebContents(), |
| 378 SecurityStateModel::SECURITY_ERROR, | 381 SecurityStateModel::SECURITY_ERROR, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 DISALLOW_COPY_AND_ASSIGN(PendingJobInterceptor); | 427 DISALLOW_COPY_AND_ASSIGN(PendingJobInterceptor); |
| 425 }; | 428 }; |
| 426 | 429 |
| 427 void InstallLoadingInterceptor(const std::string& host) { | 430 void InstallLoadingInterceptor(const std::string& host) { |
| 428 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); | 431 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); |
| 429 filter->AddHostnameInterceptor( | 432 filter->AddHostnameInterceptor( |
| 430 "http", host, | 433 "http", host, |
| 431 scoped_ptr<net::URLRequestInterceptor>(new PendingJobInterceptor())); | 434 scoped_ptr<net::URLRequestInterceptor>(new PendingJobInterceptor())); |
| 432 } | 435 } |
| 433 | 436 |
| 434 class SecurityStateModelLoadingTest : public SecurityStateModelTest { | 437 class SecurityStateModelLoadingTest |
| 438 : public ChromeSecurityStateModelClientTest { |
| 435 public: | 439 public: |
| 436 SecurityStateModelLoadingTest() : SecurityStateModelTest() {} | 440 SecurityStateModelLoadingTest() : ChromeSecurityStateModelClientTest() {} |
| 437 ~SecurityStateModelLoadingTest() override{}; | 441 ~SecurityStateModelLoadingTest() override{}; |
| 438 | 442 |
| 439 protected: | 443 protected: |
| 440 void SetUpOnMainThread() override { | 444 void SetUpOnMainThread() override { |
| 441 ASSERT_TRUE(embedded_test_server()->Start()); | 445 ASSERT_TRUE(embedded_test_server()->Start()); |
| 442 | 446 |
| 443 content::BrowserThread::PostTask( | 447 content::BrowserThread::PostTask( |
| 444 content::BrowserThread::IO, FROM_HERE, | 448 content::BrowserThread::IO, FROM_HERE, |
| 445 base::Bind(&InstallLoadingInterceptor, | 449 base::Bind(&InstallLoadingInterceptor, |
| 446 embedded_test_server()->GetURL("/").host())); | 450 embedded_test_server()->GetURL("/").host())); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 468 // security state is neutral while the page is loading. | 472 // security state is neutral while the page is loading. |
| 469 browser()->OpenURL(content::OpenURLParams(embedded_test_server()->GetURL("/"), | 473 browser()->OpenURL(content::OpenURLParams(embedded_test_server()->GetURL("/"), |
| 470 content::Referrer(), CURRENT_TAB, | 474 content::Referrer(), CURRENT_TAB, |
| 471 ui::PAGE_TRANSITION_TYPED, false)); | 475 ui::PAGE_TRANSITION_TYPED, false)); |
| 472 CheckSecurityInfoForNonSecure( | 476 CheckSecurityInfoForNonSecure( |
| 473 browser()->tab_strip_model()->GetActiveWebContents()); | 477 browser()->tab_strip_model()->GetActiveWebContents()); |
| 474 } | 478 } |
| 475 | 479 |
| 476 // Tests that the SecurityStateModel for a WebContents is up-to-date | 480 // Tests that the SecurityStateModel for a WebContents is up-to-date |
| 477 // when the WebContents is inserted into a Browser's TabStripModel. | 481 // when the WebContents is inserted into a Browser's TabStripModel. |
| 478 IN_PROC_BROWSER_TEST_F(SecurityStateModelTest, AddedTab) { | 482 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, AddedTab) { |
| 479 ASSERT_TRUE(https_server_.Start()); | 483 ASSERT_TRUE(https_server_.Start()); |
| 480 SetUpMockCertVerifierForHttpsServer(0, net::OK); | 484 SetUpMockCertVerifierForHttpsServer(0, net::OK); |
| 481 | 485 |
| 482 content::WebContents* tab = | 486 content::WebContents* tab = |
| 483 browser()->tab_strip_model()->GetActiveWebContents(); | 487 browser()->tab_strip_model()->GetActiveWebContents(); |
| 484 ASSERT_TRUE(tab); | 488 ASSERT_TRUE(tab); |
| 485 | 489 |
| 486 content::WebContents* new_contents = content::WebContents::Create( | 490 content::WebContents* new_contents = content::WebContents::Create( |
| 487 content::WebContents::CreateParams(tab->GetBrowserContext())); | 491 content::WebContents::CreateParams(tab->GetBrowserContext())); |
| 488 content::NavigationController& controller = new_contents->GetController(); | 492 content::NavigationController& controller = new_contents->GetController(); |
| 489 ChromeSecurityStateModelClient::CreateForWebContents(new_contents); | 493 ChromeSecurityStateModelClient::CreateForWebContents(new_contents); |
| 490 CheckSecurityInfoForNonSecure(new_contents); | 494 CheckSecurityInfoForNonSecure(new_contents); |
| 491 controller.LoadURL(https_server_.GetURL("/"), content::Referrer(), | 495 controller.LoadURL(https_server_.GetURL("/"), content::Referrer(), |
| 492 ui::PAGE_TRANSITION_TYPED, std::string()); | 496 ui::PAGE_TRANSITION_TYPED, std::string()); |
| 493 EXPECT_TRUE(content::WaitForLoadStop(new_contents)); | 497 EXPECT_TRUE(content::WaitForLoadStop(new_contents)); |
| 494 CheckSecurityInfoForSecure(new_contents, SecurityStateModel::SECURE, | 498 CheckSecurityInfoForSecure(new_contents, SecurityStateModel::SECURE, |
| 495 SecurityStateModel::NO_DEPRECATED_SHA1, | 499 SecurityStateModel::NO_DEPRECATED_SHA1, |
| 496 SecurityStateModel::NO_MIXED_CONTENT, | 500 SecurityStateModel::NO_MIXED_CONTENT, |
| 497 false /* expect cert status error */); | 501 false /* expect cert status error */); |
| 498 | 502 |
| 499 browser()->tab_strip_model()->InsertWebContentsAt(0, new_contents, | 503 browser()->tab_strip_model()->InsertWebContentsAt(0, new_contents, |
| 500 TabStripModel::ADD_NONE); | 504 TabStripModel::ADD_NONE); |
| 501 CheckSecurityInfoForSecure(new_contents, SecurityStateModel::SECURE, | 505 CheckSecurityInfoForSecure(new_contents, SecurityStateModel::SECURE, |
| 502 SecurityStateModel::NO_DEPRECATED_SHA1, | 506 SecurityStateModel::NO_DEPRECATED_SHA1, |
| 503 SecurityStateModel::NO_MIXED_CONTENT, | 507 SecurityStateModel::NO_MIXED_CONTENT, |
| 504 false /* expect cert status error */); | 508 false /* expect cert status error */); |
| 505 } | 509 } |
| 506 | 510 |
| 507 } // namespace | 511 } // namespace |
| OLD | NEW |