Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: media/test/fake_encrypted_media.h

Issue 2808583002: RELAND: Media Remoting end to end integration tests. (Closed)
Patch Set: Rebased. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/test/BUILD.gn ('k') | media/test/fake_encrypted_media.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_TEST_FAKE_ENCRYPTED_MEDIA_H_
6 #define MEDIA_TEST_FAKE_ENCRYPTED_MEDIA_H_
7
8 #include "media/base/cdm_context.h"
9 #include "media/base/content_decryption_module.h"
10
11 namespace media {
12
13 class AesDecryptor;
14
15 // Note: Tests using this class only exercise the DecryptingDemuxerStream path.
16 // They do not exercise the Decrypting{Audio|Video}Decoder path.
17 class FakeEncryptedMedia {
18 public:
19 // Defines the behavior of the "app" that responds to EME events.
20 class AppBase {
21 public:
22 virtual ~AppBase() {}
23
24 virtual void OnSessionMessage(
25 const std::string& session_id,
26 ContentDecryptionModule::MessageType message_type,
27 const std::vector<uint8_t>& message,
28 AesDecryptor* decryptor) = 0;
29
30 virtual void OnSessionClosed(const std::string& session_id) = 0;
31
32 virtual void OnSessionKeysChange(const std::string& session_id,
33 bool has_additional_usable_key,
34 CdmKeysInfo keys_info) = 0;
35
36 virtual void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
37 const std::vector<uint8_t>& init_data,
38 AesDecryptor* decryptor) = 0;
39 };
40
41 FakeEncryptedMedia(AppBase* app);
42 ~FakeEncryptedMedia();
43 CdmContext* GetCdmContext();
44 // Callbacks for firing session events. Delegate to |app_|.
45 void OnSessionMessage(const std::string& session_id,
46 ContentDecryptionModule::MessageType message_type,
47 const std::vector<uint8_t>& message);
48 void OnSessionClosed(const std::string& session_id);
49 void OnSessionKeysChange(const std::string& session_id,
50 bool has_additional_usable_key,
51 CdmKeysInfo keys_info);
52 void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
53 const std::vector<uint8_t>& init_data);
54
55 private:
56 class TestCdmContext : public CdmContext {
57 public:
58 TestCdmContext(Decryptor* decryptor);
59 Decryptor* GetDecryptor() final;
60 int GetCdmId() const final;
61
62 private:
63 Decryptor* decryptor_;
64 };
65
66 scoped_refptr<AesDecryptor> decryptor_;
67 TestCdmContext cdm_context_;
68 std::unique_ptr<AppBase> app_;
69
70 DISALLOW_COPY_AND_ASSIGN(FakeEncryptedMedia);
71 };
72
73 } // namespace media
74
75 #endif // MEDIA_TEST_FAKE_ENCRYPTED_MEDIA_H_
OLDNEW
« no previous file with comments | « media/test/BUILD.gn ('k') | media/test/fake_encrypted_media.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698