| OLD | NEW |
| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "media/base/cdm_config.h" | 15 #include "media/base/cdm_config.h" |
| 16 #include "media/base/mock_filters.h" | 16 #include "media/base/mock_filters.h" |
| 17 #include "media/base/test_helpers.h" | 17 #include "media/base/test_helpers.h" |
| 18 #include "media/mojo/clients/mojo_demuxer_stream_impl.h" | 18 #include "media/mojo/clients/mojo_demuxer_stream_impl.h" |
| 19 #include "media/mojo/common/media_type_converters.h" | 19 #include "media/mojo/common/media_type_converters.h" |
| 20 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | 20 #include "media/mojo/interfaces/content_decryption_module.mojom.h" |
| 21 #include "media/mojo/interfaces/decryptor.mojom.h" | 21 #include "media/mojo/interfaces/decryptor.mojom.h" |
| 22 #include "media/mojo/interfaces/interface_factory.mojom.h" | 22 #include "media/mojo/interfaces/interface_factory.mojom.h" |
| 23 #include "media/mojo/interfaces/media_service.mojom.h" | 23 #include "media/mojo/interfaces/media_service.mojom.h" |
| 24 #include "media/mojo/interfaces/renderer.mojom.h" | 24 #include "media/mojo/interfaces/renderer.mojom.h" |
| 25 #include "media/mojo/services/media_interface_provider.h" |
| 25 #include "mojo/public/cpp/bindings/associated_binding.h" | 26 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 26 #include "mojo/public/cpp/bindings/interface_request.h" | 27 #include "mojo/public/cpp/bindings/interface_request.h" |
| 27 #include "services/service_manager/public/cpp/interface_registry.h" | |
| 28 #include "services/service_manager/public/cpp/service_test.h" | 28 #include "services/service_manager/public/cpp/service_test.h" |
| 29 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
| 30 | 30 |
| 31 using testing::Exactly; | 31 using testing::Exactly; |
| 32 using testing::Invoke; | 32 using testing::Invoke; |
| 33 using testing::InvokeWithoutArgs; | 33 using testing::InvokeWithoutArgs; |
| 34 using testing::StrictMock; | 34 using testing::StrictMock; |
| 35 | 35 |
| 36 namespace media { | 36 namespace media { |
| 37 namespace { | 37 namespace { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 renderer_client_binding_(&renderer_client_), | 73 renderer_client_binding_(&renderer_client_), |
| 74 video_stream_(DemuxerStream::VIDEO) {} | 74 video_stream_(DemuxerStream::VIDEO) {} |
| 75 ~MediaServiceTest() override {} | 75 ~MediaServiceTest() override {} |
| 76 | 76 |
| 77 void SetUp() override { | 77 void SetUp() override { |
| 78 ServiceTest::SetUp(); | 78 ServiceTest::SetUp(); |
| 79 | 79 |
| 80 media::mojom::MediaServicePtr media_service; | 80 media::mojom::MediaServicePtr media_service; |
| 81 connector()->BindInterface("media", &media_service); | 81 connector()->BindInterface("media", &media_service); |
| 82 | 82 |
| 83 auto registry = | |
| 84 base::MakeUnique<service_manager::InterfaceRegistry>(std::string()); | |
| 85 service_manager::mojom::InterfaceProviderPtr interfaces; | 83 service_manager::mojom::InterfaceProviderPtr interfaces; |
| 86 registry->Bind(MakeRequest(&interfaces), service_manager::Identity(), | 84 auto provider = base::MakeUnique<MediaInterfaceProvider>( |
| 87 service_manager::InterfaceProviderSpec(), | 85 mojo::MakeRequest(&interfaces)); |
| 88 service_manager::Identity(), | |
| 89 service_manager::InterfaceProviderSpec()); | |
| 90 | |
| 91 media_service->CreateInterfaceFactory( | 86 media_service->CreateInterfaceFactory( |
| 92 mojo::MakeRequest(&interface_factory_), std::move(interfaces)); | 87 mojo::MakeRequest(&interface_factory_), std::move(interfaces)); |
| 93 | 88 |
| 94 run_loop_.reset(new base::RunLoop()); | 89 run_loop_.reset(new base::RunLoop()); |
| 95 } | 90 } |
| 96 | 91 |
| 97 // MOCK_METHOD* doesn't support move only types. Work around this by having | 92 // MOCK_METHOD* doesn't support move only types. Work around this by having |
| 98 // an extra method. | 93 // an extra method. |
| 99 MOCK_METHOD2(OnCdmInitializedInternal, void(bool result, int cdm_id)); | 94 MOCK_METHOD2(OnCdmInitializedInternal, void(bool result, int cdm_id)); |
| 100 void OnCdmInitialized(mojom::CdmPromiseResultPtr result, | 95 void OnCdmInitialized(mojom::CdmPromiseResultPtr result, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // close the connection. | 211 // close the connection. |
| 217 EXPECT_CALL(*this, ConnectionClosed()) | 212 EXPECT_CALL(*this, ConnectionClosed()) |
| 218 .Times(Exactly(1)) | 213 .Times(Exactly(1)) |
| 219 .WillOnce(Invoke(run_loop_.get(), &base::RunLoop::Quit)); | 214 .WillOnce(Invoke(run_loop_.get(), &base::RunLoop::Quit)); |
| 220 interface_factory_.reset(); | 215 interface_factory_.reset(); |
| 221 | 216 |
| 222 run_loop_->Run(); | 217 run_loop_->Run(); |
| 223 } | 218 } |
| 224 | 219 |
| 225 } // namespace media | 220 } // namespace media |
| OLD | NEW |