Chromium Code Reviews| Index: chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc |
| diff --git a/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc b/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc |
| index c32738337731383b6506a0c5cbd0bfaf945c8ffc..d494a0a3d4e555dd1f125f7d2f20515f0835efa9 100644 |
| --- a/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc |
| +++ b/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc |
| @@ -153,11 +153,14 @@ void CheckSecureExplanations( |
| EXPECT_EQ(cert_id, secure_explanations[0].cert_id); |
| } |
| - EXPECT_EQ(l10n_util::GetStringUTF8(IDS_SECURE_PROTOCOL_AND_CIPHERSUITE), |
| + EXPECT_EQ(l10n_util::GetStringUTF8(IDS_STRONG_SSL_SUMMARY), |
| secure_explanations.back().summary); |
| - EXPECT_EQ( |
| - l10n_util::GetStringUTF8(IDS_SECURE_PROTOCOL_AND_CIPHERSUITE_DESCRIPTION), |
| - secure_explanations.back().description); |
| + |
| + const std::string secureDescription = |
| + "The connection to this site is encrypted and authenticated using a " |
|
lgarron
2016/06/14 00:59:42
estark@, do you know if it's okay to hardcode thes
estark
2016/06/15 04:46:08
Why hardcode the string instead of instantiating i
lgarron
2016/08/05 23:22:58
Thanks for the tip. I've switched to instantiating
|
| + "strong protocol (TLS 1.2), a strong key exchange (ECDHE_RSA), and a " |
| + "strong cipher (AES_128_GCM)."; |
| + EXPECT_EQ(secureDescription, secure_explanations.back().description); |
| } |
| void CheckSecurityInfoForSecure( |
| @@ -860,9 +863,13 @@ IN_PROC_BROWSER_TEST_F(SecurityStyleChangedTest, |
| // After AddNonsecureUrlHandler() is called, requests to this hostname |
| // will use obsolete TLS settings. |
| const char kMockNonsecureHostname[] = "example-nonsecure.test"; |
| +const int obsoleteTLSVersion = net::SSL_CONNECTION_VERSION_TLS1_1; |
|
estark
2016/06/15 04:46:08
should be named kObsoleteTLSVersion, I think (and
lgarron
2016/08/05 23:22:58
Done.
|
| +// ECDHE_RSA + AES_128_CBC with HMAC-SHA1 |
| +const uint16_t obsoleteTLSJobCipherSuite = 0xc013; |
|
estark
2016/06/15 04:46:08
Why the "Job" in the name?
lgarron
2016/08/05 23:22:58
Because it's the cipher suite used by the [URLRequ
|
| -// A URLRequestMockHTTPJob that mocks a TLS connection with an obsolete |
| -// protocol version. |
| +// A URLRequestMockHTTPJob that mocks a TLS connection with the obsolete |
| +// TLS settings specified in obsoleteTLSVersion and |
| +// obsoleteTLSJobCipherSuite. |
| class URLRequestObsoleteTLSJob : public net::URLRequestMockHTTPJob { |
| public: |
| URLRequestObsoleteTLSJob(net::URLRequest* request, |
| @@ -878,10 +885,9 @@ class URLRequestObsoleteTLSJob : public net::URLRequestMockHTTPJob { |
| void GetResponseInfo(net::HttpResponseInfo* info) override { |
| net::URLRequestMockHTTPJob::GetResponseInfo(info); |
| - net::SSLConnectionStatusSetVersion(net::SSL_CONNECTION_VERSION_TLS1_1, |
| + net::SSLConnectionStatusSetVersion(obsoleteTLSVersion, |
| &info->ssl_info.connection_status); |
| - const uint16_t kTlsEcdheRsaWithAes128CbcSha = 0xc013; |
| - net::SSLConnectionStatusSetCipherSuite(kTlsEcdheRsaWithAes128CbcSha, |
| + net::SSLConnectionStatusSetCipherSuite(obsoleteTLSJobCipherSuite, |
| &info->ssl_info.connection_status); |
| info->ssl_info.cert = cert_; |
| } |
| @@ -989,9 +995,18 @@ IN_PROC_BROWSER_TEST_F(BrowserTestNonsecureURLRequest, |
| // the TLS settings are obsolete. |
| for (const auto& explanation : |
| observer.latest_explanations().secure_explanations) { |
| - EXPECT_NE(l10n_util::GetStringUTF8(IDS_SECURE_PROTOCOL_AND_CIPHERSUITE), |
| + EXPECT_NE(l10n_util::GetStringUTF8(IDS_STRONG_SSL_SUMMARY), |
| explanation.summary); |
| } |
| + |
| + // Sanity check that the test values match what we expect. |
| + ASSERT_EQ(net::SSL_CONNECTION_VERSION_TLS1_1, obsoleteTLSVersion); |
|
estark
2016/06/15 04:46:08
These should both be EXPECT_EQ, unless I'm missing
lgarron
2016/08/05 23:22:58
Hmm, I had the impression that EXPECT was for stuf
|
| + ASSERT_EQ(0xc013, obsoleteTLSJobCipherSuite); |
|
estark
2016/06/15 04:46:08
Huh. This strikes me as a little weird (asserting
lgarron
2016/08/05 23:22:58
Okay, okay. :-)
|
| + |
| + EXPECT_EQ(observer.latest_explanations().info_explanations[0].description, |
| + "The connection to this site uses an obsolete protocol (TLS 1.1), " |
|
estark
2016/06/15 04:46:08
ditto about instantiating the parameterized string
|
| + "a strong key exchange (ECDHE_RSA), and an obsolete cipher " |
| + "(AES_128_CBC with HMAC-SHA1)."); |
| } |
| } // namespace |