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 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "media/base/cdm_config.h" | 13 #include "media/base/cdm_config.h" |
14 #include "media/base/mock_filters.h" | 14 #include "media/base/mock_filters.h" |
15 #include "media/base/test_helpers.h" | 15 #include "media/base/test_helpers.h" |
16 #include "media/cdm/key_system_names.h" | 16 #include "media/cdm/key_system_names.h" |
17 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | 17 #include "media/mojo/interfaces/content_decryption_module.mojom.h" |
18 #include "media/mojo/interfaces/decryptor.mojom.h" | 18 #include "media/mojo/interfaces/decryptor.mojom.h" |
19 #include "media/mojo/interfaces/renderer.mojom.h" | 19 #include "media/mojo/interfaces/renderer.mojom.h" |
20 #include "media/mojo/interfaces/service_factory.mojom.h" | 20 #include "media/mojo/interfaces/service_factory.mojom.h" |
21 #include "media/mojo/services/media_type_converters.h" | 21 #include "media/mojo/services/media_type_converters.h" |
22 #include "media/mojo/services/mojo_demuxer_stream_impl.h" | 22 #include "media/mojo/services/mojo_demuxer_stream_impl.h" |
23 #include "mojo/shell/public/cpp/application_connection.h" | |
24 #include "mojo/shell/public/cpp/application_test_base.h" | 23 #include "mojo/shell/public/cpp/application_test_base.h" |
25 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
26 | 25 |
27 using testing::Exactly; | 26 using testing::Exactly; |
28 using testing::Invoke; | 27 using testing::Invoke; |
29 using testing::InvokeWithoutArgs; | 28 using testing::InvokeWithoutArgs; |
30 using testing::StrictMock; | 29 using testing::StrictMock; |
31 | 30 |
32 namespace media { | 31 namespace media { |
33 namespace { | 32 namespace { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 interfaces::ServiceFactoryPtr service_factory_; | 116 interfaces::ServiceFactoryPtr service_factory_; |
118 interfaces::ContentDecryptionModulePtr cdm_; | 117 interfaces::ContentDecryptionModulePtr cdm_; |
119 interfaces::RendererPtr renderer_; | 118 interfaces::RendererPtr renderer_; |
120 | 119 |
121 StrictMock<MockRendererClient> renderer_client_; | 120 StrictMock<MockRendererClient> renderer_client_; |
122 mojo::Binding<interfaces::RendererClient> renderer_client_binding_; | 121 mojo::Binding<interfaces::RendererClient> renderer_client_binding_; |
123 | 122 |
124 StrictMock<MockDemuxerStream> video_demuxer_stream_; | 123 StrictMock<MockDemuxerStream> video_demuxer_stream_; |
125 | 124 |
126 private: | 125 private: |
127 scoped_ptr<mojo::ApplicationConnection> connection_; | 126 scoped_ptr<mojo::Connection> connection_; |
128 | 127 |
129 DISALLOW_COPY_AND_ASSIGN(MediaAppTest); | 128 DISALLOW_COPY_AND_ASSIGN(MediaAppTest); |
130 }; | 129 }; |
131 | 130 |
132 } // namespace | 131 } // namespace |
133 | 132 |
134 // Note: base::RunLoop::RunUntilIdle() does not work well in these tests because | 133 // Note: base::RunLoop::RunUntilIdle() does not work well in these tests because |
135 // even when the loop is idle, we may still have pending events in the pipe. | 134 // even when the loop is idle, we may still have pending events in the pipe. |
136 | 135 |
137 TEST_F(MediaAppTest, InitializeCdm_Success) { | 136 TEST_F(MediaAppTest, InitializeCdm_Success) { |
(...skipping 25 matching lines...) Expand all Loading... |
163 // close the connection. | 162 // close the connection. |
164 EXPECT_CALL(*this, ConnectionClosed()) | 163 EXPECT_CALL(*this, ConnectionClosed()) |
165 .Times(Exactly(1)) | 164 .Times(Exactly(1)) |
166 .WillOnce(Invoke(run_loop_.get(), &base::RunLoop::Quit)); | 165 .WillOnce(Invoke(run_loop_.get(), &base::RunLoop::Quit)); |
167 service_factory_.reset(); | 166 service_factory_.reset(); |
168 | 167 |
169 run_loop_->Run(); | 168 run_loop_->Run(); |
170 } | 169 } |
171 | 170 |
172 } // namespace media | 171 } // namespace media |
OLD | NEW |