| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 new2->startLoading(FetchDataLoader::createLoaderAsString(), client2); | 159 new2->startLoading(FetchDataLoader::createLoaderAsString(), client2); |
| 160 checkpoint.Call(3); | 160 checkpoint.Call(3); |
| 161 testing::runPendingTasks(); | 161 testing::runPendingTasks(); |
| 162 checkpoint.Call(4); | 162 checkpoint.Call(4); |
| 163 } | 163 } |
| 164 | 164 |
| 165 TEST_F(BodyStreamBufferTest, DrainAsBlobDataHandle) | 165 TEST_F(BodyStreamBufferTest, DrainAsBlobDataHandle) |
| 166 { | 166 { |
| 167 V8TestingScope scope; | 167 V8TestingScope scope; |
| 168 std::unique_ptr<BlobData> data = BlobData::create(); | 168 std::unique_ptr<BlobData> data = BlobData::create(); |
| 169 data->appendText("hello", false); | 169 data->appendText("hello"); |
| 170 auto size = data->length(); | 170 auto size = data->length(); |
| 171 RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(std::move(dat
a), size); | 171 RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create(std::move(dat
a), size); |
| 172 BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), Fetc
hBlobDataConsumerHandle::create(scope.getExecutionContext(), blobDataHandle, new
FakeLoaderFactory)); | 172 BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), Fetc
hBlobDataConsumerHandle::create(scope.getExecutionContext(), blobDataHandle, new
FakeLoaderFactory)); |
| 173 | 173 |
| 174 EXPECT_FALSE(buffer->isStreamLocked()); | 174 EXPECT_FALSE(buffer->isStreamLocked()); |
| 175 EXPECT_FALSE(buffer->isStreamDisturbed()); | 175 EXPECT_FALSE(buffer->isStreamDisturbed()); |
| 176 EXPECT_FALSE(buffer->hasPendingActivity()); | 176 EXPECT_FALSE(buffer->hasPendingActivity()); |
| 177 RefPtr<BlobDataHandle> outputBlobDataHandle = buffer->drainAsBlobDataHandle(
FetchDataConsumerHandle::Reader::AllowBlobWithInvalidSize); | 177 RefPtr<BlobDataHandle> outputBlobDataHandle = buffer->drainAsBlobDataHandle(
FetchDataConsumerHandle::Reader::AllowBlobWithInvalidSize); |
| 178 | 178 |
| 179 EXPECT_TRUE(buffer->isStreamLocked()); | 179 EXPECT_TRUE(buffer->isStreamLocked()); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |