Commit 9a7c0efc authored by rjshade's avatar rjshade Committed by Commit bot

Landing Recent QUIC changes until 12:46 PM, Dec 31, 2016 UTC-5

There are no flags to be updated.

Migrate StringPiece::AppendToString to StrAppend
Merge internal change: 143299373
https://codereview.chromium.org/2617523002/

Add tests for QuicTextUtils::HexEncode and HexDecode which use non-ASCII printable data.
Merge internal change: 143126254
https://codereview.chromium.org/2616493003/

R=rch@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2618433002
Cr-Commit-Position: refs/heads/master@{#441473}
parent 568545c2
......@@ -247,9 +247,7 @@ class TestQuicVisitor : public QuicFramerVisitorInterface {
bool OnStreamFrame(const QuicStreamFrame& frame) override {
++frame_count_;
// Save a copy of the data so it is valid after the packet is processed.
string* string_data = new string();
StringPiece(frame.data_buffer, frame.data_length)
.AppendToString(string_data);
string* string_data = new string(frame.data_buffer, frame.data_length);
stream_data_.push_back(base::WrapUnique(string_data));
stream_frames_.push_back(base::MakeUnique<QuicStreamFrame>(
frame.stream_id, frame.fin, frame.offset, *string_data));
......
......@@ -71,11 +71,13 @@ TEST(QuicTextUtilsText, HexEncode) {
EXPECT_EQ("48656c6c6f", QuicTextUtils::HexEncode("Hello", 5));
EXPECT_EQ("48656c6c6f", QuicTextUtils::HexEncode("Hello World", 5));
EXPECT_EQ("48656c6c6f", QuicTextUtils::HexEncode("Hello"));
EXPECT_EQ("0102779cfa", QuicTextUtils::HexEncode("\x01\x02\x77\x9c\xfa"));
}
TEST(QuicTextUtilsText, HexDecode) {
EXPECT_EQ("Hello", QuicTextUtils::HexDecode("48656c6c6f"));
EXPECT_EQ("", QuicTextUtils::HexDecode(""));
EXPECT_EQ("\x01\x02\x77\x9c\xfa", QuicTextUtils::HexDecode("0102779cfa"));
}
TEST(QuicTextUtilsText, HexDump) {
......
......@@ -53,8 +53,7 @@ class SimpleFramerVisitor : public QuicFramerVisitorInterface {
bool OnStreamFrame(const QuicStreamFrame& frame) override {
// Save a copy of the data so it is valid after the packet is processed.
string* string_data = new string();
StringPiece(frame.data_buffer, frame.data_length)
.AppendToString(string_data);
string_data->append(frame.data_buffer, frame.data_length);
stream_data_.push_back(base::WrapUnique(string_data));
// TODO(ianswett): A pointer isn't necessary with emplace_back.
stream_frames_.push_back(base::MakeUnique<QuicStreamFrame>(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment