OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/spdy/spdy_header_block.h" | 5 #include "net/spdy/spdy_header_block.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "net/log/net_log.h" | 11 #include "net/log/net_log.h" |
12 #include "net/spdy/spdy_test_utils.h" | 12 #include "net/spdy/spdy_test_utils.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 using std::make_pair; | 16 using std::make_pair; |
17 using std::string; | 17 using std::string; |
18 using ::testing::ElementsAre; | 18 using ::testing::ElementsAre; |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 std::pair<StringPiece, StringPiece> Pair(StringPiece k, StringPiece v) { | 22 std::pair<base::StringPiece, base::StringPiece> Pair(base::StringPiece k, |
| 23 base::StringPiece v) { |
23 return make_pair(k, v); | 24 return make_pair(k, v); |
24 } | 25 } |
25 | 26 |
26 // This test verifies that SpdyHeaderBlock behaves correctly when empty. | 27 // This test verifies that SpdyHeaderBlock behaves correctly when empty. |
27 TEST(SpdyHeaderBlockTest, EmptyBlock) { | 28 TEST(SpdyHeaderBlockTest, EmptyBlock) { |
28 SpdyHeaderBlock block; | 29 SpdyHeaderBlock block; |
29 EXPECT_TRUE(block.empty()); | 30 EXPECT_TRUE(block.empty()); |
30 EXPECT_EQ(0u, block.size()); | 31 EXPECT_EQ(0u, block.size()); |
31 EXPECT_EQ(block.end(), block.find("foo")); | 32 EXPECT_EQ(block.end(), block.find("foo")); |
32 EXPECT_TRUE(block.end() == block.begin()); | 33 EXPECT_TRUE(block.end() == block.begin()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 78 |
78 scoped_ptr<base::Value> event_param(SpdyHeaderBlockNetLogCallback( | 79 scoped_ptr<base::Value> event_param(SpdyHeaderBlockNetLogCallback( |
79 &headers, NetLogCaptureMode::IncludeCookiesAndCredentials())); | 80 &headers, NetLogCaptureMode::IncludeCookiesAndCredentials())); |
80 | 81 |
81 SpdyHeaderBlock headers2; | 82 SpdyHeaderBlock headers2; |
82 ASSERT_TRUE(SpdyHeaderBlockFromNetLogParam(event_param.get(), &headers2)); | 83 ASSERT_TRUE(SpdyHeaderBlockFromNetLogParam(event_param.get(), &headers2)); |
83 EXPECT_EQ(headers, headers2); | 84 EXPECT_EQ(headers, headers2); |
84 } | 85 } |
85 | 86 |
86 } // namespace net | 87 } // namespace net |
OLD | NEW |