diff options
author | jgraettinger@chromium.org <jgraettinger@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-14 20:32:18 +0000 |
---|---|---|
committer | jgraettinger@chromium.org <jgraettinger@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-14 20:32:18 +0000 |
commit | ee9a6d45bc2aab69735d9353e89a8cd4108425d8 (patch) | |
tree | c6dfeb816ccb604212e4c9f38c3a97e3f7f3c501 /net | |
parent | 4d5a094d765fcd09fdc40b1387eef875bcfaafa6 (diff) | |
download | chromium_src-ee9a6d45bc2aab69735d9353e89a8cd4108425d8.zip chromium_src-ee9a6d45bc2aab69735d9353e89a8cd4108425d8.tar.gz chromium_src-ee9a6d45bc2aab69735d9353e89a8cd4108425d8.tar.bz2 |
SPDY 4: Remove CREDENTIAL from SPDY 4.
This lands server change 54240110 by hkhalil.
R=rch@chromium.org
Review URL: https://codereview.chromium.org/137403004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244797 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/spdy/spdy_framer.cc | 3 | ||||
-rw-r--r-- | net/spdy/spdy_framer_test.cc | 103 |
2 files changed, 54 insertions, 52 deletions
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc index 37e6a28..80cfbd0 100644 --- a/net/spdy/spdy_framer.cc +++ b/net/spdy/spdy_framer.cc @@ -793,6 +793,8 @@ void SpdyFramer::ProcessControlFrameHeader(uint16 control_frame_type_field) { } if (current_frame_type_ == CREDENTIAL) { + DCHECK_EQ(3, protocol_version()); + // TODO(hkhalil): Send GOAWAY for non-SPDY3 CHANGE_STATE(SPDY_CREDENTIAL_FRAME_PAYLOAD); return; } @@ -1971,6 +1973,7 @@ SpdyFrame* SpdyFramer::CreateCredentialFrame( SpdySerializedFrame* SpdyFramer::SerializeCredential( const SpdyCredentialIR& credential) const { + DCHECK_EQ(3, protocol_version()); size_t size = GetCredentialMinimumSize(); size += 4 + credential.proof().length(); // Room for proof. for (SpdyCredentialIR::CertificateList::const_iterator it = diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc index f9c2503..3f0926c 100644 --- a/net/spdy/spdy_framer_test.cc +++ b/net/spdy/spdy_framer_test.cc @@ -879,6 +879,11 @@ TEST_P(SpdyFramerTest, PushPromiseWithPromisedStreamIdZero) { } TEST_P(SpdyFramerTest, CreateCredential) { + // CREDENTIAL only exists in SPDY 3. + if (!IsSpdy3()) { + return; + } + SpdyFramer framer(spdy_version_); { @@ -900,23 +905,6 @@ TEST_P(SpdyFramerTest, CreateCredential) { 'a', 'l', ' ', 'c', 'e', 'r', 't', }; - const unsigned char kV4FrameData[] = { - 0x00, 0x3b, 0x0A, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x00, - 0x00, 0x05, 'p', 'r', - 'o', 'o', 'f', 0x00, - 0x00, 0x00, 0x06, 'a', - ' ', 'c', 'e', 'r', - 't', 0x00, 0x00, 0x00, - 0x0C, 'a', 'n', 'o', - 't', 'h', 'e', 'r', - ' ', 'c', 'e', 'r', - 't', 0x00, 0x00, 0x00, - 0x0A, 'f', 'i', 'n', - 'a', 'l', ' ', 'c', - 'e', 'r', 't', - }; SpdyCredential credential; credential.slot = 3; credential.proof = "proof"; @@ -924,15 +912,16 @@ TEST_P(SpdyFramerTest, CreateCredential) { credential.certs.push_back("another cert"); credential.certs.push_back("final cert"); scoped_ptr<SpdyFrame> frame(framer.CreateCredentialFrame(credential)); - if (IsSpdy4()) { - CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData)); - } else { - CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData)); - } + CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData)); } } TEST_P(SpdyFramerTest, ParseCredentialFrameData) { + // CREDENTIAL only exists in SPDY 3. + if (!IsSpdy3()) { + return; + } + SpdyFramer framer(spdy_version_); { @@ -953,38 +942,13 @@ TEST_P(SpdyFramerTest, ParseCredentialFrameData) { 'a', 'l', ' ', 'c', 'e', 'r', 't', }; - const unsigned char kV4FrameData[] = { - 0x00, 0x37, 0x0A, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x00, - 0x00, 0x05, 'p', 'r', - 'o', 'o', 'f', 0x00, - 0x00, 0x00, 0x06, 'a', - ' ', 'c', 'e', 'r', - 't', 0x00, 0x00, 0x00, - 0x0C, 'a', 'n', 'o', - 't', 'h', 'e', 'r', - ' ', 'c', 'e', 'r', - 't', 0x00, 0x00, 0x00, - 0x0A, 'f', 'i', 'n', - 'a', 'l', ' ', 'c', - 'e', 'r', 't', - }; SpdyCredential credential; - if (IsSpdy4()) { - EXPECT_TRUE(SpdyFramer::ParseCredentialData( - reinterpret_cast<const char*>(kV4FrameData) + - framer.GetControlFrameHeaderSize(), - arraysize(kV4FrameData) - framer.GetControlFrameHeaderSize(), - &credential)); - } else { - EXPECT_TRUE(SpdyFramer::ParseCredentialData( - reinterpret_cast<const char*>(kV3FrameData) + - framer.GetControlFrameHeaderSize(), - arraysize(kV3FrameData) - framer.GetControlFrameHeaderSize(), - &credential)); - } + EXPECT_TRUE(SpdyFramer::ParseCredentialData( + reinterpret_cast<const char*>(kV3FrameData) + + framer.GetControlFrameHeaderSize(), + arraysize(kV3FrameData) - framer.GetControlFrameHeaderSize(), + &credential)); EXPECT_EQ(3u, credential.slot); EXPECT_EQ("proof", credential.proof); EXPECT_EQ("a cert", credential.certs.front()); @@ -3612,6 +3576,11 @@ TEST_P(SpdyFramerTest, ReadWindowUpdate) { } TEST_P(SpdyFramerTest, ReadCredentialFrame) { + // CREDENTIAL only exists in SPDY 3. + if (!IsSpdy3()) { + return; + } + SpdyCredential credential; credential.slot = 3; credential.proof = "proof"; @@ -3639,6 +3608,11 @@ TEST_P(SpdyFramerTest, ReadCredentialFrame) { } TEST_P(SpdyFramerTest, ReadCredentialFrameOneByteAtATime) { + // CREDENTIAL only exists in SPDY 3. + if (!IsSpdy3()) { + return; + } + SpdyCredential credential; credential.slot = 3; credential.proof = "proof"; @@ -3670,6 +3644,11 @@ TEST_P(SpdyFramerTest, ReadCredentialFrameOneByteAtATime) { } TEST_P(SpdyFramerTest, ReadCredentialFrameWithNoPayload) { + // CREDENTIAL only exists in SPDY 3. + if (!IsSpdy3()) { + return; + } + SpdyCredential credential; credential.slot = 3; credential.proof = "proof"; @@ -3690,6 +3669,11 @@ TEST_P(SpdyFramerTest, ReadCredentialFrameWithNoPayload) { } TEST_P(SpdyFramerTest, ReadCredentialFrameWithCorruptProof) { + // CREDENTIAL only exists in SPDY 3. + if (!IsSpdy3()) { + return; + } + SpdyCredential credential; credential.slot = 3; credential.proof = "proof"; @@ -3712,6 +3696,11 @@ TEST_P(SpdyFramerTest, ReadCredentialFrameWithCorruptProof) { } TEST_P(SpdyFramerTest, ReadCredentialFrameWithCorruptCertificate) { + // CREDENTIAL only exists in SPDY 3. + if (!IsSpdy3()) { + return; + } + SpdyCredential credential; credential.slot = 3; credential.proof = "proof"; @@ -3735,6 +3724,11 @@ TEST_P(SpdyFramerTest, ReadCredentialFrameWithCorruptCertificate) { // Regression test for parsing issue found in b/8278897. TEST_P(SpdyFramerTest, ReadCredentialFrameFollowedByAnotherFrame) { + // CREDENTIAL only exists in SPDY 3. + if (!IsSpdy3()) { + return; + } + SpdyCredential credential; credential.slot = 3; credential.proof = "proof"; @@ -4358,6 +4352,11 @@ TEST_P(SpdyFramerTest, PushPromiseFrameFlags) { } TEST_P(SpdyFramerTest, CredentialFrameFlags) { + // CREDENTIAL only exists in SPDY 3. + if (!IsSpdy3()) { + return; + } + for (int flags = 0; flags < 256; ++flags) { SCOPED_TRACE(testing::Message() << "Flags " << flags); |