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

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

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/fake_encrypted_media.h ('k') | media/test/mock_media_source.h » ('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 #include "media/test/fake_encrypted_media.h"
6
7 #include "base/bind.h"
8 #include "media/base/cdm_key_information.h"
9 #include "media/cdm/aes_decryptor.h"
10
11 namespace media {
12
13 FakeEncryptedMedia::TestCdmContext::TestCdmContext(Decryptor* decryptor)
14 : decryptor_(decryptor) {}
15
16 Decryptor* FakeEncryptedMedia::TestCdmContext::GetDecryptor() {
17 return decryptor_;
18 }
19
20 int FakeEncryptedMedia::TestCdmContext::GetCdmId() const {
21 return kInvalidCdmId;
22 }
23
24 FakeEncryptedMedia::FakeEncryptedMedia(AppBase* app)
25 : decryptor_(
26 new AesDecryptor(GURL::EmptyGURL(),
27 base::Bind(&FakeEncryptedMedia::OnSessionMessage,
28 base::Unretained(this)),
29 base::Bind(&FakeEncryptedMedia::OnSessionClosed,
30 base::Unretained(this)),
31 base::Bind(&FakeEncryptedMedia::OnSessionKeysChange,
32 base::Unretained(this)))),
33 cdm_context_(decryptor_.get()),
34 app_(app) {}
35
36 FakeEncryptedMedia::~FakeEncryptedMedia() {}
37
38 CdmContext* FakeEncryptedMedia::GetCdmContext() {
39 return &cdm_context_;
40 }
41
42 // Callbacks for firing session events. Delegate to |app_|.
43 void FakeEncryptedMedia::OnSessionMessage(
44 const std::string& session_id,
45 ContentDecryptionModule::MessageType message_type,
46 const std::vector<uint8_t>& message) {
47 app_->OnSessionMessage(session_id, message_type, message, decryptor_.get());
48 }
49
50 void FakeEncryptedMedia::OnSessionClosed(const std::string& session_id) {
51 app_->OnSessionClosed(session_id);
52 }
53
54 void FakeEncryptedMedia::OnSessionKeysChange(const std::string& session_id,
55 bool has_additional_usable_key,
56 CdmKeysInfo keys_info) {
57 app_->OnSessionKeysChange(session_id, has_additional_usable_key,
58 std::move(keys_info));
59 }
60
61 void FakeEncryptedMedia::OnEncryptedMediaInitData(
62 EmeInitDataType init_data_type,
63 const std::vector<uint8_t>& init_data) {
64 app_->OnEncryptedMediaInitData(init_data_type, init_data, decryptor_.get());
65 }
66
67 } // namespace media
OLDNEW
« no previous file with comments | « media/test/fake_encrypted_media.h ('k') | media/test/mock_media_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698