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

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

Issue 1877703002: Landing Recent QUIC changes until 4/8/2016 17:17 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git sync Created 4 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
« no previous file with comments | « net/quic/quic_header_list.cc ('k') | net/quic/quic_headers_stream.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) 2016 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 "net/quic/quic_header_list.h"
6
7 #include "net/test/gtest_util.h"
8 #include "testing/gmock/include/gmock/gmock.h"
9
10 namespace net {
11
12 class QuicHeaderListTest : public ::testing::Test {};
13
14 // This test verifies that QuicHeaderList accumulates header pairs in order.
15 TEST(QuicHeaderListTest, OnHeader) {
16 QuicHeaderList headers;
17 headers.OnHeader("foo", "bar");
18 headers.OnHeader("april", "fools");
19 headers.OnHeader("beep", "");
20
21 std::string accumulator;
22 for (const auto& p : headers) {
23 accumulator.append("(" + p.first + ", " + p.second + ") ");
24 }
25 EXPECT_EQ("(foo, bar) (april, fools) (beep, ) ", accumulator);
26 }
27
28 // This test verifies that QuicHeaderList is copyable and assignable.
29 TEST(QuicHeaderListTest, IsCopyableAndAssignable) {
30 QuicHeaderList headers;
31 headers.OnHeader("foo", "bar");
32 headers.OnHeader("april", "fools");
33 headers.OnHeader("beep", "");
34
35 QuicHeaderList headers2(headers);
36 QuicHeaderList headers3 = headers;
37
38 std::string accumulator;
39 for (const auto& p : headers2) {
40 accumulator.append("(" + p.first + ", " + p.second + ") ");
41 }
42 EXPECT_EQ("(foo, bar) (april, fools) (beep, ) ", accumulator);
43
44 accumulator.clear();
45 for (const auto& p : headers3) {
46 accumulator.append("(" + p.first + ", " + p.second + ") ");
47 }
48 EXPECT_EQ("(foo, bar) (april, fools) (beep, ) ", accumulator);
49 }
50
51 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_header_list.cc ('k') | net/quic/quic_headers_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698