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

Unified Diff: net/spdy/hpack/hpack_header_table_test.cc

Issue 2348603003: Increase HPACK table size up to the optimal size if clients allow it. (Closed)
Patch Set: Address review comments. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/hpack/hpack_header_table.cc ('k') | net/spdy/spdy_flags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack/hpack_header_table_test.cc
diff --git a/net/spdy/hpack/hpack_header_table_test.cc b/net/spdy/hpack/hpack_header_table_test.cc
index b79b7a717f96e7fe3c1fbcf3e86a7e182fe248e1..3a470365f042f1b726da9af8d03af17c42a1d9eb 100644
--- a/net/spdy/hpack/hpack_header_table_test.cc
+++ b/net/spdy/hpack/hpack_header_table_test.cc
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "net/spdy/hpack/hpack_constants.h"
#include "net/spdy/hpack/hpack_entry.h"
+#include "net/spdy/spdy_flags.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -258,6 +259,41 @@ TEST_F(HpackHeaderTableTest, EntryIndexing) {
}
TEST_F(HpackHeaderTableTest, SetSizes) {
+ FLAGS_chromium_reloadable_flag_increase_hpack_table_size = true;
+ string key = "key", value = "value";
+ const HpackEntry* entry1 = table_.TryAddEntry(key, value);
+ const HpackEntry* entry2 = table_.TryAddEntry(key, value);
+ const HpackEntry* entry3 = table_.TryAddEntry(key, value);
+
+ // Set exactly large enough. No Evictions.
+ size_t max_size = entry1->Size() + entry2->Size() + entry3->Size();
+ table_.SetMaxSize(max_size);
+ EXPECT_EQ(3u, peer_.dynamic_entries().size());
+
+ // Set just too small. One eviction.
+ max_size = entry1->Size() + entry2->Size() + entry3->Size() - 1;
+ table_.SetMaxSize(max_size);
+ EXPECT_EQ(2u, peer_.dynamic_entries().size());
+
+ // Changing SETTINGS_HEADER_TABLE_SIZE.
+ EXPECT_EQ(kDefaultHeaderTableSizeSetting, table_.settings_size_bound());
+ // In production, the size passed to SetSettingsHeaderTableSize is never
+ // larger than table_.settings_size_bound().
+ table_.SetSettingsHeaderTableSize(kDefaultHeaderTableSizeSetting * 3 + 1);
+ EXPECT_EQ(kDefaultHeaderTableSizeSetting * 3 + 1, table_.max_size());
+
+ // SETTINGS_HEADER_TABLE_SIZE upper-bounds |table_.max_size()|,
+ // and will force evictions.
+ max_size = entry3->Size() - 1;
+ table_.SetSettingsHeaderTableSize(max_size);
+ EXPECT_EQ(max_size, table_.max_size());
+ EXPECT_EQ(max_size, table_.settings_size_bound());
+ EXPECT_EQ(0u, peer_.dynamic_entries().size());
+}
+
+TEST_F(HpackHeaderTableTest, SetSizesOld) {
+ FLAGS_chromium_reloadable_flag_increase_hpack_table_size = false;
+
string key = "key", value = "value";
const HpackEntry* entry1 = table_.TryAddEntry(key, value);
const HpackEntry* entry2 = table_.TryAddEntry(key, value);
« no previous file with comments | « net/spdy/hpack/hpack_header_table.cc ('k') | net/spdy/spdy_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698