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

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

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

Powered by Google App Engine
This is Rietveld 408576698