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

Side by Side Diff: media/mojo/services/media_service_unittest.cc

Issue 2589663003: mojo:: Rename mojo::GetProxy() to mojo::MakeRequest() (Closed)
Patch Set: Rebase Created 4 years 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 unified diff | Download patch
« no previous file with comments | « media/mojo/clients/mojo_renderer_unittest.cc ('k') | media/mojo/services/mojo_cdm_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void SetUp() override { 76 void SetUp() override {
77 ServiceTest::SetUp(); 77 ServiceTest::SetUp();
78 78
79 connection_ = connector()->Connect("media"); 79 connection_ = connector()->Connect("media");
80 media::mojom::MediaServicePtr media_service; 80 media::mojom::MediaServicePtr media_service;
81 connection_->GetInterface(&media_service); 81 connection_->GetInterface(&media_service);
82 82
83 auto registry = 83 auto registry =
84 base::MakeUnique<service_manager::InterfaceRegistry>(std::string()); 84 base::MakeUnique<service_manager::InterfaceRegistry>(std::string());
85 service_manager::mojom::InterfaceProviderPtr interfaces; 85 service_manager::mojom::InterfaceProviderPtr interfaces;
86 registry->Bind(GetProxy(&interfaces), service_manager::Identity(), 86 registry->Bind(MakeRequest(&interfaces), service_manager::Identity(),
87 service_manager::InterfaceProviderSpec(), 87 service_manager::InterfaceProviderSpec(),
88 service_manager::Identity(), 88 service_manager::Identity(),
89 service_manager::InterfaceProviderSpec()); 89 service_manager::InterfaceProviderSpec());
90 90
91 media_service->CreateInterfaceFactory(mojo::GetProxy(&interface_factory_), 91 media_service->CreateInterfaceFactory(
92 std::move(interfaces)); 92 mojo::MakeRequest(&interface_factory_), std::move(interfaces));
93 93
94 run_loop_.reset(new base::RunLoop()); 94 run_loop_.reset(new base::RunLoop());
95 } 95 }
96 96
97 // MOCK_METHOD* doesn't support move only types. Work around this by having 97 // MOCK_METHOD* doesn't support move only types. Work around this by having
98 // an extra method. 98 // an extra method.
99 MOCK_METHOD2(OnCdmInitializedInternal, void(bool result, int cdm_id)); 99 MOCK_METHOD2(OnCdmInitializedInternal, void(bool result, int cdm_id));
100 void OnCdmInitialized(mojom::CdmPromiseResultPtr result, 100 void OnCdmInitialized(mojom::CdmPromiseResultPtr result,
101 int cdm_id, 101 int cdm_id,
102 mojom::DecryptorPtr decryptor) { 102 mojom::DecryptorPtr decryptor) {
103 OnCdmInitializedInternal(result->success, cdm_id); 103 OnCdmInitializedInternal(result->success, cdm_id);
104 } 104 }
105 105
106 void InitializeCdm(const std::string& key_system, 106 void InitializeCdm(const std::string& key_system,
107 bool expected_result, 107 bool expected_result,
108 int cdm_id) { 108 int cdm_id) {
109 interface_factory_->CreateCdm(mojo::GetProxy(&cdm_)); 109 interface_factory_->CreateCdm(mojo::MakeRequest(&cdm_));
110 110
111 EXPECT_CALL(*this, OnCdmInitializedInternal(expected_result, cdm_id)) 111 EXPECT_CALL(*this, OnCdmInitializedInternal(expected_result, cdm_id))
112 .Times(Exactly(1)) 112 .Times(Exactly(1))
113 .WillOnce(InvokeWithoutArgs(run_loop_.get(), &base::RunLoop::Quit)); 113 .WillOnce(InvokeWithoutArgs(run_loop_.get(), &base::RunLoop::Quit));
114 cdm_->Initialize(key_system, kSecurityOrigin, 114 cdm_->Initialize(key_system, kSecurityOrigin,
115 mojom::CdmConfig::From(CdmConfig()), 115 mojom::CdmConfig::From(CdmConfig()),
116 base::Bind(&MediaServiceTest::OnCdmInitialized, 116 base::Bind(&MediaServiceTest::OnCdmInitialized,
117 base::Unretained(this))); 117 base::Unretained(this)));
118 } 118 }
119 119
120 MOCK_METHOD1(OnRendererInitialized, void(bool)); 120 MOCK_METHOD1(OnRendererInitialized, void(bool));
121 121
122 void InitializeRenderer(const VideoDecoderConfig& video_config, 122 void InitializeRenderer(const VideoDecoderConfig& video_config,
123 bool expected_result) { 123 bool expected_result) {
124 interface_factory_->CreateRenderer(std::string(), 124 interface_factory_->CreateRenderer(std::string(),
125 mojo::GetProxy(&renderer_)); 125 mojo::MakeRequest(&renderer_));
126 126
127 video_stream_.set_video_decoder_config(video_config); 127 video_stream_.set_video_decoder_config(video_config);
128 128
129 mojom::DemuxerStreamPtr video_stream_proxy; 129 mojom::DemuxerStreamPtr video_stream_proxy;
130 mojo_video_stream_.reset(new MojoDemuxerStreamImpl( 130 mojo_video_stream_.reset(new MojoDemuxerStreamImpl(
131 &video_stream_, GetProxy(&video_stream_proxy))); 131 &video_stream_, MakeRequest(&video_stream_proxy)));
132 132
133 mojom::RendererClientAssociatedPtrInfo client_ptr_info; 133 mojom::RendererClientAssociatedPtrInfo client_ptr_info;
134 renderer_client_binding_.Bind(&client_ptr_info, 134 renderer_client_binding_.Bind(&client_ptr_info,
135 renderer_.associated_group()); 135 renderer_.associated_group());
136 136
137 EXPECT_CALL(*this, OnRendererInitialized(expected_result)) 137 EXPECT_CALL(*this, OnRendererInitialized(expected_result))
138 .Times(Exactly(1)) 138 .Times(Exactly(1))
139 .WillOnce(InvokeWithoutArgs(run_loop_.get(), &base::RunLoop::Quit)); 139 .WillOnce(InvokeWithoutArgs(run_loop_.get(), &base::RunLoop::Quit));
140 renderer_->Initialize(std::move(client_ptr_info), nullptr, 140 renderer_->Initialize(std::move(client_ptr_info), nullptr,
141 std::move(video_stream_proxy), base::nullopt, 141 std::move(video_stream_proxy), base::nullopt,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // close the connection. 212 // close the connection.
213 EXPECT_CALL(*this, ConnectionClosed()) 213 EXPECT_CALL(*this, ConnectionClosed())
214 .Times(Exactly(1)) 214 .Times(Exactly(1))
215 .WillOnce(Invoke(run_loop_.get(), &base::RunLoop::Quit)); 215 .WillOnce(Invoke(run_loop_.get(), &base::RunLoop::Quit));
216 interface_factory_.reset(); 216 interface_factory_.reset();
217 217
218 run_loop_->Run(); 218 run_loop_->Run();
219 } 219 }
220 220
221 } // namespace media 221 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/clients/mojo_renderer_unittest.cc ('k') | media/mojo/services/mojo_cdm_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698