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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 EXPECT_CALL(*client, didFetchDataLoadedString(String("hello"))); | 448 EXPECT_CALL(*client, didFetchDataLoadedString(String("hello"))); |
449 EXPECT_CALL(checkpoint, Call(2)); | 449 EXPECT_CALL(checkpoint, Call(2)); |
450 | 450 |
451 std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); | 451 std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); |
452 handle->add(Command(Command::Wait)); | 452 handle->add(Command(Command::Wait)); |
453 handle->add(Command(Command::Data, "hello")); | 453 handle->add(Command(Command::Data, "hello")); |
454 handle->add(Command(Command::Done)); | 454 handle->add(Command(Command::Done)); |
455 Persistent<BodyStreamBuffer> buffer = new BodyStreamBuffer(scope.getScriptSt
ate(), createFetchDataConsumerHandleFromWebHandle(std::move(handle))); | 455 Persistent<BodyStreamBuffer> buffer = new BodyStreamBuffer(scope.getScriptSt
ate(), createFetchDataConsumerHandleFromWebHandle(std::move(handle))); |
456 buffer->startLoading(FetchDataLoader::createLoaderAsString(), client); | 456 buffer->startLoading(FetchDataLoader::createLoaderAsString(), client); |
457 | 457 |
458 ThreadState::current()-> collectAllGarbage(); | 458 ThreadHeap::collectAllGarbage(); |
459 checkpoint.Call(1); | 459 checkpoint.Call(1); |
460 testing::runPendingTasks(); | 460 testing::runPendingTasks(); |
461 checkpoint.Call(2); | 461 checkpoint.Call(2); |
462 } | 462 } |
463 | 463 |
464 // TODO(hiroshige): Merge this class into MockFetchDataConsumerHandle. | 464 // TODO(hiroshige): Merge this class into MockFetchDataConsumerHandle. |
465 class MockFetchDataConsumerHandleWithMockDestructor : public DataConsumerHandleT
estUtil::MockFetchDataConsumerHandle { | 465 class MockFetchDataConsumerHandleWithMockDestructor : public DataConsumerHandleT
estUtil::MockFetchDataConsumerHandle { |
466 public: | 466 public: |
467 static std::unique_ptr<::testing::StrictMock<MockFetchDataConsumerHandleWith
MockDestructor>> create() { return wrapUnique(new ::testing::StrictMock<MockFetc
hDataConsumerHandleWithMockDestructor>); } | 467 static std::unique_ptr<::testing::StrictMock<MockFetchDataConsumerHandleWith
MockDestructor>> create() { return wrapUnique(new ::testing::StrictMock<MockFetc
hDataConsumerHandleWithMockDestructor>); } |
468 | 468 |
(...skipping 26 matching lines...) Expand all Loading... |
495 BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), std:
:move(handle)); | 495 BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), std:
:move(handle)); |
496 checkpoint.Call(1); | 496 checkpoint.Call(1); |
497 ScriptValue reason(scope.getScriptState(), v8String(scope.getScriptState()->
isolate(), "reason")); | 497 ScriptValue reason(scope.getScriptState(), v8String(scope.getScriptState()->
isolate(), "reason")); |
498 buffer->cancel(scope.getScriptState(), reason); | 498 buffer->cancel(scope.getScriptState(), reason); |
499 checkpoint.Call(2); | 499 checkpoint.Call(2); |
500 } | 500 } |
501 | 501 |
502 } // namespace | 502 } // namespace |
503 | 503 |
504 } // namespace blink | 504 } // namespace blink |
OLD | NEW |