| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/BodyStreamBuffer.h" | 5 #include "modules/fetch/BodyStreamBuffer.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/V8BindingForTesting.h" | 7 #include "bindings/core/v8/V8BindingForTesting.h" |
| 8 #include "core/html/FormData.h" | 8 #include "core/html/FormData.h" |
| 9 #include "modules/fetch/DataConsumerHandleTestUtil.h" | 9 #include "modules/fetch/DataConsumerHandleTestUtil.h" |
| 10 #include "modules/fetch/FetchBlobDataConsumerHandle.h" | 10 #include "modules/fetch/FetchBlobDataConsumerHandle.h" |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 V8TestingScope scope; | 484 V8TestingScope scope; |
| 485 using MockHandle = MockFetchDataConsumerHandleWithMockDestructor; | 485 using MockHandle = MockFetchDataConsumerHandleWithMockDestructor; |
| 486 using MockReader = DataConsumerHandleTestUtil::MockFetchDataConsumerReader; | 486 using MockReader = DataConsumerHandleTestUtil::MockFetchDataConsumerReader; |
| 487 std::unique_ptr<MockHandle> handle = MockHandle::create(); | 487 std::unique_ptr<MockHandle> handle = MockHandle::create(); |
| 488 // |reader| will be adopted by |obtainFetchDataReader|. | 488 // |reader| will be adopted by |obtainFetchDataReader|. |
| 489 MockReader* reader = MockReader::create().release(); | 489 MockReader* reader = MockReader::create().release(); |
| 490 | 490 |
| 491 Checkpoint checkpoint; | 491 Checkpoint checkpoint; |
| 492 InSequence s; | 492 InSequence s; |
| 493 | 493 |
| 494 EXPECT_CALL(*handle, obtainFetchDataReader(_)).WillOnce(Return(ByMove(WTF::w
rapUnique(reader)))); | 494 EXPECT_CALL(*handle, obtainFetchDataReaderMock(_)).WillOnce(Return(ByMove(WT
F::wrapUnique(reader)))); |
| 495 EXPECT_CALL(checkpoint, Call(1)); | 495 EXPECT_CALL(checkpoint, Call(1)); |
| 496 EXPECT_CALL(*reader, destruct()); | 496 EXPECT_CALL(*reader, destruct()); |
| 497 EXPECT_CALL(*handle, destruct()); | 497 EXPECT_CALL(*handle, destruct()); |
| 498 EXPECT_CALL(checkpoint, Call(2)); | 498 EXPECT_CALL(checkpoint, Call(2)); |
| 499 | 499 |
| 500 BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), std:
:move(handle)); | 500 BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), std:
:move(handle)); |
| 501 checkpoint.Call(1); | 501 checkpoint.Call(1); |
| 502 ScriptValue reason(scope.getScriptState(), v8String(scope.getScriptState()->
isolate(), "reason")); | 502 ScriptValue reason(scope.getScriptState(), v8String(scope.getScriptState()->
isolate(), "reason")); |
| 503 buffer->cancelSource(scope.getScriptState(), reason); | 503 buffer->cancelSource(scope.getScriptState(), reason); |
| 504 checkpoint.Call(2); | 504 checkpoint.Call(2); |
| 505 } | 505 } |
| 506 | 506 |
| 507 } // namespace | 507 } // namespace |
| 508 | 508 |
| 509 } // namespace blink | 509 } // namespace blink |
| OLD | NEW |