diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-24 06:48:00 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-24 06:48:00 +0000 |
commit | 1eb81433c06db39fb39d12044ceaf1d6ae68538d (patch) | |
tree | 95f2e1fd4a0a9e3ea058329e593169bff9efe00e /net/spdy/spdy_credential_state_unittest.cc | |
parent | 203fe858af8b77cd65f16074131ff0ba31c082f1 (diff) | |
download | chromium_src-1eb81433c06db39fb39d12044ceaf1d6ae68538d.zip chromium_src-1eb81433c06db39fb39d12044ceaf1d6ae68538d.tar.gz chromium_src-1eb81433c06db39fb39d12044ceaf1d6ae68538d.tar.bz2 |
Implement correct v3 CREDENTIAL frame support.
BUG=106103
TEST=SpdyCredentialStateTest.*,SpdyFramerTest.*Credential*,SpdyHttpStreamTest.*Credential*,SpdySessionTest.*Credential*
Review URL: http://codereview.chromium.org/9535019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128707 0039d316-1c4b-4281-b951-d872f2087c98
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_))); } |