Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: net/base/transport_security_state_unittest.cc

Issue 6903086: Merge 83199 - Fix https://m.gmail.com/ and https://m.googlemail.com/, which don't return a (Closed) Base URL: svn://svn.chromium.org/chrome/branches/742/src/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/transport_security_state.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/base/transport_security_state.h" 5 #include "net/base/transport_security_state.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace net { 8 namespace net {
9 9
10 class TransportSecurityStateTest : public testing::Test { 10 class TransportSecurityStateTest : public testing::Test {
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, 490 EXPECT_TRUE(state->IsEnabledForHost(&domain_state,
491 "accounts.google.com", 491 "accounts.google.com",
492 true)); 492 true));
493 493
494 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "entropia.de", true)); 494 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "entropia.de", true));
495 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.entropia.de", true)); 495 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.entropia.de", true));
496 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "foo.entropia.de", true)); 496 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "foo.entropia.de", true));
497 497
498 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "gmail.com", true)); 498 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "gmail.com", true));
499 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.gmail.com", true)); 499 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.gmail.com", true));
500 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "m.gmail.com", true));
500 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "googlemail.com", true)); 501 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "googlemail.com", true));
501 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, 502 EXPECT_TRUE(state->IsEnabledForHost(&domain_state,
502 "www.googlemail.com", 503 "www.googlemail.com",
503 true)); 504 true));
505 EXPECT_FALSE(state->IsEnabledForHost(&domain_state,
506 "m.googlemail.com",
507 true));
504 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "gmail.com", false)); 508 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "gmail.com", false));
505 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www.gmail.com", false)); 509 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www.gmail.com", false));
510 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "m.gmail.com", false));
506 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "googlemail.com", false)); 511 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "googlemail.com", false));
507 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, 512 EXPECT_FALSE(state->IsEnabledForHost(&domain_state,
508 "www.googlemail.com", 513 "www.googlemail.com",
509 false)); 514 false));
515 EXPECT_FALSE(state->IsEnabledForHost(&domain_state,
516 "m.googlemail.com",
517 false));
510 } 518 }
511 519
512 TEST_F(TransportSecurityStateTest, LongNames) { 520 TEST_F(TransportSecurityStateTest, LongNames) {
513 scoped_refptr<TransportSecurityState> state( 521 scoped_refptr<TransportSecurityState> state(
514 new TransportSecurityState); 522 new TransportSecurityState);
515 const char kLongName[] = 523 const char kLongName[] =
516 "lookupByWaveIdHashAndWaveIdIdAndWaveIdDomainAndWaveletIdIdAnd" 524 "lookupByWaveIdHashAndWaveIdIdAndWaveIdDomainAndWaveletIdIdAnd"
517 "WaveletIdDomainAndBlipBlipid"; 525 "WaveletIdDomainAndBlipBlipid";
518 TransportSecurityState::DomainState domain_state; 526 TransportSecurityState::DomainState domain_state;
519 // Just checks that we don't hit a NOTREACHED. 527 // Just checks that we don't hit a NOTREACHED.
(...skipping 27 matching lines...) Expand all
547 EXPECT_TRUE(state->Serialise(&ser)); 555 EXPECT_TRUE(state->Serialise(&ser));
548 bool dirty; 556 bool dirty;
549 EXPECT_TRUE(state->LoadEntries(ser, &dirty)); 557 EXPECT_TRUE(state->LoadEntries(ser, &dirty));
550 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "example.com", false)); 558 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "example.com", false));
551 EXPECT_EQ(1u, domain_state.public_key_hashes.size()); 559 EXPECT_EQ(1u, domain_state.public_key_hashes.size());
552 EXPECT_TRUE(0 == memcmp(domain_state.public_key_hashes[0].data, hash.data, 560 EXPECT_TRUE(0 == memcmp(domain_state.public_key_hashes[0].data, hash.data,
553 sizeof(hash.data))); 561 sizeof(hash.data)));
554 } 562 }
555 563
556 } // namespace net 564 } // namespace net
OLDNEW
« no previous file with comments | « net/base/transport_security_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698