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

Unified Diff: net/spdy/hpack_entry_test.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/hpack_entry.cc ('k') | net/spdy/hpack_header_table.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack_entry_test.cc
diff --git a/net/spdy/hpack_entry_test.cc b/net/spdy/hpack_entry_test.cc
deleted file mode 100644
index 0a9a0a251c6eb03eb9831e78b5840f5f09a660b5..0000000000000000000000000000000000000000
--- a/net/spdy/hpack_entry_test.cc
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/spdy/hpack_entry.h"
-
-#include <string>
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace net {
-
-namespace {
-
-using std::string;
-
-class HpackEntryTest : public ::testing::Test {
- protected:
- HpackEntryTest()
- : name_("header-name"),
- value_("header value"),
- total_insertions_(0),
- table_size_(0) {}
-
- // These builders maintain the same external table invariants that a "real"
- // table (ie HpackHeaderTable) would.
- HpackEntry StaticEntry() {
- return HpackEntry(name_, value_, true, total_insertions_++);
- }
- HpackEntry DynamicEntry() {
- ++table_size_;
- size_t index = total_insertions_++;
- return HpackEntry(name_, value_, false, index);
- }
- void DropEntry() { --table_size_; }
-
- size_t IndexOf(const HpackEntry& entry) const {
- if (entry.IsStatic()) {
- return 1 + entry.InsertionIndex() + table_size_;
- } else {
- return total_insertions_ - entry.InsertionIndex();
- }
- }
-
- size_t Size() {
- return name_.size() + value_.size() + HpackEntry::kSizeOverhead;
- }
-
- string name_, value_;
-
- private:
- // Referenced by HpackEntry instances.
- size_t total_insertions_;
- size_t table_size_;
-};
-
-TEST_F(HpackEntryTest, StaticConstructor) {
- HpackEntry entry(StaticEntry());
-
- EXPECT_EQ(name_, entry.name());
- EXPECT_EQ(value_, entry.value());
- EXPECT_TRUE(entry.IsStatic());
- EXPECT_EQ(1u, IndexOf(entry));
- EXPECT_EQ(Size(), entry.Size());
-}
-
-TEST_F(HpackEntryTest, DynamicConstructor) {
- HpackEntry entry(DynamicEntry());
-
- EXPECT_EQ(name_, entry.name());
- EXPECT_EQ(value_, entry.value());
- EXPECT_FALSE(entry.IsStatic());
- EXPECT_EQ(1u, IndexOf(entry));
- EXPECT_EQ(Size(), entry.Size());
-}
-
-TEST_F(HpackEntryTest, LookupConstructor) {
- HpackEntry entry(name_, value_);
-
- EXPECT_EQ(name_, entry.name());
- EXPECT_EQ(value_, entry.value());
- EXPECT_FALSE(entry.IsStatic());
- EXPECT_EQ(0u, IndexOf(entry));
- EXPECT_EQ(Size(), entry.Size());
-}
-
-TEST_F(HpackEntryTest, DefaultConstructor) {
- HpackEntry entry;
-
- EXPECT_TRUE(entry.name().empty());
- EXPECT_TRUE(entry.value().empty());
- EXPECT_EQ(HpackEntry::kSizeOverhead, entry.Size());
-}
-
-TEST_F(HpackEntryTest, IndexUpdate) {
- HpackEntry static1(StaticEntry());
- HpackEntry static2(StaticEntry());
-
- EXPECT_EQ(1u, IndexOf(static1));
- EXPECT_EQ(2u, IndexOf(static2));
-
- HpackEntry dynamic1(DynamicEntry());
- HpackEntry dynamic2(DynamicEntry());
-
- EXPECT_EQ(1u, IndexOf(dynamic2));
- EXPECT_EQ(2u, IndexOf(dynamic1));
- EXPECT_EQ(3u, IndexOf(static1));
- EXPECT_EQ(4u, IndexOf(static2));
-
- DropEntry(); // Drops |dynamic1|.
-
- EXPECT_EQ(1u, IndexOf(dynamic2));
- EXPECT_EQ(2u, IndexOf(static1));
- EXPECT_EQ(3u, IndexOf(static2));
-
- HpackEntry dynamic3(DynamicEntry());
-
- EXPECT_EQ(1u, IndexOf(dynamic3));
- EXPECT_EQ(2u, IndexOf(dynamic2));
- EXPECT_EQ(3u, IndexOf(static1));
- EXPECT_EQ(4u, IndexOf(static2));
-}
-
-} // namespace
-
-} // namespace net
« no previous file with comments | « net/spdy/hpack_entry.cc ('k') | net/spdy/hpack_header_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698