OLD | NEW |
---|---|
(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 #include "net/quic/quic_header_list.h" | |
ramant (doing other things)
2016/04/11 18:11:57
Please add a blank line between line#3 and line#4
Zhongyi Shi
2016/04/11 18:27:31
done in the final.
| |
5 | |
6 #include "net/test/gtest_util.h" | |
7 #include "testing/gmock/include/gmock/gmock.h" | |
8 | |
9 namespace net { | |
10 | |
11 class QuicHeaderListTest : public ::testing::Test {}; | |
12 | |
13 // This test verifies that QuicHeaderList accumulates header pairs in order. | |
14 TEST(QuicHeaderListTest, OnHeader) { | |
15 QuicHeaderList headers; | |
16 headers.OnHeader("foo", "bar"); | |
17 headers.OnHeader("april", "fools"); | |
18 headers.OnHeader("beep", ""); | |
19 | |
20 std::string accumulator; | |
21 for (const auto& p : headers) { | |
22 accumulator.append("(" + p.first + ", " + p.second + ") "); | |
23 } | |
24 EXPECT_EQ("(foo, bar) (april, fools) (beep, ) ", accumulator); | |
25 } | |
26 | |
27 // This test verifies that QuicHeaderList is copyable and assignable. | |
28 TEST(QuicHeaderListTest, IsCopyableAndAssignable) { | |
29 QuicHeaderList headers; | |
30 headers.OnHeader("foo", "bar"); | |
31 headers.OnHeader("april", "fools"); | |
32 headers.OnHeader("beep", ""); | |
33 | |
34 QuicHeaderList headers2(headers); | |
35 QuicHeaderList headers3 = headers; | |
36 | |
37 std::string accumulator; | |
38 for (const auto& p : headers2) { | |
39 accumulator.append("(" + p.first + ", " + p.second + ") "); | |
40 } | |
41 EXPECT_EQ("(foo, bar) (april, fools) (beep, ) ", accumulator); | |
42 | |
43 accumulator.clear(); | |
44 for (const auto& p : headers3) { | |
45 accumulator.append("(" + p.first + ", " + p.second + ") "); | |
46 } | |
47 EXPECT_EQ("(foo, bar) (april, fools) (beep, ) ", accumulator); | |
48 } | |
49 | |
50 } // namespace net | |
OLD | NEW |