| 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 "modules/fetch/BytesConsumer.h" | 7 #include "modules/fetch/BytesConsumer.h" |
| 8 #include "modules/fetch/DataConsumerHandleTestUtil.h" | 8 #include "modules/fetch/DataConsumerHandleTestUtil.h" |
| 9 #include "modules/fetch/DataConsumerHandleUtil.h" | 9 #include "modules/fetch/DataConsumerHandleUtil.h" |
| 10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 using Command = DataConsumerHandleTestUtil::Command; | 18 using Command = DataConsumerHandleTestUtil::Command; |
| 19 using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; | 19 using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; |
| 20 using ReplayingHandle = DataConsumerHandleTestUtil::ReplayingHandle; | 20 using ReplayingHandle = DataConsumerHandleTestUtil::ReplayingHandle; |
| 21 using Result = BytesConsumer::Result; | 21 using Result = BytesConsumer::Result; |
| 22 using ::testing::InSequence; | 22 using ::testing::InSequence; |
| 23 using ::testing::Return; | 23 using ::testing::Return; |
| 24 | 24 |
| 25 class BytesConsumerForDataConsumerHandleTest : public ::testing::Test { | 25 class BytesConsumerForDataConsumerHandleTest : public ::testing::Test { |
| 26 protected: | 26 protected: |
| 27 ~BytesConsumerForDataConsumerHandleTest() | 27 ~BytesConsumerForDataConsumerHandleTest() |
| 28 { | 28 { |
| 29 ThreadHeap::collectAllGarbage(); | 29 ThreadState::current()-> collectAllGarbage(); |
| 30 } | 30 } |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 class MockClient : public GarbageCollectedFinalized<MockClient>, public BytesCon
sumer::Client { | 33 class MockClient : public GarbageCollectedFinalized<MockClient>, public BytesCon
sumer::Client { |
| 34 USING_GARBAGE_COLLECTED_MIXIN(MockClient); | 34 USING_GARBAGE_COLLECTED_MIXIN(MockClient); |
| 35 public: | 35 public: |
| 36 static MockClient* create() { return new ::testing::StrictMock<MockClient>()
; } | 36 static MockClient* create() { return new ::testing::StrictMock<MockClient>()
; } |
| 37 MOCK_METHOD0(onStateChange, void()); | 37 MOCK_METHOD0(onStateChange, void()); |
| 38 | 38 |
| 39 protected: | 39 protected: |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 338 |
| 339 Checkpoint checkpoint; | 339 Checkpoint checkpoint; |
| 340 InSequence s; | 340 InSequence s; |
| 341 EXPECT_CALL(*proxy, drainAsFormData()).WillOnce(Return(formData)); | 341 EXPECT_CALL(*proxy, drainAsFormData()).WillOnce(Return(formData)); |
| 342 | 342 |
| 343 EXPECT_EQ(formData, consumer->drainAsFormData()); | 343 EXPECT_EQ(formData, consumer->drainAsFormData()); |
| 344 EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState()); | 344 EXPECT_EQ(BytesConsumer::PublicState::Closed, consumer->getPublicState()); |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace blink | 347 } // namespace blink |
| OLD | NEW |