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

Unified Diff: net/quic/core/quic_header_list_test.cc

Issue 2430973004: Landing Recent QUIC changes until 10:38 AM, Oct 17, 2016 UTC-4 (Closed)
Patch Set: Improving flagsaver logging Created 4 years, 2 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/quic/core/quic_header_list.cc ('k') | net/quic/core/quic_headers_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_header_list_test.cc
diff --git a/net/quic/core/quic_header_list_test.cc b/net/quic/core/quic_header_list_test.cc
index 4c91c418b2c52ab670153db47cbfee4586b21652..54fa9cb78beaf5a3dfd7406e5663d410a27e5cb3 100644
--- a/net/quic/core/quic_header_list_test.cc
+++ b/net/quic/core/quic_header_list_test.cc
@@ -4,9 +4,13 @@
#include "net/quic/core/quic_header_list.h"
+#include "net/quic/core/quic_flags.h"
+#include "net/quic/test_tools/quic_test_utils.h"
#include "net/test/gtest_util.h"
#include "testing/gmock/include/gmock/gmock.h"
+using std::string;
+
namespace net {
// This test verifies that QuicHeaderList accumulates header pairs in order.
@@ -19,6 +23,29 @@ TEST(QuicHeaderListTest, OnHeader) {
EXPECT_EQ("{ foo=bar, april=fools, beep=, }", headers.DebugString());
}
+TEST(QuicHeaderListTest, TooLarge) {
+ test::QuicFlagSaver flags;
+ FLAGS_quic_limit_uncompressed_headers = true;
+ QuicHeaderList headers;
+ string key = "key";
+ string value(1 << 18, '1');
+ headers.OnHeader(key, value);
+ headers.OnHeaderBlockEnd(key.size() + value.size());
+ EXPECT_TRUE(headers.empty());
+
+ EXPECT_EQ("{ }", headers.DebugString());
+}
+
+TEST(QuicHeaderListTest, NotTooLarge) {
+ QuicHeaderList headers;
+ headers.set_max_uncompressed_header_bytes(1 << 20);
+ string key = "key";
+ string value(1 << 18, '1');
+ headers.OnHeader(key, value);
+ headers.OnHeaderBlockEnd(key.size() + value.size());
+ EXPECT_FALSE(headers.empty());
+}
+
// This test verifies that QuicHeaderList is copyable and assignable.
TEST(QuicHeaderListTest, IsCopyableAndAssignable) {
QuicHeaderList headers;
« no previous file with comments | « net/quic/core/quic_header_list.cc ('k') | net/quic/core/quic_headers_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698