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

Side by Side Diff: net/quic/quic_spdy_decompressor_test.cc

Issue 14651009: Land Recent QUIC changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix integer constant is too large for 'unsigned long' type Created 7 years, 7 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
« no previous file with comments | « net/quic/quic_spdy_decompressor.cc ('k') | net/quic/quic_stream_sequencer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <string>
6
7 #include "net/quic/quic_spdy_compressor.h"
8 #include "net/quic/quic_spdy_decompressor.h"
9 #include "net/quic/spdy_utils.h"
10 #include "net/quic/test_tools/quic_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 using std::string;
14
15 namespace net {
16 namespace test {
17 namespace {
18
19 class QuicSpdyDecompressorTest : public ::testing::Test {
20 protected:
21 QuicSpdyDecompressor decompressor_;
22 QuicSpdyCompressor compressor_;
23 TestDecompressorVisitor visitor_;
24 };
25
26 TEST_F(QuicSpdyDecompressorTest, Decompress) {
27 SpdyHeaderBlock headers;
28 headers[":host"] = "www.google.com";
29 headers[":path"] = "/index.hml";
30 headers[":scheme"] = "https";
31
32 EXPECT_EQ(1u, decompressor_.current_header_id());
33 string compressed_headers = compressor_.CompressHeaders(headers).substr(4);
34 EXPECT_EQ(compressed_headers.length(),
35 decompressor_.DecompressData(compressed_headers, &visitor_));
36
37 EXPECT_EQ(SpdyUtils::SerializeUncompressedHeaders(headers), visitor_.data());
38 EXPECT_EQ(2u, decompressor_.current_header_id());
39 }
40
41 TEST_F(QuicSpdyDecompressorTest, DecompressAndIgnoreTrailingData) {
42 SpdyHeaderBlock headers;
43 headers[":host"] = "www.google.com";
44 headers[":path"] = "/index.hml";
45 headers[":scheme"] = "https";
46
47 string compressed_headers = compressor_.CompressHeaders(headers).substr(4);
48 EXPECT_EQ(compressed_headers.length(),
49 decompressor_.DecompressData(compressed_headers + "abc123",
50 &visitor_));
51
52 EXPECT_EQ(SpdyUtils::SerializeUncompressedHeaders(headers), visitor_.data());
53 }
54
55 } // namespace
56 } // namespace test
57 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_spdy_decompressor.cc ('k') | net/quic/quic_stream_sequencer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698