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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/test/fake_encrypted_media.cc
diff --git a/media/test/fake_encrypted_media.cc b/media/test/fake_encrypted_media.cc
new file mode 100644
index 0000000000000000000000000000000000000000..094ed3820c17d7cfa2c77f5f4ca4c8f9d67be4a6
--- /dev/null
+++ b/media/test/fake_encrypted_media.cc
@@ -0,0 +1,67 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/test/fake_encrypted_media.h"
+
+#include "base/bind.h"
+#include "media/base/cdm_key_information.h"
+#include "media/cdm/aes_decryptor.h"
+
+namespace media {
+
+FakeEncryptedMedia::TestCdmContext::TestCdmContext(Decryptor* decryptor)
+ : decryptor_(decryptor) {}
+
+Decryptor* FakeEncryptedMedia::TestCdmContext::GetDecryptor() {
+ return decryptor_;
+}
+
+int FakeEncryptedMedia::TestCdmContext::GetCdmId() const {
+ return kInvalidCdmId;
+}
+
+FakeEncryptedMedia::FakeEncryptedMedia(AppBase* app)
+ : decryptor_(
+ new AesDecryptor(GURL::EmptyGURL(),
+ base::Bind(&FakeEncryptedMedia::OnSessionMessage,
+ base::Unretained(this)),
+ base::Bind(&FakeEncryptedMedia::OnSessionClosed,
+ base::Unretained(this)),
+ base::Bind(&FakeEncryptedMedia::OnSessionKeysChange,
+ base::Unretained(this)))),
+ cdm_context_(decryptor_.get()),
+ app_(app) {}
+
+FakeEncryptedMedia::~FakeEncryptedMedia() {}
+
+CdmContext* FakeEncryptedMedia::GetCdmContext() {
+ return &cdm_context_;
+}
+
+// Callbacks for firing session events. Delegate to |app_|.
+void FakeEncryptedMedia::OnSessionMessage(
+ const std::string& session_id,
+ ContentDecryptionModule::MessageType message_type,
+ const std::vector<uint8_t>& message) {
+ app_->OnSessionMessage(session_id, message_type, message, decryptor_.get());
+}
+
+void FakeEncryptedMedia::OnSessionClosed(const std::string& session_id) {
+ app_->OnSessionClosed(session_id);
+}
+
+void FakeEncryptedMedia::OnSessionKeysChange(const std::string& session_id,
+ bool has_additional_usable_key,
+ CdmKeysInfo keys_info) {
+ app_->OnSessionKeysChange(session_id, has_additional_usable_key,
+ std::move(keys_info));
+}
+
+void FakeEncryptedMedia::OnEncryptedMediaInitData(
+ EmeInitDataType init_data_type,
+ const std::vector<uint8_t>& init_data) {
+ app_->OnEncryptedMediaInitData(init_data_type, init_data, decryptor_.get());
+}
+
+} // namespace media
« 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