| 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/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/html/FormData.h" | 9 #include "core/html/FormData.h" |
| 10 #include "modules/fetch/BlobBytesConsumer.h" | 10 #include "modules/fetch/BlobBytesConsumer.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 new2->startLoading(FetchDataLoader::createLoaderAsString(), client2); | 158 new2->startLoading(FetchDataLoader::createLoaderAsString(), client2); |
| 159 checkpoint.Call(3); | 159 checkpoint.Call(3); |
| 160 testing::runPendingTasks(); | 160 testing::runPendingTasks(); |
| 161 checkpoint.Call(4); | 161 checkpoint.Call(4); |
| 162 } | 162 } |
| 163 | 163 |
| 164 TEST_F(BodyStreamBufferTest, DrainAsBlobDataHandle) { | 164 TEST_F(BodyStreamBufferTest, DrainAsBlobDataHandle) { |
| 165 V8TestingScope scope; | 165 V8TestingScope scope; |
| 166 std::unique_ptr<BlobData> data = BlobData::create(); | 166 std::unique_ptr<BlobData> data = BlobData::create(); |
| 167 data->appendText("hello", false); | 167 data->appendText("hello"); |
| 168 auto size = data->length(); | 168 auto size = data->length(); |
| 169 RefPtr<BlobDataHandle> blobDataHandle = | 169 RefPtr<BlobDataHandle> blobDataHandle = |
| 170 BlobDataHandle::create(std::move(data), size); | 170 BlobDataHandle::create(std::move(data), size); |
| 171 BodyStreamBuffer* buffer = new BodyStreamBuffer( | 171 BodyStreamBuffer* buffer = new BodyStreamBuffer( |
| 172 scope.getScriptState(), | 172 scope.getScriptState(), |
| 173 new BlobBytesConsumer(scope.getExecutionContext(), blobDataHandle)); | 173 new BlobBytesConsumer(scope.getExecutionContext(), blobDataHandle)); |
| 174 | 174 |
| 175 EXPECT_FALSE(buffer->isStreamLocked()); | 175 EXPECT_FALSE(buffer->isStreamLocked()); |
| 176 EXPECT_FALSE(buffer->isStreamDisturbed()); | 176 EXPECT_FALSE(buffer->isStreamDisturbed()); |
| 177 EXPECT_FALSE(buffer->hasPendingActivity()); | 177 EXPECT_FALSE(buffer->hasPendingActivity()); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 ScriptValue reason(scope.getScriptState(), | 476 ScriptValue reason(scope.getScriptState(), |
| 477 v8String(scope.getScriptState()->isolate(), "reason")); | 477 v8String(scope.getScriptState()->isolate(), "reason")); |
| 478 EXPECT_FALSE(consumer->isCancelled()); | 478 EXPECT_FALSE(consumer->isCancelled()); |
| 479 buffer->cancel(scope.getScriptState(), reason); | 479 buffer->cancel(scope.getScriptState(), reason); |
| 480 EXPECT_TRUE(consumer->isCancelled()); | 480 EXPECT_TRUE(consumer->isCancelled()); |
| 481 } | 481 } |
| 482 | 482 |
| 483 } // namespace | 483 } // namespace |
| 484 | 484 |
| 485 } // namespace blink | 485 } // namespace blink |
| OLD | NEW |