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.
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"
19 class QuicSpdyCompressorTest
: public ::testing::Test
{
21 TestDecompressorVisitor visitor_
;
24 TEST_F(QuicSpdyCompressorTest
, Compress
) {
25 QuicSpdyCompressor compressor
;
26 QuicSpdyDecompressor decompressor
;
28 SpdyHeaderBlock headers
;
29 headers
[":host"] = "www.google.com";
30 headers
[":path"] = "/index.hml";
31 headers
[":scheme"] = "https";
33 string compressed_headers
= compressor
.CompressHeaders(headers
);
34 EXPECT_EQ('\1', compressed_headers
[0]);
35 EXPECT_EQ('\0', compressed_headers
[1]);
36 EXPECT_EQ('\0', compressed_headers
[2]);
37 EXPECT_EQ('\0', compressed_headers
[3]);
38 string compressed_data
= compressed_headers
.substr(4);
39 decompressor
.DecompressData(compressed_data
, &visitor_
);
40 EXPECT_EQ(SpdyUtils::SerializeUncompressedHeaders(headers
),