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

Unified Diff: third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp

Issue 2172183003: Return unique_ptr<WebDataConsumerHandle::Reader> directly from obtainReader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gmock_cxx11
Patch Set: rebase Created 4 years, 5 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
Index: third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
index a547d78976bec58a5d6a9cb8c06077c82309485e..83ed30bdb9ff5e88d498b5891ee5e391124a9384 100644
--- a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
@@ -22,7 +22,9 @@ namespace blink {
namespace {
+using ::testing::ByMove;
using ::testing::InSequence;
+using ::testing::Return;
using ::testing::_;
using ::testing::SaveArg;
using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>;
@@ -483,20 +485,18 @@ TEST_F(BodyStreamBufferTest, SourceHandleAndReaderShouldBeDestructedWhenCanceled
using MockHandle = MockFetchDataConsumerHandleWithMockDestructor;
using MockReader = DataConsumerHandleTestUtil::MockFetchDataConsumerReader;
std::unique_ptr<MockHandle> handle = MockHandle::create();
- std::unique_ptr<MockReader> reader = MockReader::create();
+ // |reader| will be adopted by |obtainFetchDataReader|.
+ MockReader* reader = MockReader::create().release();
Checkpoint checkpoint;
InSequence s;
- EXPECT_CALL(*handle, obtainReaderInternal(_)).WillOnce(::testing::Return(reader.get()));
+ EXPECT_CALL(*handle, obtainFetchDataReader(_)).WillOnce(Return(ByMove(WTF::wrapUnique(reader))));
EXPECT_CALL(checkpoint, Call(1));
EXPECT_CALL(*reader, destruct());
EXPECT_CALL(*handle, destruct());
EXPECT_CALL(checkpoint, Call(2));
- // |reader| is adopted by |obtainReader|.
- ASSERT_TRUE(reader.release());
-
BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), std::move(handle));
checkpoint.Call(1);
ScriptValue reason(scope.getScriptState(), v8String(scope.getScriptState()->isolate(), "reason"));

Powered by Google App Engine
This is Rietveld 408576698