diff --git a/quic/core/qpack/qpack_encoder.h b/quic/core/qpack/qpack_encoder.h
index c170e09..7b99a65 100644
--- a/quic/core/qpack/qpack_encoder.h
+++ b/quic/core/qpack/qpack_encoder.h
@@ -20,12 +20,7 @@
 #include "net/third_party/quiche/src/quic/core/quic_types.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_exported_stats.h"
-
-namespace spdy {
-
-class SpdyHeaderBlock;
-
-}  // namespace spdy
+#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
 
 namespace quic {
 
diff --git a/quic/tools/quic_simple_server_backend.h b/quic/tools/quic_simple_server_backend.h
index 968ec66..3941784 100644
--- a/quic/tools/quic_simple_server_backend.h
+++ b/quic/tools/quic_simple_server_backend.h
@@ -7,10 +7,7 @@
 
 #include "net/third_party/quiche/src/quic/core/quic_types.h"
 #include "net/third_party/quiche/src/quic/tools/quic_backend_response.h"
-
-namespace spdy {
-class SpdyHeaderBlock;
-}  // namespace spdy
+#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
 
 namespace quic {
 
diff --git a/spdy/core/spdy_header_block.cc b/spdy/core/spdy_header_block.cc
index ebb7918..23dd999 100644
--- a/spdy/core/spdy_header_block.cc
+++ b/spdy/core/spdy_header_block.cc
@@ -38,23 +38,23 @@
 
 }  // namespace
 
-SpdyHeaderBlock::HeaderValue::HeaderValue(SpdyHeaderStorage* storage,
-                                          absl::string_view key,
-                                          absl::string_view initial_value)
+Http2HeaderBlock::HeaderValue::HeaderValue(SpdyHeaderStorage* storage,
+                                           absl::string_view key,
+                                           absl::string_view initial_value)
     : storage_(storage),
       fragments_({initial_value}),
       pair_({key, {}}),
       size_(initial_value.size()),
       separator_size_(SeparatorForKey(key).size()) {}
 
-SpdyHeaderBlock::HeaderValue::HeaderValue(HeaderValue&& other)
+Http2HeaderBlock::HeaderValue::HeaderValue(HeaderValue&& other)
     : storage_(other.storage_),
       fragments_(std::move(other.fragments_)),
       pair_(std::move(other.pair_)),
       size_(other.size_),
       separator_size_(other.separator_size_) {}
 
-SpdyHeaderBlock::HeaderValue& SpdyHeaderBlock::HeaderValue::operator=(
+Http2HeaderBlock::HeaderValue& Http2HeaderBlock::HeaderValue::operator=(
     HeaderValue&& other) {
   storage_ = other.storage_;
   fragments_ = std::move(other.fragments_);
@@ -64,13 +64,13 @@
   return *this;
 }
 
-void SpdyHeaderBlock::HeaderValue::set_storage(SpdyHeaderStorage* storage) {
+void Http2HeaderBlock::HeaderValue::set_storage(SpdyHeaderStorage* storage) {
   storage_ = storage;
 }
 
-SpdyHeaderBlock::HeaderValue::~HeaderValue() = default;
+Http2HeaderBlock::HeaderValue::~HeaderValue() = default;
 
-absl::string_view SpdyHeaderBlock::HeaderValue::ConsolidatedValue() const {
+absl::string_view Http2HeaderBlock::HeaderValue::ConsolidatedValue() const {
   if (fragments_.empty()) {
     return absl::string_view();
   }
@@ -81,26 +81,26 @@
   return fragments_[0];
 }
 
-void SpdyHeaderBlock::HeaderValue::Append(absl::string_view fragment) {
+void Http2HeaderBlock::HeaderValue::Append(absl::string_view fragment) {
   size_ += (fragment.size() + separator_size_);
   fragments_.push_back(fragment);
 }
 
 const std::pair<absl::string_view, absl::string_view>&
-SpdyHeaderBlock::HeaderValue::as_pair() const {
+Http2HeaderBlock::HeaderValue::as_pair() const {
   pair_.second = ConsolidatedValue();
   return pair_;
 }
 
-SpdyHeaderBlock::iterator::iterator(MapType::const_iterator it) : it_(it) {}
+Http2HeaderBlock::iterator::iterator(MapType::const_iterator it) : it_(it) {}
 
-SpdyHeaderBlock::iterator::iterator(const iterator& other) = default;
+Http2HeaderBlock::iterator::iterator(const iterator& other) = default;
 
-SpdyHeaderBlock::iterator::~iterator() = default;
+Http2HeaderBlock::iterator::~iterator() = default;
 
-SpdyHeaderBlock::ValueProxy::ValueProxy(
-    SpdyHeaderBlock* block,
-    SpdyHeaderBlock::MapType::iterator lookup_result,
+Http2HeaderBlock::ValueProxy::ValueProxy(
+    Http2HeaderBlock* block,
+    Http2HeaderBlock::MapType::iterator lookup_result,
     const absl::string_view key,
     size_t* spdy_header_block_value_size)
     : block_(block),
@@ -109,7 +109,7 @@
       spdy_header_block_value_size_(spdy_header_block_value_size),
       valid_(true) {}
 
-SpdyHeaderBlock::ValueProxy::ValueProxy(ValueProxy&& other)
+Http2HeaderBlock::ValueProxy::ValueProxy(ValueProxy&& other)
     : block_(other.block_),
       lookup_result_(other.lookup_result_),
       key_(other.key_),
@@ -118,8 +118,8 @@
   other.valid_ = false;
 }
 
-SpdyHeaderBlock::ValueProxy& SpdyHeaderBlock::ValueProxy::operator=(
-    SpdyHeaderBlock::ValueProxy&& other) {
+Http2HeaderBlock::ValueProxy& Http2HeaderBlock::ValueProxy::operator=(
+    Http2HeaderBlock::ValueProxy&& other) {
   block_ = other.block_;
   lookup_result_ = other.lookup_result_;
   key_ = other.key_;
@@ -129,17 +129,17 @@
   return *this;
 }
 
-SpdyHeaderBlock::ValueProxy::~ValueProxy() {
+Http2HeaderBlock::ValueProxy::~ValueProxy() {
   // If the ValueProxy is destroyed while lookup_result_ == block_->end(),
   // the assignment operator was never used, and the block's SpdyHeaderStorage
   // can reclaim the memory used by the key. This makes lookup-only access to
-  // SpdyHeaderBlock through operator[] memory-neutral.
+  // Http2HeaderBlock through operator[] memory-neutral.
   if (valid_ && lookup_result_ == block_->map_.end()) {
     block_->storage_.Rewind(key_);
   }
 }
 
-SpdyHeaderBlock::ValueProxy& SpdyHeaderBlock::ValueProxy::operator=(
+Http2HeaderBlock::ValueProxy& Http2HeaderBlock::ValueProxy::operator=(
     absl::string_view value) {
   *spdy_header_block_value_size_ += value.size();
   SpdyHeaderStorage* storage = &block_->storage_;
@@ -158,7 +158,7 @@
   return *this;
 }
 
-bool SpdyHeaderBlock::ValueProxy::operator==(absl::string_view value) const {
+bool Http2HeaderBlock::ValueProxy::operator==(absl::string_view value) const {
   if (lookup_result_ == block_->map_.end()) {
     return false;
   } else {
@@ -166,7 +166,7 @@
   }
 }
 
-std::string SpdyHeaderBlock::ValueProxy::as_string() const {
+std::string Http2HeaderBlock::ValueProxy::as_string() const {
   if (lookup_result_ == block_->map_.end()) {
     return "";
   } else {
@@ -174,9 +174,9 @@
   }
 }
 
-SpdyHeaderBlock::SpdyHeaderBlock() : map_(kInitialMapBuckets) {}
+Http2HeaderBlock::Http2HeaderBlock() : map_(kInitialMapBuckets) {}
 
-SpdyHeaderBlock::SpdyHeaderBlock(SpdyHeaderBlock&& other)
+Http2HeaderBlock::Http2HeaderBlock(Http2HeaderBlock&& other)
     : map_(kInitialMapBuckets) {
   map_.swap(other.map_);
   storage_ = std::move(other.storage_);
@@ -187,9 +187,9 @@
   value_size_ = other.value_size_;
 }
 
-SpdyHeaderBlock::~SpdyHeaderBlock() = default;
+Http2HeaderBlock::~Http2HeaderBlock() = default;
 
-SpdyHeaderBlock& SpdyHeaderBlock::operator=(SpdyHeaderBlock&& other) {
+Http2HeaderBlock& Http2HeaderBlock::operator=(Http2HeaderBlock&& other) {
   map_.swap(other.map_);
   storage_ = std::move(other.storage_);
   for (auto& p : map_) {
@@ -200,23 +200,23 @@
   return *this;
 }
 
-SpdyHeaderBlock SpdyHeaderBlock::Clone() const {
-  SpdyHeaderBlock copy;
+Http2HeaderBlock Http2HeaderBlock::Clone() const {
+  Http2HeaderBlock copy;
   for (const auto& p : *this) {
     copy.AppendHeader(p.first, p.second);
   }
   return copy;
 }
 
-bool SpdyHeaderBlock::operator==(const SpdyHeaderBlock& other) const {
+bool Http2HeaderBlock::operator==(const Http2HeaderBlock& other) const {
   return size() == other.size() && std::equal(begin(), end(), other.begin());
 }
 
-bool SpdyHeaderBlock::operator!=(const SpdyHeaderBlock& other) const {
+bool Http2HeaderBlock::operator!=(const Http2HeaderBlock& other) const {
   return !(operator==(other));
 }
 
-std::string SpdyHeaderBlock::DebugString() const {
+std::string Http2HeaderBlock::DebugString() const {
   if (empty()) {
     return "{}";
   }
@@ -229,7 +229,7 @@
   return output;
 }
 
-void SpdyHeaderBlock::erase(absl::string_view key) {
+void Http2HeaderBlock::erase(absl::string_view key) {
   auto iter = map_.find(key);
   if (iter != map_.end()) {
     SPDY_DVLOG(1) << "Erasing header with name: " << key;
@@ -239,14 +239,14 @@
   }
 }
 
-void SpdyHeaderBlock::clear() {
+void Http2HeaderBlock::clear() {
   key_size_ = 0;
   value_size_ = 0;
   map_.clear();
   storage_.Clear();
 }
 
-void SpdyHeaderBlock::insert(const SpdyHeaderBlock::value_type& value) {
+void Http2HeaderBlock::insert(const Http2HeaderBlock::value_type& value) {
   // TODO(birenroy): Write new value in place of old value, if it fits.
   value_size_ += value.second.size();
 
@@ -264,7 +264,7 @@
   }
 }
 
-SpdyHeaderBlock::ValueProxy SpdyHeaderBlock::operator[](
+Http2HeaderBlock::ValueProxy Http2HeaderBlock::operator[](
     const absl::string_view key) {
   SPDY_DVLOG(2) << "Operator[] saw key: " << key;
   absl::string_view out_key;
@@ -282,8 +282,8 @@
   return ValueProxy(this, iter, out_key, &value_size_);
 }
 
-void SpdyHeaderBlock::AppendValueOrAddHeader(const absl::string_view key,
-                                             const absl::string_view value) {
+void Http2HeaderBlock::AppendValueOrAddHeader(const absl::string_view key,
+                                              const absl::string_view value) {
   value_size_ += value.size();
 
   auto iter = map_.find(key);
@@ -299,25 +299,25 @@
   iter->second.Append(storage_.Write(value));
 }
 
-size_t SpdyHeaderBlock::EstimateMemoryUsage() const {
+size_t Http2HeaderBlock::EstimateMemoryUsage() const {
   // TODO(xunjieli): https://crbug.com/669108. Also include |map_| when EMU()
   // supports linked_hash_map.
   return SpdyEstimateMemoryUsage(storage_);
 }
 
-void SpdyHeaderBlock::AppendHeader(const absl::string_view key,
-                                   const absl::string_view value) {
+void Http2HeaderBlock::AppendHeader(const absl::string_view key,
+                                    const absl::string_view value) {
   auto backed_key = WriteKey(key);
   map_.emplace(std::make_pair(
       backed_key, HeaderValue(&storage_, backed_key, storage_.Write(value))));
 }
 
-absl::string_view SpdyHeaderBlock::WriteKey(const absl::string_view key) {
+absl::string_view Http2HeaderBlock::WriteKey(const absl::string_view key) {
   key_size_ += key.size();
   return storage_.Write(key);
 }
 
-size_t SpdyHeaderBlock::bytes_allocated() const {
+size_t Http2HeaderBlock::bytes_allocated() const {
   return storage_.bytes_allocated();
 }
 
diff --git a/spdy/core/spdy_header_block.h b/spdy/core/spdy_header_block.h
index 1faf34d..b069d20 100644
--- a/spdy/core/spdy_header_block.h
+++ b/spdy/core/spdy_header_block.h
@@ -41,12 +41,12 @@
 // Under the hood, this data structure uses large, contiguous blocks of memory
 // to store names and values. Lookups may be performed with absl::string_view
 // keys, and values are returned as absl::string_views (via ValueProxy, below).
-// Value absl::string_views are valid as long as the SpdyHeaderBlock exists;
-// allocated memory is never freed until SpdyHeaderBlock's destruction.
+// Value absl::string_views are valid as long as the Http2HeaderBlock exists;
+// allocated memory is never freed until Http2HeaderBlock's destruction.
 //
 // This implementation does not make much of an effort to minimize wasted space.
-// It's expected that keys are rarely deleted from a SpdyHeaderBlock.
-class QUICHE_EXPORT_PRIVATE SpdyHeaderBlock {
+// It's expected that keys are rarely deleted from a Http2HeaderBlock.
+class QUICHE_EXPORT_PRIVATE Http2HeaderBlock {
  private:
   // Stores a list of value fragments that can be joined later with a
   // key-dependent separator.
@@ -75,7 +75,7 @@
     const std::pair<absl::string_view, absl::string_view>& as_pair() const;
 
     // Size estimate including separators. Used when keys are erased from
-    // SpdyHeaderBlock.
+    // Http2HeaderBlock.
     size_t SizeEstimate() const { return size_; }
 
    private:
@@ -158,17 +158,17 @@
   };
   typedef iterator const_iterator;
 
-  SpdyHeaderBlock();
-  SpdyHeaderBlock(const SpdyHeaderBlock& other) = delete;
-  SpdyHeaderBlock(SpdyHeaderBlock&& other);
-  ~SpdyHeaderBlock();
+  Http2HeaderBlock();
+  Http2HeaderBlock(const Http2HeaderBlock& other) = delete;
+  Http2HeaderBlock(Http2HeaderBlock&& other);
+  ~Http2HeaderBlock();
 
-  SpdyHeaderBlock& operator=(const SpdyHeaderBlock& other) = delete;
-  SpdyHeaderBlock& operator=(SpdyHeaderBlock&& other);
-  SpdyHeaderBlock Clone() const;
+  Http2HeaderBlock& operator=(const Http2HeaderBlock& other) = delete;
+  Http2HeaderBlock& operator=(Http2HeaderBlock&& other);
+  Http2HeaderBlock Clone() const;
 
-  bool operator==(const SpdyHeaderBlock& other) const;
-  bool operator!=(const SpdyHeaderBlock& other) const;
+  bool operator==(const Http2HeaderBlock& other) const;
+  bool operator!=(const Http2HeaderBlock& other) const;
 
   // Provides a human readable multi-line representation of the stored header
   // keys and values.
@@ -202,8 +202,8 @@
   void AppendValueOrAddHeader(const absl::string_view key,
                               const absl::string_view value);
 
-  // This object provides automatic conversions that allow SpdyHeaderBlock to be
-  // nearly a drop-in replacement for
+  // This object provides automatic conversions that allow Http2HeaderBlock to
+  // be nearly a drop-in replacement for
   // SpdyLinkedHashMap<std::string, std::string>.
   // It reads data from or writes data to a SpdyHeaderStorage.
   class QUICHE_EXPORT_PRIVATE ValueProxy {
@@ -218,7 +218,7 @@
     ValueProxy(const ValueProxy& other) = delete;
     ValueProxy& operator=(const ValueProxy& other) = delete;
 
-    // Assignment modifies the underlying SpdyHeaderBlock.
+    // Assignment modifies the underlying Http2HeaderBlock.
     ValueProxy& operator=(absl::string_view value);
 
     // Provides easy comparison against absl::string_view.
@@ -227,16 +227,16 @@
     std::string as_string() const;
 
    private:
-    friend class SpdyHeaderBlock;
+    friend class Http2HeaderBlock;
     friend class test::ValueProxyPeer;
 
-    ValueProxy(SpdyHeaderBlock* block,
-               SpdyHeaderBlock::MapType::iterator lookup_result,
+    ValueProxy(Http2HeaderBlock* block,
+               Http2HeaderBlock::MapType::iterator lookup_result,
                const absl::string_view key,
                size_t* spdy_header_block_value_size);
 
-    SpdyHeaderBlock* block_;
-    SpdyHeaderBlock::MapType::iterator lookup_result_;
+    Http2HeaderBlock* block_;
+    Http2HeaderBlock::MapType::iterator lookup_result_;
     absl::string_view key_;
     size_t* spdy_header_block_value_size_;
     bool valid_;
@@ -290,6 +290,9 @@
   size_t value_size_ = 0;
 };
 
+// TODO(b/156770486): Remove this alias when the rename is complete.
+using SpdyHeaderBlock = Http2HeaderBlock;
+
 }  // namespace spdy
 
 #endif  // QUICHE_SPDY_CORE_SPDY_HEADER_BLOCK_H_
diff --git a/spdy/core/spdy_header_block_test.cc b/spdy/core/spdy_header_block_test.cc
index a8dbe01..9fd7b68 100644
--- a/spdy/core/spdy_header_block_test.cc
+++ b/spdy/core/spdy_header_block_test.cc
@@ -17,7 +17,7 @@
 
 class ValueProxyPeer {
  public:
-  static absl::string_view key(SpdyHeaderBlock::ValueProxy* p) {
+  static absl::string_view key(Http2HeaderBlock::ValueProxy* p) {
     return p->key_;
   }
 };
@@ -27,9 +27,9 @@
   return std::make_pair(k, v);
 }
 
-// This test verifies that SpdyHeaderBlock behaves correctly when empty.
-TEST(SpdyHeaderBlockTest, EmptyBlock) {
-  SpdyHeaderBlock block;
+// This test verifies that Http2HeaderBlock behaves correctly when empty.
+TEST(Http2HeaderBlockTest, EmptyBlock) {
+  Http2HeaderBlock block;
   EXPECT_TRUE(block.empty());
   EXPECT_EQ(0u, block.size());
   EXPECT_EQ(block.end(), block.find("foo"));
@@ -39,8 +39,8 @@
   block.erase("bar");
 }
 
-TEST(SpdyHeaderBlockTest, KeyMemoryReclaimedOnLookup) {
-  SpdyHeaderBlock block;
+TEST(Http2HeaderBlockTest, KeyMemoryReclaimedOnLookup) {
+  Http2HeaderBlock block;
   absl::string_view copied_key1;
   {
     auto proxy1 = block["some key name"];
@@ -62,7 +62,7 @@
     block["some other key name"] = "some value";
   }
   // Nothing should blow up when proxy1 is destructed, and we should be able to
-  // modify and access the SpdyHeaderBlock.
+  // modify and access the Http2HeaderBlock.
   block["key"] = "value";
   EXPECT_EQ("value", block["key"]);
   EXPECT_EQ("some value", block["some other key name"]);
@@ -70,8 +70,8 @@
 }
 
 // This test verifies that headers can be set in a variety of ways.
-TEST(SpdyHeaderBlockTest, AddHeaders) {
-  SpdyHeaderBlock block;
+TEST(Http2HeaderBlockTest, AddHeaders) {
+  Http2HeaderBlock block;
   block["foo"] = std::string(300, 'x');
   block["bar"] = "baz";
   block["qux"] = "qux1";
@@ -89,29 +89,29 @@
   EXPECT_EQ(block.end(), block.find("key"));
 }
 
-// This test verifies that SpdyHeaderBlock can be copied using Clone().
-TEST(SpdyHeaderBlockTest, CopyBlocks) {
-  SpdyHeaderBlock block1;
+// This test verifies that Http2HeaderBlock can be copied using Clone().
+TEST(Http2HeaderBlockTest, CopyBlocks) {
+  Http2HeaderBlock block1;
   block1["foo"] = std::string(300, 'x');
   block1["bar"] = "baz";
   block1.insert(std::make_pair("qux", "qux1"));
 
-  SpdyHeaderBlock block2 = block1.Clone();
-  SpdyHeaderBlock block3(block1.Clone());
+  Http2HeaderBlock block2 = block1.Clone();
+  Http2HeaderBlock block3(block1.Clone());
 
   EXPECT_EQ(block1, block2);
   EXPECT_EQ(block1, block3);
 }
 
-TEST(SpdyHeaderBlockTest, Equality) {
+TEST(Http2HeaderBlockTest, Equality) {
   // Test equality and inequality operators.
-  SpdyHeaderBlock block1;
+  Http2HeaderBlock block1;
   block1["foo"] = "bar";
 
-  SpdyHeaderBlock block2;
+  Http2HeaderBlock block2;
   block2["foo"] = "bar";
 
-  SpdyHeaderBlock block3;
+  Http2HeaderBlock block3;
   block3["baz"] = "qux";
 
   EXPECT_EQ(block1, block2);
@@ -121,28 +121,28 @@
   EXPECT_NE(block1, block2);
 }
 
-SpdyHeaderBlock ReturnTestHeaderBlock() {
-  SpdyHeaderBlock block;
+Http2HeaderBlock ReturnTestHeaderBlock() {
+  Http2HeaderBlock block;
   block["foo"] = "bar";
   block.insert(std::make_pair("foo2", "baz"));
   return block;
 }
 
 // Test that certain methods do not crash on moved-from instances.
-TEST(SpdyHeaderBlockTest, MovedFromIsValid) {
-  SpdyHeaderBlock block1;
+TEST(Http2HeaderBlockTest, MovedFromIsValid) {
+  Http2HeaderBlock block1;
   block1["foo"] = "bar";
 
-  SpdyHeaderBlock block2(std::move(block1));
+  Http2HeaderBlock block2(std::move(block1));
   EXPECT_THAT(block2, ElementsAre(Pair("foo", "bar")));
 
   block1["baz"] = "qux";  // NOLINT  testing post-move behavior
 
-  SpdyHeaderBlock block3(std::move(block1));
+  Http2HeaderBlock block3(std::move(block1));
 
   block1["foo"] = "bar";  // NOLINT  testing post-move behavior
 
-  SpdyHeaderBlock block4(std::move(block1));
+  Http2HeaderBlock block4(std::move(block1));
 
   block1.clear();  // NOLINT  testing post-move behavior
   EXPECT_TRUE(block1.empty());
@@ -150,7 +150,7 @@
   block1["foo"] = "bar";
   EXPECT_THAT(block1, ElementsAre(Pair("foo", "bar")));
 
-  SpdyHeaderBlock block5 = ReturnTestHeaderBlock();
+  Http2HeaderBlock block5 = ReturnTestHeaderBlock();
   block5.AppendValueOrAddHeader("foo", "bar2");
   EXPECT_THAT(block5, ElementsAre(Pair("foo", std::string("bar\0bar2", 8)),
                                   Pair("foo2", "baz")));
@@ -158,8 +158,8 @@
 
 // This test verifies that headers can be appended to no matter how they were
 // added originally.
-TEST(SpdyHeaderBlockTest, AppendHeaders) {
-  SpdyHeaderBlock block;
+TEST(Http2HeaderBlockTest, AppendHeaders) {
+  Http2HeaderBlock block;
   block["foo"] = "foo";
   block.AppendValueOrAddHeader("foo", "bar");
   EXPECT_EQ(Pair("foo", std::string("foo\0bar", 7)), *block.find("foo"));
@@ -192,8 +192,8 @@
   EXPECT_EQ("singleton", block["h4"]);
 }
 
-TEST(SpdyHeaderBlockTest, CompareValueToStringPiece) {
-  SpdyHeaderBlock block;
+TEST(Http2HeaderBlockTest, CompareValueToStringPiece) {
+  Http2HeaderBlock block;
   block["foo"] = "foo";
   block.AppendValueOrAddHeader("foo", "bar");
   const auto& val = block["foo"];
@@ -213,10 +213,10 @@
   EXPECT_FALSE(val2 == absl::string_view(""));
 }
 
-// This test demonstrates that the SpdyHeaderBlock data structure does not place
-// any limitations on the characters present in the header names.
-TEST(SpdyHeaderBlockTest, UpperCaseNames) {
-  SpdyHeaderBlock block;
+// This test demonstrates that the Http2HeaderBlock data structure does not
+// place any limitations on the characters present in the header names.
+TEST(Http2HeaderBlockTest, UpperCaseNames) {
+  Http2HeaderBlock block;
   block["Foo"] = "foo";
   block.AppendValueOrAddHeader("Foo", "bar");
   EXPECT_NE(block.end(), block.find("foo"));
@@ -230,7 +230,7 @@
 }
 
 namespace {
-size_t SpdyHeaderBlockSize(const SpdyHeaderBlock& block) {
+size_t Http2HeaderBlockSize(const Http2HeaderBlock& block) {
   size_t size = 0;
   for (const auto& pair : block) {
     size += pair.first.size() + pair.second.size();
@@ -239,38 +239,38 @@
 }
 }  // namespace
 
-// Tests SpdyHeaderBlock SizeEstimate().
-TEST(SpdyHeaderBlockTest, TotalBytesUsed) {
-  SpdyHeaderBlock block;
+// Tests Http2HeaderBlock SizeEstimate().
+TEST(Http2HeaderBlockTest, TotalBytesUsed) {
+  Http2HeaderBlock block;
   const size_t value_size = 300;
   block["foo"] = std::string(value_size, 'x');
-  EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+  EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
   block.insert(std::make_pair("key", std::string(value_size, 'x')));
-  EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+  EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
   block.AppendValueOrAddHeader("abc", std::string(value_size, 'x'));
-  EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+  EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
 
   // Replace value for existing key.
   block["foo"] = std::string(value_size, 'x');
-  EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+  EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
   block.insert(std::make_pair("key", std::string(value_size, 'x')));
-  EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+  EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
   // Add value for existing key.
   block.AppendValueOrAddHeader("abc", std::string(value_size, 'x'));
-  EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+  EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
 
-  // Copies/clones SpdyHeaderBlock.
+  // Copies/clones Http2HeaderBlock.
   size_t block_size = block.TotalBytesUsed();
-  SpdyHeaderBlock block_copy = std::move(block);
+  Http2HeaderBlock block_copy = std::move(block);
   EXPECT_EQ(block_size, block_copy.TotalBytesUsed());
 
   // Erases key.
   block_copy.erase("foo");
-  EXPECT_EQ(block_copy.TotalBytesUsed(), SpdyHeaderBlockSize(block_copy));
+  EXPECT_EQ(block_copy.TotalBytesUsed(), Http2HeaderBlockSize(block_copy));
   block_copy.erase("key");
-  EXPECT_EQ(block_copy.TotalBytesUsed(), SpdyHeaderBlockSize(block_copy));
+  EXPECT_EQ(block_copy.TotalBytesUsed(), Http2HeaderBlockSize(block_copy));
   block_copy.erase("abc");
-  EXPECT_EQ(block_copy.TotalBytesUsed(), SpdyHeaderBlockSize(block_copy));
+  EXPECT_EQ(block_copy.TotalBytesUsed(), Http2HeaderBlockSize(block_copy));
 }
 
 }  // namespace test
