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

Unified Diff: blimp/net/blob_channel/blob_channel_integration_test.cc

Issue 1970463004: Blimp: Add BlobChannel Helium messages and delegate impls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wez feedback Created 4 years, 7 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
Index: blimp/net/blob_channel/blob_channel_integration_test.cc
diff --git a/blimp/net/blob_channel/blob_channel_integration_test.cc b/blimp/net/blob_channel/blob_channel_integration_test.cc
index fe5b54d52e76a384fcb1188df824cc28b733d24d..b86b1c1afba303cdbeea0c237ed62433ec63da38 100644
--- a/blimp/net/blob_channel/blob_channel_integration_test.cc
+++ b/blimp/net/blob_channel/blob_channel_integration_test.cc
@@ -29,30 +29,19 @@ const char kBlobPayload[] = "bar1";
// after |this| is deleted.
class SenderDelegateProxy : public BlobChannelSender::Delegate {
public:
- SenderDelegateProxy() {}
+ explicit SenderDelegateProxy(BlobChannelReceiver* receiver)
+ : receiver_(receiver) {}
~SenderDelegateProxy() override {}
- // Returns a receiver object that will receive proxied calls sent to |this|.
- std::unique_ptr<BlobChannelReceiver::Delegate> GetReceiverDelegate() {
- DCHECK(!receiver_);
- receiver_ = new ReceiverDelegate;
- return base::WrapUnique(receiver_);
- }
-
private:
- class ReceiverDelegate : public BlobChannelReceiver::Delegate {
- public:
- using BlobChannelReceiver::Delegate::OnBlobReceived;
- };
-
// BlobChannelSender implementation.
void DeliverBlob(const BlobId& id, BlobDataPtr data) override {
base::MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(&ReceiverDelegate::OnBlobReceived,
+ FROM_HERE, base::Bind(&BlobChannelReceiver::OnBlobReceived,
base::Unretained(receiver_), id, data));
}
- ReceiverDelegate* receiver_ = nullptr;
+ BlobChannelReceiver* receiver_;
DISALLOW_COPY_AND_ASSIGN(SenderDelegateProxy);
};
@@ -61,14 +50,18 @@ class SenderDelegateProxy : public BlobChannelSender::Delegate {
// transport-level implementation details.
class BlobChannelIntegrationTest : public testing::Test {
public:
+ class NullBlobReceiverDelegate : public BlobChannelReceiver::Delegate {
Wez 2016/05/25 02:47:44 nit: Seems more natural to declare this in a top-l
Kevin M 2016/05/25 20:23:38 Done.
+ public:
+ void SetReceiver(BlobChannelReceiver* receiver) override {}
+ };
+
BlobChannelIntegrationTest() {
- std::unique_ptr<SenderDelegateProxy> sender_delegate(
- new SenderDelegateProxy);
- receiver_.reset(
- new BlobChannelReceiver(base::WrapUnique(new InMemoryBlobCache),
- sender_delegate->GetReceiverDelegate()));
- sender_.reset(new BlobChannelSender(base::WrapUnique(new InMemoryBlobCache),
- std::move(sender_delegate)));
+ receiver_ = BlobChannelReceiver::Create(
+ base::WrapUnique(new InMemoryBlobCache),
+ base::WrapUnique(new NullBlobReceiverDelegate));
+ sender_.reset(new BlobChannelSender(
+ base::WrapUnique(new InMemoryBlobCache),
+ base::WrapUnique(new SenderDelegateProxy(receiver_.get()))));
}
~BlobChannelIntegrationTest() override {}

Powered by Google App Engine
This is Rietveld 408576698