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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/BytesConsumerTestUtil.cpp

Issue 2376193004: Stop FetchDataLoaderTest from using [Web|Fetch]DataConsumerHandle. (Closed)
Patch Set: fix Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/fetch/BytesConsumerTestUtil.h" 5 #include "modules/fetch/BytesConsumerTestUtil.h"
6 6
7 #include "core/dom/ExecutionContext.h" 7 #include "core/dom/ExecutionContext.h"
8 #include "core/dom/TaskRunnerHelper.h" 8 #include "core/dom/TaskRunnerHelper.h"
9 #include "platform/testing/UnitTestHelpers.h" 9 #include "platform/testing/UnitTestHelpers.h"
10 #include "public/platform/WebTaskRunner.h" 10 #include "public/platform/WebTaskRunner.h"
11 #include "wtf/Assertions.h" 11 #include "wtf/Assertions.h"
12 #include "wtf/Functional.h" 12 #include "wtf/Functional.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 using Result = BytesConsumer::Result; 16 using Result = BytesConsumer::Result;
17 using ::testing::_;
18 using ::testing::DoAll;
19 using ::testing::Return;
20 using ::testing::SetArgPointee;
21
22 BytesConsumerTestUtil::MockBytesConsumer::MockBytesConsumer()
23 {
24 ON_CALL(*this, beginRead(_, _)).WillByDefault(DoAll(SetArgPointee<0>(nullptr ), SetArgPointee<1>(0), Return(Result::Error)));
25 ON_CALL(*this, endRead(_)).WillByDefault(Return(Result::Error));
26 ON_CALL(*this, getPublicState()).WillByDefault(Return(PublicState::Errored)) ;
27 ON_CALL(*this, drainAsBlobDataHandle(_)).WillByDefault(Return(nullptr));
28 ON_CALL(*this, drainAsFormData()).WillByDefault(Return(nullptr));
29 }
17 30
18 BytesConsumerTestUtil::ReplayingBytesConsumer::ReplayingBytesConsumer(ExecutionC ontext* executionContext) 31 BytesConsumerTestUtil::ReplayingBytesConsumer::ReplayingBytesConsumer(ExecutionC ontext* executionContext)
19 : m_executionContext(executionContext) 32 : m_executionContext(executionContext)
20 { 33 {
21 } 34 }
22 35
23 BytesConsumerTestUtil::ReplayingBytesConsumer::~ReplayingBytesConsumer() 36 BytesConsumerTestUtil::ReplayingBytesConsumer::~ReplayingBytesConsumer()
24 { 37 {
25 } 38 }
26 39
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 std::pair<BytesConsumer::Result, Vector<char>> BytesConsumerTestUtil::TwoPhaseRe ader::run() 196 std::pair<BytesConsumer::Result, Vector<char>> BytesConsumerTestUtil::TwoPhaseRe ader::run()
184 { 197 {
185 onStateChange(); 198 onStateChange();
186 while (m_result != BytesConsumer::Result::Done && m_result != BytesConsumer: :Result::Error) 199 while (m_result != BytesConsumer::Result::Done && m_result != BytesConsumer: :Result::Error)
187 testing::runPendingTasks(); 200 testing::runPendingTasks();
188 testing::runPendingTasks(); 201 testing::runPendingTasks();
189 return std::make_pair(m_result, std::move(m_data)); 202 return std::make_pair(m_result, std::move(m_data));
190 } 203 }
191 204
192 } // namespace blink 205 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698