Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Unified Diff: ipc/ipc_channel_reader_unittest.cc

Issue 1286883003: Revert of IPC: Add attachment brokering support to the message header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/ipc_channel_reader.cc ('k') | ipc/ipc_channel_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_reader_unittest.cc
diff --git a/ipc/ipc_channel_reader_unittest.cc b/ipc/ipc_channel_reader_unittest.cc
index 005898015bf6d40e607b2113838908ac37b73a5c..cbcd5dc5189cafa9a2410922e9b1216e72ada5bd 100644
--- a/ipc/ipc_channel_reader_unittest.cc
+++ b/ipc/ipc_channel_reader_unittest.cc
@@ -9,7 +9,6 @@
#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
@@ -20,9 +19,15 @@
class MockAttachment : public BrokerableAttachment {
public:
- MockAttachment() {}
+ MockAttachment(int internal_state) : internal_state_(internal_state) {}
MockAttachment(BrokerableAttachment::AttachmentId id)
- : BrokerableAttachment(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_;
+ }
#if defined(OS_POSIX)
base::PlatformFile TakePlatformFile() override {
@@ -34,6 +39,8 @@
private:
~MockAttachment() override {}
+ // Internal state differentiates MockAttachments.
+ int internal_state_;
};
class MockAttachmentBroker : public AttachmentBroker {
@@ -98,12 +105,12 @@
MockAttachmentBroker broker;
MockChannelReader reader;
reader.set_broker(&broker);
- scoped_refptr<MockAttachment> attachment(new MockAttachment);
+ scoped_refptr<MockAttachment> attachment(new MockAttachment(5));
broker.AddAttachment(attachment);
Message* m = new Message;
- PlaceholderBrokerableAttachment* needs_brokering_attachment =
- new PlaceholderBrokerableAttachment(attachment->GetIdentifier());
+ MockAttachment* needs_brokering_attachment =
+ new MockAttachment(attachment->GetIdentifier());
EXPECT_TRUE(m->WriteAttachment(needs_brokering_attachment));
reader.AddMessageForDispatch(m);
EXPECT_EQ(ChannelReader::DISPATCH_FINISHED, reader.DispatchMessages());
@@ -114,11 +121,11 @@
MockAttachmentBroker broker;
MockChannelReader reader;
reader.set_broker(&broker);
- scoped_refptr<MockAttachment> attachment(new MockAttachment);
+ scoped_refptr<MockAttachment> attachment(new MockAttachment(5));
Message* m = new Message;
- PlaceholderBrokerableAttachment* needs_brokering_attachment =
- new PlaceholderBrokerableAttachment(attachment->GetIdentifier());
+ MockAttachment* needs_brokering_attachment =
+ new MockAttachment(attachment->GetIdentifier());
EXPECT_TRUE(m->WriteAttachment(needs_brokering_attachment));
reader.AddMessageForDispatch(m);
EXPECT_EQ(ChannelReader::DISPATCH_WAITING_ON_BROKER,
« no previous file with comments | « ipc/ipc_channel_reader.cc ('k') | ipc/ipc_channel_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698