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

Unified Diff: ipc/ipc_channel_reader_unittest.cc

Issue 1317093007: ipc: Make a new class PlaceholderBrokerableAttachment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More rebase errors. Created 5 years, 3 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_message.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 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,
« no previous file with comments | « ipc/ipc_channel_reader.cc ('k') | ipc/ipc_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698