diff options
Diffstat (limited to 'net/spdy/spdy_credential_state_unittest.cc')
-rw-r--r-- | net/spdy/spdy_credential_state_unittest.cc | 92 |
1 files changed, 49 insertions, 43 deletions
diff --git a/net/spdy/spdy_credential_state_unittest.cc b/net/spdy/spdy_credential_state_unittest.cc index 65ef9c9..b512921 100644 --- a/net/spdy/spdy_credential_state_unittest.cc +++ b/net/spdy/spdy_credential_state_unittest.cc @@ -13,22 +13,26 @@ class SpdyCredentialStateTest : public PlatformTest { public: SpdyCredentialStateTest() : state_(4), - origin1_("1.com", 80), - origin2_("2.com", 80), - origin3_("3.com", 80), - origin4_("4.com", 80), - origin5_("5.com", 80), - origin6_("6.com", 80) { + origin1_("https://1.com"), + origin2_("https://2.com"), + origin3_("https://3.com"), + origin4_("https://4.com"), + origin5_("https://5.com"), + origin6_("https://6.com"), + origin11_("https://11.com"), + host1_("https://www.1.com:443") { } protected: SpdyCredentialState state_; - const HostPortPair origin1_; - const HostPortPair origin2_; - const HostPortPair origin3_; - const HostPortPair origin4_; - const HostPortPair origin5_; - const HostPortPair origin6_; + const GURL origin1_; + const GURL origin2_; + const GURL origin3_; + const GURL origin4_; + const GURL origin5_; + const GURL origin6_; + const GURL origin11_; + const GURL host1_; DISALLOW_COPY_AND_ASSIGN(SpdyCredentialStateTest); }; @@ -42,60 +46,62 @@ TEST_F(SpdyCredentialStateTest, HasCredentialReturnsFalseWhenEmpty) { TEST_F(SpdyCredentialStateTest, HasCredentialReturnsTrueWhenAdded) { state_.SetHasCredential(origin1_); EXPECT_TRUE(state_.HasCredential(origin1_)); + EXPECT_TRUE(state_.HasCredential(host1_)); + EXPECT_FALSE(state_.HasCredential(origin11_)); EXPECT_FALSE(state_.HasCredential(origin2_)); EXPECT_FALSE(state_.HasCredential(origin3_)); } TEST_F(SpdyCredentialStateTest, SetCredentialAddsToEndOfList) { - EXPECT_EQ(0u, (state_.SetHasCredential(origin1_))); - EXPECT_EQ(1u, (state_.SetHasCredential(origin2_))); - EXPECT_EQ(2u, (state_.SetHasCredential(origin3_))); + EXPECT_EQ(1u, (state_.SetHasCredential(origin1_))); + EXPECT_EQ(2u, (state_.SetHasCredential(origin2_))); + EXPECT_EQ(3u, (state_.SetHasCredential(origin3_))); } TEST_F(SpdyCredentialStateTest, SetReturnsPositionIfAlreadyInList) { - EXPECT_EQ(0u, (state_.SetHasCredential(origin1_))); - EXPECT_EQ(1u, (state_.SetHasCredential(origin2_))); - EXPECT_EQ(0u, (state_.SetHasCredential(origin1_))); - EXPECT_EQ(1u, (state_.SetHasCredential(origin2_))); + EXPECT_EQ(1u, (state_.SetHasCredential(origin1_))); + EXPECT_EQ(2u, (state_.SetHasCredential(origin2_))); + EXPECT_EQ(1u, (state_.SetHasCredential(origin1_))); + EXPECT_EQ(2u, (state_.SetHasCredential(origin2_))); } TEST_F(SpdyCredentialStateTest, SetReplacesOldestElementWhenFull) { - EXPECT_EQ(0u, (state_.SetHasCredential(origin1_))); - EXPECT_EQ(1u, (state_.SetHasCredential(origin2_))); - EXPECT_EQ(2u, (state_.SetHasCredential(origin3_))); - EXPECT_EQ(3u, (state_.SetHasCredential(origin4_))); - EXPECT_EQ(0u, (state_.SetHasCredential(origin5_))); - EXPECT_EQ(1u, (state_.SetHasCredential(origin6_))); - EXPECT_EQ(2u, (state_.SetHasCredential(origin1_))); - EXPECT_EQ(3u, (state_.SetHasCredential(origin2_))); + EXPECT_EQ(1u, (state_.SetHasCredential(origin1_))); + EXPECT_EQ(2u, (state_.SetHasCredential(origin2_))); + EXPECT_EQ(3u, (state_.SetHasCredential(origin3_))); + EXPECT_EQ(4u, (state_.SetHasCredential(origin4_))); + EXPECT_EQ(1u, (state_.SetHasCredential(origin5_))); + EXPECT_EQ(2u, (state_.SetHasCredential(origin6_))); + EXPECT_EQ(3u, (state_.SetHasCredential(origin1_))); + EXPECT_EQ(4u, (state_.SetHasCredential(origin2_))); } TEST_F(SpdyCredentialStateTest, ResizeAddsEmptySpaceAtEnd) { - EXPECT_EQ(0u, (state_.SetHasCredential(origin1_))); - EXPECT_EQ(1u, (state_.SetHasCredential(origin2_))); - EXPECT_EQ(2u, (state_.SetHasCredential(origin3_))); - EXPECT_EQ(3u, (state_.SetHasCredential(origin4_))); + EXPECT_EQ(1u, (state_.SetHasCredential(origin1_))); + EXPECT_EQ(2u, (state_.SetHasCredential(origin2_))); + EXPECT_EQ(3u, (state_.SetHasCredential(origin3_))); + EXPECT_EQ(4u, (state_.SetHasCredential(origin4_))); state_.Resize(6); - EXPECT_EQ(0u, (state_.SetHasCredential(origin1_))); - EXPECT_EQ(1u, (state_.SetHasCredential(origin2_))); - EXPECT_EQ(2u, (state_.SetHasCredential(origin3_))); - EXPECT_EQ(3u, (state_.SetHasCredential(origin4_))); - EXPECT_EQ(4u, (state_.SetHasCredential(origin5_))); - EXPECT_EQ(5u, (state_.SetHasCredential(origin6_))); + EXPECT_EQ(1u, (state_.SetHasCredential(origin1_))); + EXPECT_EQ(2u, (state_.SetHasCredential(origin2_))); + EXPECT_EQ(3u, (state_.SetHasCredential(origin3_))); + EXPECT_EQ(4u, (state_.SetHasCredential(origin4_))); + EXPECT_EQ(5u, (state_.SetHasCredential(origin5_))); + EXPECT_EQ(6u, (state_.SetHasCredential(origin6_))); } TEST_F(SpdyCredentialStateTest, ResizeTrunatesFromEnd) { - EXPECT_EQ(0u, (state_.SetHasCredential(origin1_))); - EXPECT_EQ(1u, (state_.SetHasCredential(origin2_))); - EXPECT_EQ(2u, (state_.SetHasCredential(origin3_))); - EXPECT_EQ(3u, (state_.SetHasCredential(origin4_))); + EXPECT_EQ(1u, (state_.SetHasCredential(origin1_))); + EXPECT_EQ(2u, (state_.SetHasCredential(origin2_))); + EXPECT_EQ(3u, (state_.SetHasCredential(origin3_))); + EXPECT_EQ(4u, (state_.SetHasCredential(origin4_))); state_.Resize(2); EXPECT_TRUE(state_.HasCredential(origin1_)); EXPECT_TRUE(state_.HasCredential(origin2_)); EXPECT_FALSE(state_.HasCredential(origin3_)); EXPECT_FALSE(state_.HasCredential(origin4_)); - EXPECT_EQ(0u, (state_.SetHasCredential(origin5_))); - EXPECT_EQ(1u, (state_.SetHasCredential(origin6_))); + EXPECT_EQ(1u, (state_.SetHasCredential(origin5_))); + EXPECT_EQ(2u, (state_.SetHasCredential(origin6_))); } |