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

Unified Diff: net/filter/brotli_filter_unittest.cc

Issue 1616863002: Fix division by zero. Test filter with empty output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/filter/brotli_filter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/filter/brotli_filter_unittest.cc
diff --git a/net/filter/brotli_filter_unittest.cc b/net/filter/brotli_filter_unittest.cc
index 9c9ce6533842f9b14157f92a3bf05582ba0a7f66..38cfc82d95457a7b59e169e9491691134de9c2a9 100644
--- a/net/filter/brotli_filter_unittest.cc
+++ b/net/filter/brotli_filter_unittest.cc
@@ -250,4 +250,20 @@ TEST_F(BrotliUnitTest, DecodeMissingData) {
EXPECT_EQ(Filter::FILTER_ERROR, code);
}
+// Decoding brotli stream with empty output data.
+TEST_F(BrotliUnitTest, DecodeEmptyData) {
+ char data[1] = {6}; // WBITS = 16, ISLAST = 1, ISLASTEMPTY = 1
+ int data_len = 1;
+
+ InitFilter();
+ char decode_buffer[kDefaultBufferSize];
+ int decode_size = kDefaultBufferSize;
+ int code = DecodeAllWithFilter(filter_.get(), data, data_len, decode_buffer,
+ &decode_size);
+
+ // Expect success / empty output.
+ EXPECT_EQ(Filter::FILTER_DONE, code);
+ EXPECT_EQ(0, decode_size);
+}
+
} // namespace net
« no previous file with comments | « net/filter/brotli_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698