| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/BytesConsumer.h" | 5 #include "modules/fetch/BytesConsumer.h" |
| 6 | 6 |
| 7 #include "core/testing/DummyPageHolder.h" | 7 #include "core/testing/DummyPageHolder.h" |
| 8 #include "modules/fetch/BytesConsumerTestUtil.h" | 8 #include "modules/fetch/BytesConsumerTestUtil.h" |
| 9 #include "platform/blob/BlobData.h" | 9 #include "platform/blob/BlobData.h" |
| 10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return Result::kError; | 66 return Result::kError; |
| 67 } | 67 } |
| 68 PassRefPtr<BlobDataHandle> DrainAsBlobDataHandle(BlobSizePolicy policy) { | 68 PassRefPtr<BlobDataHandle> DrainAsBlobDataHandle(BlobSizePolicy policy) { |
| 69 if (state_ != PublicState::kReadableOrWaiting) | 69 if (state_ != PublicState::kReadableOrWaiting) |
| 70 return nullptr; | 70 return nullptr; |
| 71 DCHECK(blob_handle_); | 71 DCHECK(blob_handle_); |
| 72 if (policy == BlobSizePolicy::kDisallowBlobWithInvalidSize && | 72 if (policy == BlobSizePolicy::kDisallowBlobWithInvalidSize && |
| 73 blob_handle_->size() == UINT64_MAX) | 73 blob_handle_->size() == UINT64_MAX) |
| 74 return nullptr; | 74 return nullptr; |
| 75 state_ = PublicState::kClosed; | 75 state_ = PublicState::kClosed; |
| 76 return blob_handle_.Release(); | 76 return std::move(blob_handle_); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void SetClient(Client*) override {} | 79 void SetClient(Client*) override {} |
| 80 void ClearClient() override {} | 80 void ClearClient() override {} |
| 81 void Cancel() override {} | 81 void Cancel() override {} |
| 82 PublicState GetPublicState() const override { return state_; } | 82 PublicState GetPublicState() const override { return state_; } |
| 83 Error GetError() const override { return Error(); } | 83 Error GetError() const override { return Error(); } |
| 84 String DebugName() const override { return "FakeBlobBytesConsumer"; } | 84 String DebugName() const override { return "FakeBlobBytesConsumer"; } |
| 85 | 85 |
| 86 private: | 86 private: |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 EXPECT_EQ(BytesConsumer::PublicState::kErrored, consumer->GetPublicState()); | 427 EXPECT_EQ(BytesConsumer::PublicState::kErrored, consumer->GetPublicState()); |
| 428 EXPECT_EQ(error.Message(), consumer->GetError().Message()); | 428 EXPECT_EQ(error.Message(), consumer->GetError().Message()); |
| 429 | 429 |
| 430 consumer->Cancel(); | 430 consumer->Cancel(); |
| 431 EXPECT_EQ(BytesConsumer::PublicState::kErrored, consumer->GetPublicState()); | 431 EXPECT_EQ(BytesConsumer::PublicState::kErrored, consumer->GetPublicState()); |
| 432 } | 432 } |
| 433 | 433 |
| 434 } // namespace | 434 } // namespace |
| 435 | 435 |
| 436 } // namespace blink | 436 } // namespace blink |
| OLD | NEW |