| Index: net/http/transport_security_state_unittest.cc
|
| diff --git a/net/http/transport_security_state_unittest.cc b/net/http/transport_security_state_unittest.cc
|
| index dfcd50f84eeb0616d7d82c91e58fa783dc0d5495..ac0892aa1047721ea819ce3a8cb146ad1f18d216 100644
|
| --- a/net/http/transport_security_state_unittest.cc
|
| +++ b/net/http/transport_security_state_unittest.cc
|
| @@ -112,8 +112,8 @@ TEST_F(TransportSecurityStateTest, SubdomainMatches) {
|
| EXPECT_TRUE(state.GetDomainState("yahoo.com", true, &domain_state));
|
| EXPECT_TRUE(state.GetDomainState("foo.yahoo.com", true, &domain_state));
|
| EXPECT_TRUE(state.GetDomainState("foo.bar.yahoo.com", true, &domain_state));
|
| - EXPECT_TRUE(state.GetDomainState("foo.bar.baz.yahoo.com", true,
|
| - &domain_state));
|
| + EXPECT_TRUE(
|
| + state.GetDomainState("foo.bar.baz.yahoo.com", true, &domain_state));
|
| EXPECT_FALSE(state.GetDomainState("com", true, &domain_state));
|
| }
|
|
|
| @@ -191,8 +191,8 @@ TEST_F(TransportSecurityStateTest, PreloadedDomainSet) {
|
| // chrome://net-internals/#hsts UI. So test that.
|
| EXPECT_TRUE(state.GetDomainState("market.android.com", true, &domain_state));
|
| EXPECT_EQ(domain_state.domain, "market.android.com");
|
| - EXPECT_TRUE(state.GetDomainState("sub.market.android.com", true,
|
| - &domain_state));
|
| + EXPECT_TRUE(
|
| + state.GetDomainState("sub.market.android.com", true, &domain_state));
|
| EXPECT_EQ(domain_state.domain, "market.android.com");
|
| }
|
|
|
| @@ -222,7 +222,7 @@ static bool HasPublicKeyPins(const char* hostname) {
|
| return HasPublicKeyPins(hostname, true);
|
| }
|
|
|
| -static bool OnlyPinning(const char *hostname) {
|
| +static bool OnlyPinning(const char* hostname) {
|
| TransportSecurityState state;
|
| TransportSecurityState::DomainState domain_state;
|
| if (!state.GetDomainState(hostname, true /* SNI ok */, &domain_state))
|
| @@ -305,8 +305,8 @@ TEST_F(TransportSecurityStateTest, Preloaded) {
|
| EXPECT_FALSE(state.GetDomainState("www.gmail.com", false, &domain_state));
|
| EXPECT_FALSE(state.GetDomainState("m.gmail.com", false, &domain_state));
|
| EXPECT_FALSE(state.GetDomainState("googlemail.com", false, &domain_state));
|
| - EXPECT_FALSE(state.GetDomainState("www.googlemail.com", false,
|
| - &domain_state));
|
| + EXPECT_FALSE(
|
| + state.GetDomainState("www.googlemail.com", false, &domain_state));
|
| EXPECT_FALSE(state.GetDomainState("m.googlemail.com", false, &domain_state));
|
|
|
| // Other hosts:
|
| @@ -403,14 +403,13 @@ TEST_F(TransportSecurityStateTest, Preloaded) {
|
|
|
| EXPECT_TRUE(state.GetDomainState("torproject.org", false, &domain_state));
|
| EXPECT_FALSE(domain_state.static_spki_hashes.empty());
|
| - EXPECT_TRUE(state.GetDomainState("www.torproject.org", false,
|
| - &domain_state));
|
| + EXPECT_TRUE(state.GetDomainState("www.torproject.org", false, &domain_state));
|
| EXPECT_FALSE(domain_state.static_spki_hashes.empty());
|
| - EXPECT_TRUE(state.GetDomainState("check.torproject.org", false,
|
| - &domain_state));
|
| + EXPECT_TRUE(
|
| + state.GetDomainState("check.torproject.org", false, &domain_state));
|
| EXPECT_FALSE(domain_state.static_spki_hashes.empty());
|
| - EXPECT_TRUE(state.GetDomainState("blog.torproject.org", false,
|
| - &domain_state));
|
| + EXPECT_TRUE(
|
| + state.GetDomainState("blog.torproject.org", false, &domain_state));
|
| EXPECT_FALSE(domain_state.static_spki_hashes.empty());
|
| EXPECT_TRUE(ShouldRedirect("ebanking.indovinabank.com.vn"));
|
| EXPECT_TRUE(ShouldRedirect("foo.ebanking.indovinabank.com.vn"));
|
| @@ -538,8 +537,7 @@ TEST_F(TransportSecurityStateTest, BuiltinCertPins) {
|
| EXPECT_TRUE(HasPublicKeyPins("si0.twimg.com"));
|
| }
|
|
|
| -static bool AddHash(const std::string& type_and_base64,
|
| - HashValueVector* out) {
|
| +static bool AddHash(const std::string& type_and_base64, HashValueVector* out) {
|
| HashValue hash;
|
| if (!hash.FromString(type_and_base64))
|
| return false;
|
| @@ -551,19 +549,15 @@ static bool AddHash(const std::string& type_and_base64,
|
| TEST_F(TransportSecurityStateTest, PinValidationWithoutRejectedCerts) {
|
| // kGoodPath is blog.torproject.org.
|
| static const char* kGoodPath[] = {
|
| - "sha1/m9lHYJYke9k0GtVZ+bXSQYE8nDI=",
|
| - "sha1/o5OZxATDsgmwgcIfIWIneMJ0jkw=",
|
| - "sha1/wHqYaI2J+6sFZAwRfap9ZbjKzE4=",
|
| - NULL,
|
| + "sha1/m9lHYJYke9k0GtVZ+bXSQYE8nDI=", "sha1/o5OZxATDsgmwgcIfIWIneMJ0jkw=",
|
| + "sha1/wHqYaI2J+6sFZAwRfap9ZbjKzE4=", NULL,
|
| };
|
|
|
| // kBadPath is plus.google.com via Trustcenter, which is utterly wrong for
|
| // torproject.org.
|
| static const char* kBadPath[] = {
|
| - "sha1/4BjDjn8v2lWeUFQnqSs0BgbIcrU=",
|
| - "sha1/gzuEEAB/bkqdQS3EIjk2by7lW+k=",
|
| - "sha1/SOZo+SvSspXXR9gjIBBPM5iQn9Q=",
|
| - NULL,
|
| + "sha1/4BjDjn8v2lWeUFQnqSs0BgbIcrU=", "sha1/gzuEEAB/bkqdQS3EIjk2by7lW+k=",
|
| + "sha1/SOZo+SvSspXXR9gjIBBPM5iQn9Q=", NULL,
|
| };
|
|
|
| HashValueVector good_hashes, bad_hashes;
|
| @@ -629,16 +623,16 @@ TEST_F(TransportSecurityStateTest, OverrideBuiltins) {
|
| }
|
|
|
| TEST_F(TransportSecurityStateTest, GooglePinnedProperties) {
|
| - EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "www.example.com", true));
|
| - EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "www.paypal.com", true));
|
| - EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "mail.twitter.com", true));
|
| + EXPECT_FALSE(
|
| + TransportSecurityState::IsGooglePinnedProperty("www.example.com", true));
|
| + EXPECT_FALSE(
|
| + TransportSecurityState::IsGooglePinnedProperty("www.paypal.com", true));
|
| + EXPECT_FALSE(
|
| + TransportSecurityState::IsGooglePinnedProperty("mail.twitter.com", true));
|
| EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty(
|
| "www.google.com.int", true));
|
| - EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "jottit.com", true));
|
| + EXPECT_FALSE(
|
| + TransportSecurityState::IsGooglePinnedProperty("jottit.com", true));
|
| // learn.doubleclick.net has a more specific match than
|
| // *.doubleclick.com, and has 0 or NULL for its required certs.
|
| // This test ensures that the exact-match-preferred behavior
|
| @@ -648,16 +642,16 @@ TEST_F(TransportSecurityStateTest, GooglePinnedProperties) {
|
|
|
| EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| "encrypted.google.com", true));
|
| - EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "mail.google.com", true));
|
| + EXPECT_TRUE(
|
| + TransportSecurityState::IsGooglePinnedProperty("mail.google.com", true));
|
| EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| "accounts.google.com", true));
|
| - EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "doubleclick.net", true));
|
| + EXPECT_TRUE(
|
| + TransportSecurityState::IsGooglePinnedProperty("doubleclick.net", true));
|
| EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| "ad.doubleclick.net", true));
|
| - EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "youtube.com", true));
|
| + EXPECT_TRUE(
|
| + TransportSecurityState::IsGooglePinnedProperty("youtube.com", true));
|
| EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| "www.profiles.google.com", true));
|
| EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| @@ -666,25 +660,25 @@ TEST_F(TransportSecurityStateTest, GooglePinnedProperties) {
|
| "googleadservices.com", true));
|
|
|
| // Test with sni_enabled false:
|
| - EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "www.example.com", false));
|
| - EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "www.paypal.com", false));
|
| + EXPECT_FALSE(
|
| + TransportSecurityState::IsGooglePinnedProperty("www.example.com", false));
|
| + EXPECT_FALSE(
|
| + TransportSecurityState::IsGooglePinnedProperty("www.paypal.com", false));
|
| EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| "checkout.google.com", false));
|
| EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| "googleadservices.com", false));
|
|
|
| // Test some SNI hosts:
|
| - EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "gmail.com", true));
|
| - EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "googlegroups.com", true));
|
| + EXPECT_TRUE(
|
| + TransportSecurityState::IsGooglePinnedProperty("gmail.com", true));
|
| + EXPECT_TRUE(
|
| + TransportSecurityState::IsGooglePinnedProperty("googlegroups.com", true));
|
| EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty(
|
| "www.googlegroups.com", true));
|
| // Expect to fail for SNI hosts when not searching the SNI list:
|
| - EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty(
|
| - "gmail.com", false));
|
| + EXPECT_FALSE(
|
| + TransportSecurityState::IsGooglePinnedProperty("gmail.com", false));
|
| EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty(
|
| "googlegroups.com", false));
|
| EXPECT_FALSE(TransportSecurityState::IsGooglePinnedProperty(
|
|
|