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

Side by Side Diff: net/spdy/hpack_static_table_test.cc

Issue 549583003: Make HPACK static table static and immutable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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_static_table.cc ('k') | no next file » | 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 2014 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/spdy/hpack_static_table.h"
6
7 #include <vector>
8
9 #include "net/base/net_export.h"
10 #include "net/spdy/hpack_constants.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace net {
14
15 namespace test {
16
17 namespace {
18
19 class HpackStaticTableTest : public ::testing::Test {
20 protected:
21 HpackStaticTableTest() : table_() {}
22
23 HpackStaticTable table_;
24 };
25
26 // Check that an initialized instance has the right number of entries.
27 TEST_F(HpackStaticTableTest, Initialize) {
28 EXPECT_FALSE(table_.IsInitialized());
29 std::vector<HpackStaticEntry> static_table = HpackStaticTableVector();
30 table_.Initialize(&static_table[0], static_table.size());
31 EXPECT_TRUE(table_.IsInitialized());
32
33 HpackHeaderTable::EntryTable static_entries = table_.GetStaticEntries();
34 EXPECT_EQ(static_table.size(), static_entries.size());
35
36 HpackHeaderTable::OrderedEntrySet static_index = table_.GetStaticIndex();
37 EXPECT_EQ(static_table.size(), static_index.size());
38 }
39
40 // Test that ObtainHpackStaticTable returns the same instance every time.
41 TEST_F(HpackStaticTableTest, IsSingleton) {
42 const HpackStaticTable* static_table_one = &ObtainHpackStaticTable();
43 const HpackStaticTable* static_table_two = &ObtainHpackStaticTable();
44 EXPECT_EQ(static_table_one, static_table_two);
45 }
46
47 } // namespace
48
49 } // namespace test
50
51 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack_static_table.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698