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 "media/cdm/cdm_adapter.h" | 5 #include "media/cdm/cdm_adapter.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/test/scoped_task_environment.h" |
14 #include "media/base/cdm_callback_promise.h" | 15 #include "media/base/cdm_callback_promise.h" |
15 #include "media/base/cdm_key_information.h" | 16 #include "media/base/cdm_key_information.h" |
16 #include "media/base/content_decryption_module.h" | 17 #include "media/base/content_decryption_module.h" |
17 #include "media/base/mock_filters.h" | 18 #include "media/base/mock_filters.h" |
18 #include "media/cdm/cdm_file_io.h" | 19 #include "media/cdm/cdm_file_io.h" |
19 #include "media/cdm/external_clear_key_test_helper.h" | 20 #include "media/cdm/external_clear_key_test_helper.h" |
20 #include "media/cdm/simple_cdm_allocator.h" | 21 #include "media/cdm/simple_cdm_allocator.h" |
21 #include "media/media_features.h" | 22 #include "media/media_features.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 237 |
237 // Helper class to load/unload External Clear Key Library. | 238 // Helper class to load/unload External Clear Key Library. |
238 ExternalClearKeyTestHelper helper_; | 239 ExternalClearKeyTestHelper helper_; |
239 | 240 |
240 // Keep track of the loaded CDM. | 241 // Keep track of the loaded CDM. |
241 scoped_refptr<ContentDecryptionModule> adapter_; | 242 scoped_refptr<ContentDecryptionModule> adapter_; |
242 | 243 |
243 // |session_id_| is the latest result of calling CreateSession(). | 244 // |session_id_| is the latest result of calling CreateSession(). |
244 std::string session_id_; | 245 std::string session_id_; |
245 | 246 |
246 base::MessageLoop message_loop_; | 247 base::test::ScopedTaskEnvironment scoped_task_environment_; |
247 | 248 |
248 DISALLOW_COPY_AND_ASSIGN(CdmAdapterTest); | 249 DISALLOW_COPY_AND_ASSIGN(CdmAdapterTest); |
249 }; | 250 }; |
250 | 251 |
251 TEST_F(CdmAdapterTest, Initialize) { | 252 TEST_F(CdmAdapterTest, Initialize) { |
252 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); | 253 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); |
253 } | 254 } |
254 | 255 |
255 TEST_F(CdmAdapterTest, BadLibraryPath) { | 256 TEST_F(CdmAdapterTest, BadLibraryPath) { |
256 InitializeAndExpect(base::FilePath(FILE_PATH_LITERAL("no_library_here")), | 257 InitializeAndExpect(base::FilePath(FILE_PATH_LITERAL("no_library_here")), |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 TEST_F(CdmAdapterTest, UpdateSessionWithBadData) { | 314 TEST_F(CdmAdapterTest, UpdateSessionWithBadData) { |
314 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); | 315 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); |
315 | 316 |
316 std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); | 317 std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); |
317 CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS); | 318 CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS); |
318 | 319 |
319 UpdateSessionAndExpect(SessionId(), "random data", FAILURE, true); | 320 UpdateSessionAndExpect(SessionId(), "random data", FAILURE, true); |
320 } | 321 } |
321 | 322 |
322 } // namespace media | 323 } // namespace media |
OLD | NEW |