| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/debug/leak_annotations.h" | 11 #include "base/debug/leak_annotations.h" |
| 12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "media/base/cdm_callback_promise.h" | 15 #include "media/base/cdm_callback_promise.h" |
| 16 #include "media/base/cdm_config.h" | 16 #include "media/base/cdm_config.h" |
| 17 #include "media/base/cdm_key_information.h" | 17 #include "media/base/cdm_key_information.h" |
| 18 #include "media/base/decoder_buffer.h" | 18 #include "media/base/decoder_buffer.h" |
| 19 #include "media/base/decrypt_config.h" | 19 #include "media/base/decrypt_config.h" |
| 20 #include "media/base/decryptor.h" | 20 #include "media/base/decryptor.h" |
| 21 #include "media/base/mock_filters.h" | 21 #include "media/base/mock_filters.h" |
| 22 #include "media/cdm/aes_decryptor.h" | 22 #include "media/cdm/aes_decryptor.h" |
| 23 #include "media/cdm/api/content_decryption_module.h" | 23 #include "media/cdm/api/content_decryption_module.h" |
| 24 #include "media/cdm/cdm_adapter.h" | 24 #include "media/cdm/cdm_adapter.h" |
| 25 #include "media/cdm/external_clear_key_test_helper.h" | 25 #include "media/cdm/external_clear_key_test_helper.h" |
| 26 #include "media/cdm/simple_cdm_allocator.h" |
| 26 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
| 27 #include "testing/gtest/include/gtest/gtest-param-test.h" | 28 #include "testing/gtest/include/gtest/gtest-param-test.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 29 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 30 | 31 |
| 31 using ::testing::_; | 32 using ::testing::_; |
| 32 using ::testing::Gt; | 33 using ::testing::Gt; |
| 33 using ::testing::IsNull; | 34 using ::testing::IsNull; |
| 34 using ::testing::NotNull; | 35 using ::testing::NotNull; |
| 35 using ::testing::SaveArg; | 36 using ::testing::SaveArg; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 base::Unretained(this)), | 238 base::Unretained(this)), |
| 238 base::Bind(&AesDecryptorTest::OnSessionClosed, | 239 base::Bind(&AesDecryptorTest::OnSessionClosed, |
| 239 base::Unretained(this)), | 240 base::Unretained(this)), |
| 240 base::Bind(&AesDecryptorTest::OnSessionKeysChange, | 241 base::Bind(&AesDecryptorTest::OnSessionKeysChange, |
| 241 base::Unretained(this))), | 242 base::Unretained(this))), |
| 242 std::string()); | 243 std::string()); |
| 243 } else if (GetParam() == "CdmAdapter") { | 244 } else if (GetParam() == "CdmAdapter") { |
| 244 CdmConfig cdm_config; // default settings of false are sufficient. | 245 CdmConfig cdm_config; // default settings of false are sufficient. |
| 245 | 246 |
| 246 helper_.reset(new ExternalClearKeyTestHelper()); | 247 helper_.reset(new ExternalClearKeyTestHelper()); |
| 248 scoped_ptr<CdmAllocator> allocator(new SimpleCdmAllocator()); |
| 247 CdmAdapter::Create( | 249 CdmAdapter::Create( |
| 248 helper_->KeySystemName(), helper_->LibraryPath(), cdm_config, | 250 helper_->KeySystemName(), helper_->LibraryPath(), cdm_config, |
| 249 base::Bind(&AesDecryptorTest::OnSessionMessage, | 251 std::move(allocator), base::Bind(&AesDecryptorTest::OnSessionMessage, |
| 250 base::Unretained(this)), | 252 base::Unretained(this)), |
| 251 base::Bind(&AesDecryptorTest::OnSessionClosed, | 253 base::Bind(&AesDecryptorTest::OnSessionClosed, |
| 252 base::Unretained(this)), | 254 base::Unretained(this)), |
| 253 base::Bind(&AesDecryptorTest::OnLegacySessionError, | 255 base::Bind(&AesDecryptorTest::OnLegacySessionError, |
| 254 base::Unretained(this)), | 256 base::Unretained(this)), |
| 255 base::Bind(&AesDecryptorTest::OnSessionKeysChange, | 257 base::Bind(&AesDecryptorTest::OnSessionKeysChange, |
| 256 base::Unretained(this)), | 258 base::Unretained(this)), |
| 257 base::Bind(&AesDecryptorTest::OnSessionExpirationUpdate, | 259 base::Bind(&AesDecryptorTest::OnSessionExpirationUpdate, |
| 258 base::Unretained(this)), | 260 base::Unretained(this)), |
| 259 base::Bind(&AesDecryptorTest::OnCdmCreated, base::Unretained(this))); | 261 base::Bind(&AesDecryptorTest::OnCdmCreated, base::Unretained(this))); |
| 260 | 262 |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 INSTANTIATE_TEST_CASE_P(CdmAdapter, | 1014 INSTANTIATE_TEST_CASE_P(CdmAdapter, |
| 1013 AesDecryptorTest, | 1015 AesDecryptorTest, |
| 1014 testing::Values("CdmAdapter")); | 1016 testing::Values("CdmAdapter")); |
| 1015 #endif | 1017 #endif |
| 1016 | 1018 |
| 1017 // TODO(jrummell): Once MojoCdm/MojoCdmService/MojoDecryptor/ | 1019 // TODO(jrummell): Once MojoCdm/MojoCdmService/MojoDecryptor/ |
| 1018 // MojoDecryptorService are implemented, add a third version that tests the | 1020 // MojoDecryptorService are implemented, add a third version that tests the |
| 1019 // CDM via mojo. | 1021 // CDM via mojo. |
| 1020 | 1022 |
| 1021 } // namespace media | 1023 } // namespace media |
| OLD | NEW |