| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/FetchBlobDataConsumerHandle.h" | 5 #include "modules/fetch/FetchBlobDataConsumerHandle.h" |
| 6 | 6 |
| 7 #include "core/dom/ExecutionContext.h" | 7 #include "core/dom/ExecutionContext.h" |
| 8 #include "core/fetch/ResourceLoaderOptions.h" | 8 #include "core/fetch/ResourceLoaderOptions.h" |
| 9 #include "core/loader/MockThreadableLoader.h" | 9 #include "core/loader/MockThreadableLoader.h" |
| 10 #include "core/loader/ThreadableLoaderClient.h" | 10 #include "core/loader/ThreadableLoaderClient.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 { | 57 { |
| 58 return wrapUnique(createInternal(executionContext, client, threadableLoa
derOptions, resourceLoaderOptions)); | 58 return wrapUnique(createInternal(executionContext, client, threadableLoa
derOptions, resourceLoaderOptions)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 MOCK_METHOD4(createInternal, ThreadableLoader*(ExecutionContext&, Threadable
LoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&)); | 61 MOCK_METHOD4(createInternal, ThreadableLoader*(ExecutionContext&, Threadable
LoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&)); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 PassRefPtr<BlobDataHandle> createBlobDataHandle(const char* s) | 64 PassRefPtr<BlobDataHandle> createBlobDataHandle(const char* s) |
| 65 { | 65 { |
| 66 std::unique_ptr<BlobData> data = BlobData::create(); | 66 std::unique_ptr<BlobData> data = BlobData::create(); |
| 67 data->appendText(s, false); | 67 data->appendText(s); |
| 68 auto size = data->length(); | 68 auto size = data->length(); |
| 69 return BlobDataHandle::create(std::move(data), size); | 69 return BlobDataHandle::create(std::move(data), size); |
| 70 } | 70 } |
| 71 | 71 |
| 72 String toString(const Vector<char>& data) | 72 String toString(const Vector<char>& data) |
| 73 { | 73 { |
| 74 return String(data.data(), data.size()); | 74 return String(data.data(), data.size()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 class FetchBlobDataConsumerHandleTest : public ::testing::Test { | 77 class FetchBlobDataConsumerHandleTest : public ::testing::Test { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainRead
er(nullptr); | 424 std::unique_ptr<FetchDataConsumerHandle::Reader> reader = handle->obtainRead
er(nullptr); |
| 425 | 425 |
| 426 const void* buffer; | 426 const void* buffer; |
| 427 size_t available; | 427 size_t available; |
| 428 EXPECT_EQ(kShouldWait, reader->beginRead(&buffer, kNone, &available)); | 428 EXPECT_EQ(kShouldWait, reader->beginRead(&buffer, kNone, &available)); |
| 429 EXPECT_FALSE(reader->drainAsBlobDataHandle()); | 429 EXPECT_FALSE(reader->drainAsBlobDataHandle()); |
| 430 } | 430 } |
| 431 | 431 |
| 432 } // namespace | 432 } // namespace |
| 433 } // namespace blink | 433 } // namespace blink |
| OLD | NEW |