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

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

Issue 1357953002: Replace the existing SpdyHeaderBlock typedef with a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add NET_EXPORT to fix compile error on win_chromium_compile_dbg_ng. Created 5 years, 2 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
« no previous file with comments | « net/spdy/spdy_framer.cc ('k') | net/spdy/spdy_header_block.h » ('j') | 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) 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 "net/spdy/spdy_framer.h" 5 #include "net/spdy/spdy_framer.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 framer.set_enable_compression(false); 992 framer.set_enable_compression(false);
993 scoped_ptr<SpdyFrame> control_frame(frame.take()); 993 scoped_ptr<SpdyFrame> control_frame(frame.take());
994 994
995 TestSpdyVisitor visitor(spdy_version_); 995 TestSpdyVisitor visitor(spdy_version_);
996 visitor.use_compression_ = false; 996 visitor.use_compression_ = false;
997 visitor.SimulateInFramer( 997 visitor.SimulateInFramer(
998 reinterpret_cast<unsigned char*>(control_frame->data()), 998 reinterpret_cast<unsigned char*>(control_frame->data()),
999 control_frame->size()); 999 control_frame->size());
1000 1000
1001 EXPECT_THAT(visitor.headers_, 1001 EXPECT_THAT(visitor.headers_,
1002 testing::ElementsAre(testing::Pair("name", value))); 1002 testing::ElementsAre(testing::Pair("name", StringPiece(value))));
1003 } 1003 }
1004 1004
1005 TEST_P(SpdyFramerTest, BasicCompression) { 1005 TEST_P(SpdyFramerTest, BasicCompression) {
1006 if (spdy_version_ > SPDY3) { 1006 if (spdy_version_ > SPDY3) {
1007 // Deflate compression doesn't apply to HPACK. 1007 // Deflate compression doesn't apply to HPACK.
1008 return; 1008 return;
1009 } 1009 }
1010 scoped_ptr<TestSpdyVisitor> visitor(new TestSpdyVisitor(spdy_version_)); 1010 scoped_ptr<TestSpdyVisitor> visitor(new TestSpdyVisitor(spdy_version_));
1011 SpdyFramer framer(spdy_version_); 1011 SpdyFramer framer(spdy_version_);
1012 framer.set_debug_visitor(visitor.get()); 1012 framer.set_debug_visitor(visitor.get());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 SpdyFramerTestUtil::DecompressFrame(&framer, *frame2)); 1056 SpdyFramerTestUtil::DecompressFrame(&framer, *frame2));
1057 size_t uncompressed_size4 = 1057 size_t uncompressed_size4 =
1058 frame4->size() - framer.GetSynStreamMinimumSize(); 1058 frame4->size() - framer.GetSynStreamMinimumSize();
1059 size_t compressed_size4 = 1059 size_t compressed_size4 =
1060 visitor->last_frame_len_ - framer.GetSynStreamMinimumSize(); 1060 visitor->last_frame_len_ - framer.GetSynStreamMinimumSize();
1061 if (IsSpdy2()) { 1061 if (IsSpdy2()) {
1062 EXPECT_EQ(139u, uncompressed_size4); 1062 EXPECT_EQ(139u, uncompressed_size4);
1063 #if defined(USE_SYSTEM_ZLIB) 1063 #if defined(USE_SYSTEM_ZLIB)
1064 EXPECT_EQ(149u, compressed_size4); 1064 EXPECT_EQ(149u, compressed_size4);
1065 #else // !defined(USE_SYSTEM_ZLIB) 1065 #else // !defined(USE_SYSTEM_ZLIB)
1066 EXPECT_EQ(101u, compressed_size4); 1066 EXPECT_EQ(99u, compressed_size4);
1067 #endif // !defined(USE_SYSTEM_ZLIB) 1067 #endif // !defined(USE_SYSTEM_ZLIB)
1068 } else { 1068 } else {
1069 EXPECT_EQ(165u, uncompressed_size4); 1069 EXPECT_EQ(165u, uncompressed_size4);
1070 #if defined(USE_SYSTEM_ZLIB) 1070 #if defined(USE_SYSTEM_ZLIB)
1071 EXPECT_EQ(175u, compressed_size4); 1071 EXPECT_EQ(175u, compressed_size4);
1072 #else // !defined(USE_SYSTEM_ZLIB) 1072 #else // !defined(USE_SYSTEM_ZLIB)
1073 EXPECT_EQ(102u, compressed_size4); 1073 EXPECT_EQ(99u, compressed_size4);
1074 #endif // !defined(USE_SYSTEM_ZLIB) 1074 #endif // !defined(USE_SYSTEM_ZLIB)
1075 } 1075 }
1076 1076
1077 EXPECT_EQ(uncompressed_size1, uncompressed_size2); 1077 EXPECT_EQ(uncompressed_size1, uncompressed_size2);
1078 EXPECT_EQ(uncompressed_size1, uncompressed_size4); 1078 EXPECT_EQ(uncompressed_size1, uncompressed_size4);
1079 EXPECT_EQ(compressed_size2, compressed_size4); 1079 EXPECT_EQ(compressed_size2, compressed_size4);
1080 1080
1081 // Expect frames 3 & 4 to be the same. 1081 // Expect frames 3 & 4 to be the same.
1082 CompareFrames("Uncompressed SYN_STREAM", *frame3, *frame4); 1082 CompareFrames("Uncompressed SYN_STREAM", *frame3, *frame4);
1083 1083
(...skipping 5058 matching lines...) Expand 10 before | Expand all | Expand 10 after
6142 6142
6143 EXPECT_EQ(1, visitor->data_frame_count_); 6143 EXPECT_EQ(1, visitor->data_frame_count_);
6144 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_)); 6144 EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_));
6145 EXPECT_EQ(0, visitor->headers_frame_count_); 6145 EXPECT_EQ(0, visitor->headers_frame_count_);
6146 } 6146 }
6147 } 6147 }
6148 6148
6149 } // namespace test 6149 } // namespace test
6150 6150
6151 } // namespace net 6151 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer.cc ('k') | net/spdy/spdy_header_block.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698