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 "blimp/engine/renderer/blob_channel_sender_proxy.h" | 5 #include "blimp/engine/renderer/blob_channel_sender_proxy.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 : sender_weak_factory_(&mock_sender_), | 31 : sender_weak_factory_(&mock_sender_), |
32 mojo_service_impl_(base::MakeUnique<BlobChannelService>( | 32 mojo_service_impl_(base::MakeUnique<BlobChannelService>( |
33 sender_weak_factory_.GetWeakPtr(), | 33 sender_weak_factory_.GetWeakPtr(), |
34 message_loop_.task_runner())) {} | 34 message_loop_.task_runner())) {} |
35 | 35 |
36 void SetUp() override { | 36 void SetUp() override { |
37 // Set up communication path from the Proxy to a sender mock: | 37 // Set up communication path from the Proxy to a sender mock: |
38 // blob_channel_sender_proxy_ => (mojo) => mojo_service_impl_ => | 38 // blob_channel_sender_proxy_ => (mojo) => mojo_service_impl_ => |
39 // mock_sender_; | 39 // mock_sender_; |
40 mojom::BlobChannelPtr mojo_ptr; | 40 mojom::BlobChannelPtr mojo_ptr; |
41 mojo_service_impl_->BindRequest(GetProxy(&mojo_ptr)); | 41 mojo_service_impl_->BindRequest(MakeRequest(&mojo_ptr)); |
42 blob_channel_sender_proxy_ = | 42 blob_channel_sender_proxy_ = |
43 BlobChannelSenderProxy::CreateForTest(std::move(mojo_ptr)); | 43 BlobChannelSenderProxy::CreateForTest(std::move(mojo_ptr)); |
44 } | 44 } |
45 | 45 |
46 protected: | 46 protected: |
47 void DeliverMessages() { base::RunLoop().RunUntilIdle(); } | 47 void DeliverMessages() { base::RunLoop().RunUntilIdle(); } |
48 | 48 |
49 const std::string blob_id_ = CalculateBlobId(kBlobId); | 49 const std::string blob_id_ = CalculateBlobId(kBlobId); |
50 base::MessageLoop message_loop_; | 50 base::MessageLoop message_loop_; |
51 std::unique_ptr<BlobChannelSenderProxy> blob_channel_sender_proxy_; | 51 std::unique_ptr<BlobChannelSenderProxy> blob_channel_sender_proxy_; |
(...skipping 28 matching lines...) Expand all Loading... |
80 | 80 |
81 blob_channel_sender_proxy_->DeliverBlob(blob_id_); | 81 blob_channel_sender_proxy_->DeliverBlob(blob_id_); |
82 DeliverMessages(); | 82 DeliverMessages(); |
83 EXPECT_TRUE(blob_channel_sender_proxy_->IsInEngineCache(blob_id_)); | 83 EXPECT_TRUE(blob_channel_sender_proxy_->IsInEngineCache(blob_id_)); |
84 EXPECT_TRUE(blob_channel_sender_proxy_->IsInClientCache(blob_id_)); | 84 EXPECT_TRUE(blob_channel_sender_proxy_->IsInClientCache(blob_id_)); |
85 } | 85 } |
86 | 86 |
87 } // namespace | 87 } // namespace |
88 } // namespace engine | 88 } // namespace engine |
89 } // namespace blimp | 89 } // namespace blimp |
OLD | NEW |