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

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

Issue 2376193004: Stop FetchDataLoaderTest from using [Web|Fetch]DataConsumerHandle. (Closed)
Patch Set: fix Created 4 years, 3 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/FormDataBytesConsumerTest.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp b/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp
index 94ac06429a0525753bc56e077e34be7d4b305546..f037230e9a475b447c806b5d32c4dfe3049f68c9 100644
--- a/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp
@@ -27,6 +27,7 @@ using ::testing::DoAll;
using ::testing::InSequence;
using ::testing::Return;
using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>;
+using MockBytesConsumer = BytesConsumerTestUtil::MockBytesConsumer;
String toString(const Vector<char>& v)
{
@@ -57,24 +58,6 @@ public:
void onStateChange() override {}
};
-class MockBytesConsumer : public BytesConsumer {
-public:
- static MockBytesConsumer* create() { return new ::testing::StrictMock<MockBytesConsumer>(); }
-
- MOCK_METHOD2(beginRead, Result(const char**, size_t*));
- MOCK_METHOD1(endRead, Result(size_t));
- MOCK_METHOD1(setClient, void(Client*));
- MOCK_METHOD0(clearClient, void());
- MOCK_METHOD0(cancel, void());
- MOCK_CONST_METHOD0(getPublicState, PublicState());
- MOCK_CONST_METHOD0(getError, Error());
-
- String debugName() const override { return "MockBytesConsumer"; }
-
-protected:
- MockBytesConsumer() = default;
-};
-
class FormDataBytesConsumerTest : public ::testing::Test {
public:
FormDataBytesConsumerTest() : m_page(DummyPageHolder::create()) {}
@@ -324,21 +307,24 @@ TEST_F(FormDataBytesConsumerTest, BeginReadAffectsDrainingWithComplexFormData)
EXPECT_CALL(*underlying, beginRead(&buffer, &available)).WillOnce(Return(Result::Ok));
EXPECT_CALL(*underlying, endRead(0)).WillOnce(Return(Result::Ok));
EXPECT_CALL(checkpoint, Call(2));
- // drainAsFormData / drainAsBlobDataHandle should not be called here.
+ // drainAsFormData should not be called here.
EXPECT_CALL(checkpoint, Call(3));
+ EXPECT_CALL(*underlying, drainAsBlobDataHandle(_));
+ EXPECT_CALL(checkpoint, Call(4));
// |consumer| delegates the getPublicState call to |underlying|.
EXPECT_CALL(*underlying, getPublicState()).WillOnce(Return(BytesConsumer::PublicState::ReadableOrWaiting));
- EXPECT_CALL(checkpoint, Call(4));
+ EXPECT_CALL(checkpoint, Call(5));
checkpoint.Call(1);
ASSERT_EQ(Result::Ok, consumer->beginRead(&buffer, &available));
ASSERT_EQ(Result::Ok, consumer->endRead(0));
checkpoint.Call(2);
EXPECT_FALSE(consumer->drainAsFormData());
- EXPECT_FALSE(consumer->drainAsBlobDataHandle());
checkpoint.Call(3);
- EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting, consumer->getPublicState());
+ EXPECT_FALSE(consumer->drainAsBlobDataHandle());
checkpoint.Call(4);
+ EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting, consumer->getPublicState());
+ checkpoint.Call(5);
}
TEST_F(FormDataBytesConsumerTest, SetClientWithComplexFormData)

Powered by Google App Engine
This is Rietveld 408576698