Index: ipc/ipc_channel_reader_unittest.cc |
diff --git a/ipc/ipc_channel_reader_unittest.cc b/ipc/ipc_channel_reader_unittest.cc |
index cbcd5dc5189cafa9a2410922e9b1216e72ada5bd..005898015bf6d40e607b2113838908ac37b73a5c 100644 |
--- a/ipc/ipc_channel_reader_unittest.cc |
+++ b/ipc/ipc_channel_reader_unittest.cc |
@@ -9,6 +9,7 @@ |
#include "ipc/attachment_broker.h" |
#include "ipc/brokerable_attachment.h" |
#include "ipc/ipc_channel_reader.h" |
+#include "ipc/placeholder_brokerable_attachment.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#if USE_ATTACHMENT_BROKER |
@@ -19,15 +20,9 @@ namespace { |
class MockAttachment : public BrokerableAttachment { |
public: |
- MockAttachment(int internal_state) : internal_state_(internal_state) {} |
+ MockAttachment() {} |
MockAttachment(BrokerableAttachment::AttachmentId id) |
- : BrokerableAttachment(id, true), internal_state_(-1) {} |
- |
- void PopulateWithAttachment(const BrokerableAttachment* attachment) override { |
- const MockAttachment* mock_attachment = |
- static_cast<const MockAttachment*>(attachment); |
- internal_state_ = mock_attachment->internal_state_; |
- } |
+ : BrokerableAttachment(id) {} |
#if defined(OS_POSIX) |
base::PlatformFile TakePlatformFile() override { |
@@ -39,8 +34,6 @@ class MockAttachment : public BrokerableAttachment { |
private: |
~MockAttachment() override {} |
- // Internal state differentiates MockAttachments. |
- int internal_state_; |
}; |
class MockAttachmentBroker : public AttachmentBroker { |
@@ -105,12 +98,12 @@ TEST(ChannelReaderTest, AttachmentAlreadyBrokered) { |
MockAttachmentBroker broker; |
MockChannelReader reader; |
reader.set_broker(&broker); |
- scoped_refptr<MockAttachment> attachment(new MockAttachment(5)); |
+ scoped_refptr<MockAttachment> attachment(new MockAttachment); |
broker.AddAttachment(attachment); |
Message* m = new Message; |
- MockAttachment* needs_brokering_attachment = |
- new MockAttachment(attachment->GetIdentifier()); |
+ PlaceholderBrokerableAttachment* needs_brokering_attachment = |
+ new PlaceholderBrokerableAttachment(attachment->GetIdentifier()); |
EXPECT_TRUE(m->WriteAttachment(needs_brokering_attachment)); |
reader.AddMessageForDispatch(m); |
EXPECT_EQ(ChannelReader::DISPATCH_FINISHED, reader.DispatchMessages()); |
@@ -121,11 +114,11 @@ TEST(ChannelReaderTest, AttachmentNotYetBrokered) { |
MockAttachmentBroker broker; |
MockChannelReader reader; |
reader.set_broker(&broker); |
- scoped_refptr<MockAttachment> attachment(new MockAttachment(5)); |
+ scoped_refptr<MockAttachment> attachment(new MockAttachment); |
Message* m = new Message; |
- MockAttachment* needs_brokering_attachment = |
- new MockAttachment(attachment->GetIdentifier()); |
+ PlaceholderBrokerableAttachment* needs_brokering_attachment = |
+ new PlaceholderBrokerableAttachment(attachment->GetIdentifier()); |
EXPECT_TRUE(m->WriteAttachment(needs_brokering_attachment)); |
reader.AddMessageForDispatch(m); |
EXPECT_EQ(ChannelReader::DISPATCH_WAITING_ON_BROKER, |