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 "media/cdm/aes_decryptor.h" | 5 #include "media/cdm/aes_decryptor.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/debug/leak_annotations.h" | 13 #include "base/debug/leak_annotations.h" |
14 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "media/base/cdm_callback_promise.h" | 18 #include "media/base/cdm_callback_promise.h" |
19 #include "media/base/cdm_config.h" | 19 #include "media/base/cdm_config.h" |
20 #include "media/base/cdm_key_information.h" | 20 #include "media/base/cdm_key_information.h" |
21 #include "media/base/decoder_buffer.h" | 21 #include "media/base/decoder_buffer.h" |
22 #include "media/base/decrypt_config.h" | 22 #include "media/base/decrypt_config.h" |
23 #include "media/base/decryptor.h" | 23 #include "media/base/decryptor.h" |
24 #include "media/base/mock_filters.h" | 24 #include "media/base/mock_filters.h" |
25 #include "media/cdm/api/content_decryption_module.h" | 25 #include "media/cdm/api/content_decryption_module.h" |
26 #include "media/cdm/cdm_adapter.h" | 26 #include "media/cdm/cdm_adapter.h" |
27 #include "media/cdm/cdm_file_io.h" | 27 #include "media/cdm/cdm_file_io.h" |
28 #include "media/cdm/external_clear_key_test_helper.h" | 28 #include "media/cdm/external_clear_key_test_helper.h" |
29 #include "media/cdm/simple_cdm_allocator.h" | 29 #include "media/cdm/simple_cdm_allocator.h" |
| 30 #include "media/media_features.h" |
30 #include "ppapi/features/features.h" | 31 #include "ppapi/features/features.h" |
31 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" |
32 #include "testing/gtest/include/gtest/gtest-param-test.h" | 33 #include "testing/gtest/include/gtest/gtest-param-test.h" |
33 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
34 #include "url/gurl.h" | 35 #include "url/gurl.h" |
35 | 36 |
36 using ::testing::_; | 37 using ::testing::_; |
37 using ::testing::Gt; | 38 using ::testing::Gt; |
38 using ::testing::IsNull; | 39 using ::testing::IsNull; |
39 using ::testing::NotNull; | 40 using ::testing::NotNull; |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 0x10, 0x77, 0xEF, 0xEC, 0xC0, 0xB2, 0x4D, 0x02, // SystemID | 531 0x10, 0x77, 0xEF, 0xEC, 0xC0, 0xB2, 0x4D, 0x02, // SystemID |
531 0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B, | 532 0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B, |
532 0x00, 0x00, 0x00, 0x02, // key count | 533 0x00, 0x00, 0x00, 0x02, // key count |
533 0x7E, 0x57, 0x1D, 0x03, 0x7E, 0x57, 0x1D, 0x03, // key1 | 534 0x7E, 0x57, 0x1D, 0x03, 0x7E, 0x57, 0x1D, 0x03, // key1 |
534 0x7E, 0x57, 0x1D, 0x03, 0x7E, 0x57, 0x1D, 0x03, | 535 0x7E, 0x57, 0x1D, 0x03, 0x7E, 0x57, 0x1D, 0x03, |
535 0x7E, 0x57, 0x1D, 0x04, 0x7E, 0x57, 0x1D, 0x04, // key2 | 536 0x7E, 0x57, 0x1D, 0x04, 0x7E, 0x57, 0x1D, 0x04, // key2 |
536 0x7E, 0x57, 0x1D, 0x04, 0x7E, 0x57, 0x1D, 0x04, | 537 0x7E, 0x57, 0x1D, 0x04, 0x7E, 0x57, 0x1D, 0x04, |
537 0x00, 0x00, 0x00, 0x00 // datasize | 538 0x00, 0x00, 0x00, 0x00 // datasize |
538 }; | 539 }; |
539 | 540 |
540 #if defined(USE_PROPRIETARY_CODECS) | 541 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
541 EXPECT_CALL(cdm_client_, OnSessionMessage(NotEmpty(), _, IsJSONDictionary())); | 542 EXPECT_CALL(cdm_client_, OnSessionMessage(NotEmpty(), _, IsJSONDictionary())); |
542 cdm_->CreateSessionAndGenerateRequest( | 543 cdm_->CreateSessionAndGenerateRequest( |
543 ContentDecryptionModule::TEMPORARY_SESSION, EmeInitDataType::CENC, | 544 ContentDecryptionModule::TEMPORARY_SESSION, EmeInitDataType::CENC, |
544 std::vector<uint8_t>(init_data, init_data + arraysize(init_data)), | 545 std::vector<uint8_t>(init_data, init_data + arraysize(init_data)), |
545 CreateSessionPromise(RESOLVED)); | 546 CreateSessionPromise(RESOLVED)); |
546 #else | 547 #else |
547 cdm_->CreateSessionAndGenerateRequest( | 548 cdm_->CreateSessionAndGenerateRequest( |
548 ContentDecryptionModule::TEMPORARY_SESSION, EmeInitDataType::CENC, | 549 ContentDecryptionModule::TEMPORARY_SESSION, EmeInitDataType::CENC, |
549 std::vector<uint8_t>(init_data, init_data + arraysize(init_data)), | 550 std::vector<uint8_t>(init_data, init_data + arraysize(init_data)), |
550 CreateSessionPromise(REJECTED)); | 551 CreateSessionPromise(REJECTED)); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 INSTANTIATE_TEST_CASE_P(CdmAdapter, | 1013 INSTANTIATE_TEST_CASE_P(CdmAdapter, |
1013 AesDecryptorTest, | 1014 AesDecryptorTest, |
1014 testing::Values("CdmAdapter")); | 1015 testing::Values("CdmAdapter")); |
1015 #endif | 1016 #endif |
1016 | 1017 |
1017 // TODO(jrummell): Once MojoCdm/MojoCdmService/MojoDecryptor/ | 1018 // TODO(jrummell): Once MojoCdm/MojoCdmService/MojoDecryptor/ |
1018 // MojoDecryptorService are implemented, add a third version that tests the | 1019 // MojoDecryptorService are implemented, add a third version that tests the |
1019 // CDM via mojo. | 1020 // CDM via mojo. |
1020 | 1021 |
1021 } // namespace media | 1022 } // namespace media |
OLD | NEW |