| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef MEDIA_TEST_FAKE_ENCRYPTED_MEDIA_H_ | 5 #ifndef MEDIA_TEST_FAKE_ENCRYPTED_MEDIA_H_ |
| 6 #define MEDIA_TEST_FAKE_ENCRYPTED_MEDIA_H_ | 6 #define MEDIA_TEST_FAKE_ENCRYPTED_MEDIA_H_ |
| 7 | 7 |
| 8 #include "media/base/cdm_context.h" | 8 #include "media/base/cdm_context.h" |
| 9 #include "media/base/content_decryption_module.h" | 9 #include "media/base/content_decryption_module.h" |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ContentDecryptionModule::MessageType message_type, | 26 ContentDecryptionModule::MessageType message_type, |
| 27 const std::vector<uint8_t>& message, | 27 const std::vector<uint8_t>& message, |
| 28 AesDecryptor* decryptor) = 0; | 28 AesDecryptor* decryptor) = 0; |
| 29 | 29 |
| 30 virtual void OnSessionClosed(const std::string& session_id) = 0; | 30 virtual void OnSessionClosed(const std::string& session_id) = 0; |
| 31 | 31 |
| 32 virtual void OnSessionKeysChange(const std::string& session_id, | 32 virtual void OnSessionKeysChange(const std::string& session_id, |
| 33 bool has_additional_usable_key, | 33 bool has_additional_usable_key, |
| 34 CdmKeysInfo keys_info) = 0; | 34 CdmKeysInfo keys_info) = 0; |
| 35 | 35 |
| 36 virtual void OnSessionExpirationUpdate(const std::string& session_id, |
| 37 base::Time new_expiry_time) = 0; |
| 38 |
| 36 virtual void OnEncryptedMediaInitData(EmeInitDataType init_data_type, | 39 virtual void OnEncryptedMediaInitData(EmeInitDataType init_data_type, |
| 37 const std::vector<uint8_t>& init_data, | 40 const std::vector<uint8_t>& init_data, |
| 38 AesDecryptor* decryptor) = 0; | 41 AesDecryptor* decryptor) = 0; |
| 39 }; | 42 }; |
| 40 | 43 |
| 41 FakeEncryptedMedia(AppBase* app); | 44 FakeEncryptedMedia(AppBase* app); |
| 42 ~FakeEncryptedMedia(); | 45 ~FakeEncryptedMedia(); |
| 43 CdmContext* GetCdmContext(); | 46 CdmContext* GetCdmContext(); |
| 44 // Callbacks for firing session events. Delegate to |app_|. | 47 // Callbacks for firing session events. Delegate to |app_|. |
| 45 void OnSessionMessage(const std::string& session_id, | 48 void OnSessionMessage(const std::string& session_id, |
| 46 ContentDecryptionModule::MessageType message_type, | 49 ContentDecryptionModule::MessageType message_type, |
| 47 const std::vector<uint8_t>& message); | 50 const std::vector<uint8_t>& message); |
| 48 void OnSessionClosed(const std::string& session_id); | 51 void OnSessionClosed(const std::string& session_id); |
| 49 void OnSessionKeysChange(const std::string& session_id, | 52 void OnSessionKeysChange(const std::string& session_id, |
| 50 bool has_additional_usable_key, | 53 bool has_additional_usable_key, |
| 51 CdmKeysInfo keys_info); | 54 CdmKeysInfo keys_info); |
| 55 void OnSessionExpirationUpdate(const std::string& session_id, |
| 56 base::Time new_expiry_time); |
| 52 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, | 57 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, |
| 53 const std::vector<uint8_t>& init_data); | 58 const std::vector<uint8_t>& init_data); |
| 54 | 59 |
| 55 private: | 60 private: |
| 56 class TestCdmContext : public CdmContext { | 61 class TestCdmContext : public CdmContext { |
| 57 public: | 62 public: |
| 58 TestCdmContext(Decryptor* decryptor); | 63 TestCdmContext(Decryptor* decryptor); |
| 59 Decryptor* GetDecryptor() final; | 64 Decryptor* GetDecryptor() final; |
| 60 int GetCdmId() const final; | 65 int GetCdmId() const final; |
| 61 | 66 |
| 62 private: | 67 private: |
| 63 Decryptor* decryptor_; | 68 Decryptor* decryptor_; |
| 64 }; | 69 }; |
| 65 | 70 |
| 66 scoped_refptr<AesDecryptor> decryptor_; | 71 scoped_refptr<AesDecryptor> decryptor_; |
| 67 TestCdmContext cdm_context_; | 72 TestCdmContext cdm_context_; |
| 68 std::unique_ptr<AppBase> app_; | 73 std::unique_ptr<AppBase> app_; |
| 69 | 74 |
| 70 DISALLOW_COPY_AND_ASSIGN(FakeEncryptedMedia); | 75 DISALLOW_COPY_AND_ASSIGN(FakeEncryptedMedia); |
| 71 }; | 76 }; |
| 72 | 77 |
| 73 } // namespace media | 78 } // namespace media |
| 74 | 79 |
| 75 #endif // MEDIA_TEST_FAKE_ENCRYPTED_MEDIA_H_ | 80 #endif // MEDIA_TEST_FAKE_ENCRYPTED_MEDIA_H_ |
| OLD | NEW |