Files.app: Add ExternalMetadataProvider class.
[chromium-blink-merge.git] / net / spdy / hpack_static_table_test.cc
bloba13d7379cddbf3651783a1ba97948b3cfac8efb4
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.
5 #include "net/spdy/hpack_static_table.h"
7 #include <vector>
9 #include "net/base/net_export.h"
10 #include "net/spdy/hpack_constants.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 namespace net {
15 namespace test {
17 namespace {
19 class HpackStaticTableTest : public ::testing::Test {
20 protected:
21 HpackStaticTableTest() : table_() {}
23 HpackStaticTable table_;
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());
33 HpackHeaderTable::EntryTable static_entries = table_.GetStaticEntries();
34 EXPECT_EQ(static_table.size(), static_entries.size());
36 HpackHeaderTable::OrderedEntrySet static_index = table_.GetStaticIndex();
37 EXPECT_EQ(static_table.size(), static_index.size());
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);
47 } // namespace
49 } // namespace test
51 } // namespace net