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

Side by Side Diff: net/spdy/spdy_framer_test.cc

Issue 10138003: Remove SpdyFramer::CompressFrame() and use CompressControlFrame instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <iostream> 6 #include <iostream>
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "net/spdy/spdy_framer.h" 9 #include "net/spdy/spdy_framer.h"
10 #include "net/spdy/spdy_protocol.h" 10 #include "net/spdy/spdy_protocol.h"
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 int spdy_version_; 518 int spdy_version_;
519 }; 519 };
520 520
521 521
522 //----------------------------------------------------------------------------- 522 //-----------------------------------------------------------------------------
523 // All tests are run with two different SPDY versions: SPDY/2 and SPDY/3. 523 // All tests are run with two different SPDY versions: SPDY/2 and SPDY/3.
524 INSTANTIATE_TEST_CASE_P(SpdyFramerTests, 524 INSTANTIATE_TEST_CASE_P(SpdyFramerTests,
525 SpdyFramerTest, 525 SpdyFramerTest,
526 ::testing::Values(SPDY2, SPDY3)); 526 ::testing::Values(SPDY2, SPDY3));
527 527
528 TEST_P(SpdyFramerTest, IsCompressible) {
529 SpdyFramer framer(spdy_version_);
530 for (SpdyControlType type = SYN_STREAM;
531 type < NUM_CONTROL_FRAME_TYPES;
532 type = static_cast<SpdyControlType>(type + 1)) {
533 SpdyFrameBuilder frame(type, CONTROL_FLAG_NONE, spdy_version_, 1024);
534 scoped_ptr<SpdyControlFrame> control_frame(
535 reinterpret_cast<SpdyControlFrame*>(frame.take()));
536 EXPECT_EQ(control_frame->has_header_block(),
537 framer.IsCompressible(*control_frame))
538 << "Frame type: " << type;
539 }
540 }
541
528 // Test that we can encode and decode a SpdyHeaderBlock in serialized form. 542 // Test that we can encode and decode a SpdyHeaderBlock in serialized form.
529 TEST_P(SpdyFramerTest, HeaderBlockInBuffer) { 543 TEST_P(SpdyFramerTest, HeaderBlockInBuffer) {
530 SpdyHeaderBlock headers; 544 SpdyHeaderBlock headers;
531 headers["alpha"] = "beta"; 545 headers["alpha"] = "beta";
532 headers["gamma"] = "charlie"; 546 headers["gamma"] = "charlie";
533 SpdyFramer framer(spdy_version_); 547 SpdyFramer framer(spdy_version_);
534 548
535 // Encode the header block into a SynStream frame. 549 // Encode the header block into a SynStream frame.
536 scoped_ptr<SpdySynStreamControlFrame> frame( 550 scoped_ptr<SpdySynStreamControlFrame> frame(
537 framer.CreateSynStream(1, // stream id 551 framer.CreateSynStream(1, // stream id
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 htonl(IsSpdy2() ? 0x04030201 : 0x01020304); 2621 htonl(IsSpdy2() ? 0x04030201 : 0x01020304);
2608 2622
2609 SettingsFlagsAndId id_and_flags = 2623 SettingsFlagsAndId id_and_flags =
2610 SettingsFlagsAndId::FromWireFormat(spdy_version_, kWireFormat); 2624 SettingsFlagsAndId::FromWireFormat(spdy_version_, kWireFormat);
2611 EXPECT_EQ(kId, id_and_flags.id()); 2625 EXPECT_EQ(kId, id_and_flags.id());
2612 EXPECT_EQ(kFlags, id_and_flags.flags()); 2626 EXPECT_EQ(kFlags, id_and_flags.flags());
2613 EXPECT_EQ(kWireFormat, id_and_flags.GetWireFormat(spdy_version_)); 2627 EXPECT_EQ(kWireFormat, id_and_flags.GetWireFormat(spdy_version_));
2614 } 2628 }
2615 2629
2616 } // namespace net 2630 } // namespace net
OLDNEW
« net/spdy/spdy_framer.cc ('K') | « net/spdy/spdy_framer.cc ('k') | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698