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

Unified Diff: blimp/net/compressed_packet_unittest.cc

Issue 1882043003: Blimp: add padding for zlib framing to buffer preallocation calculations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use RandBytesAsString() in unit tests. Created 4 years, 8 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 | « no previous file | blimp/net/compressed_packet_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/compressed_packet_unittest.cc
diff --git a/blimp/net/compressed_packet_unittest.cc b/blimp/net/compressed_packet_unittest.cc
index 61e39b88bb8779645626e61e92ee60387937f4bc..0742fda8d74659fb6abb0ee72bb9efe1d4fc54e0 100644
--- a/blimp/net/compressed_packet_unittest.cc
+++ b/blimp/net/compressed_packet_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/memory/ptr_util.h"
+#include "base/rand_util.h"
#include "base/sys_byteorder.h"
#include "blimp/net/common.h"
#include "blimp/net/compressed_packet_reader.h"
@@ -153,6 +154,15 @@ TEST_F(CompressedPacketTest, LargeInput) {
EXPECT_TRUE(CheckRoundTrip(big_str));
}
+TEST_F(CompressedPacketTest, LowCompressionRatio) {
+ // This size (2338) was found "in the wild" to repro an issue with output
+ // buffer overflows.
+ const int data_size = 2338;
+
+ EXPECT_TRUE(CheckRoundTrip(base::RandBytesAsString(data_size)));
+ EXPECT_TRUE(CheckRoundTrip(base::RandBytesAsString(data_size)));
+}
+
TEST_F(CompressedPacketTest, DecompressIllegallyLargePayload) {
// We can't use the compressor to compress an illegally sized payload, however
// we can concatenate the output of smaller payloads to form an uber-payload.
« no previous file with comments | « no previous file | blimp/net/compressed_packet_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698