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

Unified Diff: net/http2/hpack/huffman/http2_hpack_huffman_decoder_test.cc

Issue 2572343002: Use std::function instead of base::Callback in net/http2/. (Closed)
Patch Set: Remove unreachable return statements. Created 4 years 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
Index: net/http2/hpack/huffman/http2_hpack_huffman_decoder_test.cc
diff --git a/net/http2/hpack/huffman/http2_hpack_huffman_decoder_test.cc b/net/http2/hpack/huffman/http2_hpack_huffman_decoder_test.cc
index 3ad47351b54be3ee72a12e876ca323676f5096b0..3eb52adcf844035e470bb219fd0b4d0b8e5b252b 100644
--- a/net/http2/hpack/huffman/http2_hpack_huffman_decoder_test.cc
+++ b/net/http2/hpack/huffman/http2_hpack_huffman_decoder_test.cc
@@ -9,8 +9,6 @@
#include <iostream>
#include <string>
-#include "base/bind.h"
-#include "base/bind_helpers.h"
#include "base/macros.h"
#include "base/strings/string_piece.h"
#include "net/http2/decoder/decode_buffer.h"
@@ -202,25 +200,19 @@ class HpackHuffmanDecoderTest
return false;
}
- AssertionResult ValidatorForHuffmanDecodeAndValidateSeveralWays(
- StringPiece expected_plain) {
- VERIFY_EQ(output_buffer_.size(), expected_plain.size());
- VERIFY_EQ(output_buffer_, expected_plain);
- return AssertionSuccess();
- }
-
AssertionResult HuffmanDecodeAndValidateSeveralWays(
StringPiece encoded,
StringPiece expected_plain) {
input_bytes_expected_ = encoded.size();
+ NoArgValidator validator = [expected_plain, this]() -> AssertionResult {
+ VERIFY_EQ(output_buffer_.size(), expected_plain.size());
+ VERIFY_EQ(output_buffer_, expected_plain);
+ return AssertionSuccess();
+ };
DecodeBuffer db(encoded);
bool return_non_zero_on_first = false;
- return DecodeAndValidateSeveralWays(
- &db, return_non_zero_on_first,
- ValidateDoneAndEmpty(
- base::Bind(&HpackHuffmanDecoderTest::
- ValidatorForHuffmanDecodeAndValidateSeveralWays,
- base::Unretained(this), expected_plain)));
+ return DecodeAndValidateSeveralWays(&db, return_non_zero_on_first,
+ ValidateDoneAndEmpty(validator));
}
HpackHuffmanDecoder decoder_;

Powered by Google App Engine
This is Rietveld 408576698