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

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

Issue 2808583002: RELAND: Media Remoting end to end integration tests. (Closed)
Patch Set: Addressed DaleCurtis's comments. 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
OLDNEW
(Empty)
1 // Copyright (c) 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 int FakeEncryptedMedia::TestCdmContext::GetCdmId() const {
DaleCurtis 2017/04/20 21:40:25 Line.
xjz 2017/04/20 22:07:44 Done.
20 return kInvalidCdmId;
21 }
22
23 FakeEncryptedMedia::FakeEncryptedMedia(AppBase* app)
24 : decryptor_(
25 new AesDecryptor(GURL::EmptyGURL(),
26 base::Bind(&FakeEncryptedMedia::OnSessionMessage,
27 base::Unretained(this)),
28 base::Bind(&FakeEncryptedMedia::OnSessionClosed,
29 base::Unretained(this)),
30 base::Bind(&FakeEncryptedMedia::OnSessionKeysChange,
31 base::Unretained(this)))),
32 cdm_context_(decryptor_.get()),
33 app_(app) {}
34
35 FakeEncryptedMedia::~FakeEncryptedMedia() {}
36
37 CdmContext* FakeEncryptedMedia::GetCdmContext() {
38 return &cdm_context_;
39 }
40
41 // Callbacks for firing session events. Delegate to |app_|.
42 void FakeEncryptedMedia::OnSessionMessage(
43 const std::string& session_id,
44 ContentDecryptionModule::MessageType message_type,
45 const std::vector<uint8_t>& message) {
46 app_->OnSessionMessage(session_id, message_type, message, decryptor_.get());
47 }
48
49 void FakeEncryptedMedia::OnSessionClosed(const std::string& session_id) {
50 app_->OnSessionClosed(session_id);
51 }
52
53 void FakeEncryptedMedia::OnSessionKeysChange(const std::string& session_id,
54 bool has_additional_usable_key,
55 CdmKeysInfo keys_info) {
56 app_->OnSessionKeysChange(session_id, has_additional_usable_key,
57 std::move(keys_info));
58 }
59
60 void FakeEncryptedMedia::OnEncryptedMediaInitData(
61 EmeInitDataType init_data_type,
62 const std::vector<uint8_t>& init_data) {
63 app_->OnEncryptedMediaInitData(init_data_type, init_data, decryptor_.get());
64 }
65
66 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698