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

Unified Diff: net/spdy/core/spdy_framer_test.cc

Issue 2840563003: Implement SpdyMakeUnique and SpdyWrapUnique. (Closed)
Patch Set: Created 3 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 | « net/spdy/core/spdy_framer_decoder_adapter.cc ('k') | net/spdy/core/spdy_header_block.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/core/spdy_framer_test.cc
diff --git a/net/spdy/core/spdy_framer_test.cc b/net/spdy/core/spdy_framer_test.cc
index 31aea0f4b1972d95c4c102bac29685e5cf1169eb..67bc8cca27348035157719c6e90ed852ee77e3b2 100644
--- a/net/spdy/core/spdy_framer_test.cc
+++ b/net/spdy/core/spdy_framer_test.cc
@@ -29,6 +29,7 @@
#include "net/spdy/core/spdy_frame_reader.h"
#include "net/spdy/core/spdy_protocol.h"
#include "net/spdy/core/spdy_test_utils.h"
+#include "net/spdy/platform/api/spdy_ptr_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -95,7 +96,7 @@ class SpdyFramerTestUtil {
SpdyHeadersHandlerInterface* OnHeaderFrameStart(
SpdyStreamId stream_id) override {
if (headers_handler_ == nullptr) {
- headers_handler_ = base::MakeUnique<TestHeadersHandler>();
+ headers_handler_ = SpdyMakeUnique<TestHeadersHandler>();
}
return headers_handler_.get();
}
@@ -116,7 +117,7 @@ class SpdyFramerTestUtil {
bool exclusive,
bool fin,
bool end) override {
- auto headers = base::MakeUnique<SpdyHeadersIR>(stream_id);
+ auto headers = SpdyMakeUnique<SpdyHeadersIR>(stream_id);
headers->set_has_priority(has_priority);
headers->set_weight(weight);
headers->set_parent_stream_id(parent_stream_id);
@@ -128,8 +129,7 @@ class SpdyFramerTestUtil {
void OnPushPromise(SpdyStreamId stream_id,
SpdyStreamId promised_stream_id,
bool end) override {
- frame_ =
- base::MakeUnique<SpdyPushPromiseIR>(stream_id, promised_stream_id);
+ frame_ = SpdyMakeUnique<SpdyPushPromiseIR>(stream_id, promised_stream_id);
}
// TODO(birenroy): Add support for CONTINUATION.
@@ -235,7 +235,7 @@ class SpdyFramerPeer {
// header serialization path.
static std::unique_ptr<SpdyHeadersIR> CloneSpdyHeadersIR(
const SpdyHeadersIR& headers) {
- auto newHeaders = base::MakeUnique<SpdyHeadersIR>(
+ auto newHeaders = SpdyMakeUnique<SpdyHeadersIR>(
headers.stream_id(), headers.header_block().Clone());
newHeaders->set_fin(headers.fin());
newHeaders->set_has_priority(headers.has_priority());
@@ -305,7 +305,7 @@ class SpdyFramerPeer {
static std::unique_ptr<SpdyPushPromiseIR> CloneSpdyPushPromiseIR(
const SpdyPushPromiseIR& push_promise) {
- auto new_push_promise = base::MakeUnique<SpdyPushPromiseIR>(
+ auto new_push_promise = SpdyMakeUnique<SpdyPushPromiseIR>(
push_promise.stream_id(), push_promise.promised_stream_id(),
push_promise.header_block().Clone());
new_push_promise->set_fin(push_promise.fin());
@@ -457,7 +457,7 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
SpdyHeadersHandlerInterface* OnHeaderFrameStart(
SpdyStreamId stream_id) override {
if (headers_handler_ == nullptr) {
- headers_handler_ = base::MakeUnique<TestHeadersHandler>();
+ headers_handler_ = SpdyMakeUnique<TestHeadersHandler>();
}
return headers_handler_.get();
}
@@ -1253,7 +1253,7 @@ TEST_P(SpdyFramerTest, ContinuationWithStreamIdZero) {
SpdyContinuationIR continuation(0);
auto some_nonsense_encoding =
- base::MakeUnique<SpdyString>("some nonsense encoding");
+ SpdyMakeUnique<SpdyString>("some nonsense encoding");
continuation.take_encoding(std::move(some_nonsense_encoding));
continuation.set_end_headers(true);
SpdySerializedFrame frame(framer.SerializeContinuation(continuation));
@@ -2526,7 +2526,7 @@ TEST_P(SpdyFramerTest, CreateContinuationUncompressed) {
SpdyHeaderBlock header_block;
header_block["bar"] = "foo";
header_block["foo"] = "bar";
- auto buffer = base::MakeUnique<SpdyString>();
+ auto buffer = SpdyMakeUnique<SpdyString>();
HpackEncoder encoder(ObtainHpackHuffmanTable());
encoder.DisableCompression();
encoder.EncodeHeaderSet(header_block, buffer.get());
@@ -2808,7 +2808,7 @@ TEST_P(SpdyFramerTest, TooLargeHeadersFrameUsesContinuation) {
TEST_P(SpdyFramerTest, MultipleContinuationFramesWithIterator) {
SpdyFramer framer(SpdyFramer::DISABLE_COMPRESSION);
- auto headers = base::MakeUnique<SpdyHeadersIR>(1);
+ auto headers = SpdyMakeUnique<SpdyHeadersIR>(/* stream_id = */ 1);
headers->set_padding_len(256);
// Exact payload length will change with HPACK, but this should be long
@@ -2874,7 +2874,9 @@ TEST_P(SpdyFramerTest, MultipleContinuationFramesWithIterator) {
TEST_P(SpdyFramerTest, PushPromiseFramesWithIterator) {
SpdyFramer framer(SpdyFramer::DISABLE_COMPRESSION);
- auto push_promise = base::MakeUnique<SpdyPushPromiseIR>(1, 2);
+ auto push_promise =
+ SpdyMakeUnique<SpdyPushPromiseIR>(/* stream_id = */ 1,
+ /* promised_stream_id = */ 2);
push_promise->set_padding_len(256);
// Exact payload length will change with HPACK, but this should be long
@@ -4700,7 +4702,7 @@ TEST_P(SpdyFramerTest, ReadInvalidRstStreamWithPayload) {
TEST_P(SpdyFramerTest, ProcessAllInput) {
SpdyFramer framer(SpdyFramer::ENABLE_COMPRESSION);
auto visitor =
- base::MakeUnique<TestSpdyVisitor>(SpdyFramer::DISABLE_COMPRESSION);
+ SpdyMakeUnique<TestSpdyVisitor>(SpdyFramer::DISABLE_COMPRESSION);
framer.set_visitor(visitor.get());
// Create two input frames.
@@ -4786,7 +4788,7 @@ TEST_P(SpdyFramerTest, ProcessAtMostOneFrame) {
for (size_t first_size = 0; first_size <= buf_size; ++first_size) {
VLOG(1) << "first_size = " << first_size;
auto visitor =
- base::MakeUnique<TestSpdyVisitor>(SpdyFramer::DISABLE_COMPRESSION);
+ SpdyMakeUnique<TestSpdyVisitor>(SpdyFramer::DISABLE_COMPRESSION);
framer.set_visitor(visitor.get());
EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
« no previous file with comments | « net/spdy/core/spdy_framer_decoder_adapter.cc ('k') | net/spdy/core/spdy_header_block.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698