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

Side by Side Diff: net/spdy/hpack/hpack_entry_test.cc

Issue 2801603003: Add SpdyString alias for std::string in net/spdy. (Closed)
Patch Set: Created 3 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/spdy/hpack/hpack_entry.cc ('k') | net/spdy/hpack/hpack_header_table_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/hpack/hpack_entry.h" 5 #include "net/spdy/hpack/hpack_entry.h"
6 6
7 #include <string>
8
9 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
10 8
11 namespace net { 9 namespace net {
12 10
13 namespace { 11 namespace {
14 12
15 using std::string;
16
17 class HpackEntryTest : public ::testing::Test { 13 class HpackEntryTest : public ::testing::Test {
18 protected: 14 protected:
19 HpackEntryTest() 15 HpackEntryTest()
20 : name_("header-name"), 16 : name_("header-name"),
21 value_("header value"), 17 value_("header value"),
22 total_insertions_(0), 18 total_insertions_(0),
23 table_size_(0) {} 19 table_size_(0) {}
24 20
25 // These builders maintain the same external table invariants that a "real" 21 // These builders maintain the same external table invariants that a "real"
26 // table (ie HpackHeaderTable) would. 22 // table (ie HpackHeaderTable) would.
(...skipping 12 matching lines...) Expand all
39 return 1 + entry.InsertionIndex() + table_size_; 35 return 1 + entry.InsertionIndex() + table_size_;
40 } else { 36 } else {
41 return total_insertions_ - entry.InsertionIndex(); 37 return total_insertions_ - entry.InsertionIndex();
42 } 38 }
43 } 39 }
44 40
45 size_t Size() { 41 size_t Size() {
46 return name_.size() + value_.size() + HpackEntry::kSizeOverhead; 42 return name_.size() + value_.size() + HpackEntry::kSizeOverhead;
47 } 43 }
48 44
49 string name_, value_; 45 SpdyString name_, value_;
50 46
51 private: 47 private:
52 // Referenced by HpackEntry instances. 48 // Referenced by HpackEntry instances.
53 size_t total_insertions_; 49 size_t total_insertions_;
54 size_t table_size_; 50 size_t table_size_;
55 }; 51 };
56 52
57 TEST_F(HpackEntryTest, StaticConstructor) { 53 TEST_F(HpackEntryTest, StaticConstructor) {
58 HpackEntry entry(StaticEntry()); 54 HpackEntry entry(StaticEntry());
59 55
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 113
118 EXPECT_EQ(1u, IndexOf(dynamic3)); 114 EXPECT_EQ(1u, IndexOf(dynamic3));
119 EXPECT_EQ(2u, IndexOf(dynamic2)); 115 EXPECT_EQ(2u, IndexOf(dynamic2));
120 EXPECT_EQ(3u, IndexOf(static1)); 116 EXPECT_EQ(3u, IndexOf(static1));
121 EXPECT_EQ(4u, IndexOf(static2)); 117 EXPECT_EQ(4u, IndexOf(static2));
122 } 118 }
123 119
124 } // namespace 120 } // namespace
125 121
126 } // namespace net 122 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack/hpack_entry.cc ('k') | net/spdy/hpack/hpack_header_table_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698