| 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/BytesConsumerForDataConsumerHandle.h" | 5 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" |
| 6 | 6 |
| 7 #include "core/testing/DummyPageHolder.h" | 7 #include "core/testing/DummyPageHolder.h" |
| 8 #include "modules/fetch/BytesConsumer.h" | 8 #include "modules/fetch/BytesConsumer.h" |
| 9 #include "modules/fetch/DataConsumerHandleTestUtil.h" | 9 #include "modules/fetch/DataConsumerHandleTestUtil.h" |
| 10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 Result endRead(size_t readSize) override { | 79 Result endRead(size_t readSize) override { |
| 80 return m_proxy->endRead(readSize); | 80 return m_proxy->endRead(readSize); |
| 81 } | 81 } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 Persistent<MockReaderProxy> m_proxy; | 84 Persistent<MockReaderProxy> m_proxy; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 std::unique_ptr<WebDataConsumerHandle::Reader> obtainReader( | 87 std::unique_ptr<WebDataConsumerHandle::Reader> obtainReader( |
| 88 Client*) override { | 88 Client*) override { |
| 89 return wrapUnique(new Reader(m_proxy)); | 89 return makeUnique<Reader>(m_proxy); |
| 90 } | 90 } |
| 91 Persistent<MockReaderProxy> m_proxy; | 91 Persistent<MockReaderProxy> m_proxy; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 TEST_F(BytesConsumerForDataConsumerHandleTest, Create) { | 94 TEST_F(BytesConsumerForDataConsumerHandleTest, Create) { |
| 95 std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); | 95 std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create(); |
| 96 handle->add(Command(Command::Data, "hello")); | 96 handle->add(Command(Command::Data, "hello")); |
| 97 handle->add(Command(Command::Done)); | 97 handle->add(Command(Command::Done)); |
| 98 Persistent<BytesConsumer> consumer = | 98 Persistent<BytesConsumer> consumer = |
| 99 new BytesConsumerForDataConsumerHandle(document(), std::move(handle)); | 99 new BytesConsumerForDataConsumerHandle(document(), std::move(handle)); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 InSequence s; | 286 InSequence s; |
| 287 | 287 |
| 288 EXPECT_FALSE(consumer->drainAsFormData()); | 288 EXPECT_FALSE(consumer->drainAsFormData()); |
| 289 EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting, | 289 EXPECT_EQ(BytesConsumer::PublicState::ReadableOrWaiting, |
| 290 consumer->getPublicState()); | 290 consumer->getPublicState()); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace | 293 } // namespace |
| 294 | 294 |
| 295 } // namespace blink | 295 } // namespace blink |
| OLD | NEW |