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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h

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 #ifndef DataConsumerHandleTestUtil_h 5 #ifndef DataConsumerHandleTestUtil_h
6 #define DataConsumerHandleTestUtil_h 6 #define DataConsumerHandleTestUtil_h
7 7
8 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "core/testing/NullExecutionContext.h" 9 #include "core/testing/NullExecutionContext.h"
10 #include "gin/public/isolate_holder.h" 10 #include "gin/public/isolate_holder.h"
11 #include "modules/fetch/DataConsumerHandleUtil.h" 11 #include "modules/fetch/DataConsumerHandleUtil.h"
12 #include "modules/fetch/FetchDataConsumerHandle.h" 12 #include "modules/fetch/FetchDataConsumerHandle.h"
13 #include "modules/fetch/FetchDataLoader.h"
14 #include "platform/CrossThreadFunctional.h" 13 #include "platform/CrossThreadFunctional.h"
15 #include "platform/WaitableEvent.h" 14 #include "platform/WaitableEvent.h"
16 #include "platform/WebThreadSupportingGC.h" 15 #include "platform/WebThreadSupportingGC.h"
17 #include "platform/heap/Handle.h" 16 #include "platform/heap/Handle.h"
18 #include "public/platform/Platform.h" 17 #include "public/platform/Platform.h"
19 #include "public/platform/WebDataConsumerHandle.h" 18 #include "public/platform/WebDataConsumerHandle.h"
20 #include "public/platform/WebTraceLocation.h" 19 #include "public/platform/WebTraceLocation.h"
21 #include "wtf/Deque.h" 20 #include "wtf/Deque.h"
22 #include "wtf/Locker.h" 21 #include "wtf/Locker.h"
23 #include "wtf/PtrUtil.h" 22 #include "wtf/PtrUtil.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 MOCK_METHOD1(endRead, Result(size_t)); 332 MOCK_METHOD1(endRead, Result(size_t));
334 MOCK_METHOD1(drainAsBlobDataHandle, PassRefPtr<BlobDataHandle>(BlobSizeP olicy)); 333 MOCK_METHOD1(drainAsBlobDataHandle, PassRefPtr<BlobDataHandle>(BlobSizeP olicy));
335 334
336 ~MockFetchDataConsumerReader() override 335 ~MockFetchDataConsumerReader() override
337 { 336 {
338 destruct(); 337 destruct();
339 } 338 }
340 MOCK_METHOD0(destruct, void()); 339 MOCK_METHOD0(destruct, void());
341 }; 340 };
342 341
343 class MockFetchDataLoaderClient : public GarbageCollectedFinalized<MockFetch DataLoaderClient>, public FetchDataLoader::Client {
344 USING_GARBAGE_COLLECTED_MIXIN(MockFetchDataLoaderClient);
345 public:
346 static ::testing::StrictMock<MockFetchDataLoaderClient>* create() { retu rn new ::testing::StrictMock<MockFetchDataLoaderClient>; }
347
348 DEFINE_INLINE_VIRTUAL_TRACE()
349 {
350 FetchDataLoader::Client::trace(visitor);
351 }
352
353 MOCK_METHOD1(didFetchDataLoadedBlobHandleMock, void(RefPtr<BlobDataHandl e>));
354 MOCK_METHOD1(didFetchDataLoadedArrayBufferMock, void(DOMArrayBuffer*));
355 MOCK_METHOD1(didFetchDataLoadedString, void(const String&));
356 MOCK_METHOD0(didFetchDataLoadStream, void());
357 MOCK_METHOD0(didFetchDataLoadFailed, void());
358
359 void didFetchDataLoadedArrayBuffer(DOMArrayBuffer* arrayBuffer) override
360 {
361 didFetchDataLoadedArrayBufferMock(arrayBuffer);
362 }
363 // In mock methods we use RefPtr<> rather than PassRefPtr<>.
364 void didFetchDataLoadedBlobHandle(PassRefPtr<BlobDataHandle> blobDataHan dle) override
365 {
366 didFetchDataLoadedBlobHandleMock(blobDataHandle);
367 }
368 };
369
370 class Command final { 342 class Command final {
371 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 343 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
372 public: 344 public:
373 enum Name { 345 enum Name {
374 Data, 346 Data,
375 Done, 347 Done,
376 Error, 348 Error,
377 Wait, 349 Wait,
378 }; 350 };
379 351
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 std::unique_ptr<HandleReadResult> m_result; 514 std::unique_ptr<HandleReadResult> m_result;
543 bool m_isDone; 515 bool m_isDone;
544 516
545 std::unique_ptr<T> m_handleReader; 517 std::unique_ptr<T> m_handleReader;
546 }; 518 };
547 }; 519 };
548 520
549 } // namespace blink 521 } // namespace blink
550 522
551 #endif // DataConsumerHandleTestUtil_h 523 #endif // DataConsumerHandleTestUtil_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698