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

Side by Side Diff: media/cdm/ppapi/external_clear_key/clear_key_cdm.cc

Issue 641443002: Add unprefixed EME tests for LoadSession() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add TODO (plus rebase) Created 6 years, 2 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "media/cdm/ppapi/external_clear_key/clear_key_cdm.h" 5 #include "media/cdm/ppapi/external_clear_key/clear_key_cdm.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <sstream> 9 #include <sstream>
10 #include <string> 10 #include <string>
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 host_->OnSessionMessage(web_session_id.data(), 693 host_->OnSessionMessage(web_session_id.data(),
694 web_session_id.length(), 694 web_session_id.length(),
695 reinterpret_cast<const char*>(message.data()), 695 reinterpret_cast<const char*>(message.data()),
696 message.size(), 696 message.size(),
697 destination_url.spec().data(), 697 destination_url.spec().data(),
698 destination_url.spec().size()); 698 destination_url.spec().size());
699 } 699 }
700 700
701 void ClearKeyCdm::OnSessionKeysChange(const std::string& web_session_id, 701 void ClearKeyCdm::OnSessionKeysChange(const std::string& web_session_id,
702 bool has_additional_usable_key) { 702 bool has_additional_usable_key) {
703 // Ignore the message when we are waiting to update the loadable session.
704 if (web_session_id == session_id_for_emulated_loadsession_)
705 return;
706
703 host_->OnSessionUsableKeysChange(web_session_id.data(), 707 host_->OnSessionUsableKeysChange(web_session_id.data(),
704 web_session_id.length(), 708 web_session_id.length(),
705 has_additional_usable_key); 709 has_additional_usable_key);
706 } 710 }
707 711
708 void ClearKeyCdm::OnSessionClosed(const std::string& web_session_id) { 712 void ClearKeyCdm::OnSessionClosed(const std::string& web_session_id) {
709 host_->OnSessionClosed(web_session_id.data(), web_session_id.length()); 713 host_->OnSessionClosed(web_session_id.data(), web_session_id.length());
710 } 714 }
711 715
712 void ClearKeyCdm::OnSessionCreated(uint32 promise_id, 716 void ClearKeyCdm::OnSessionCreated(uint32 promise_id,
(...skipping 29 matching lines...) Expand all
742 746
743 void ClearKeyCdm::OnSessionUpdated(uint32 promise_id, 747 void ClearKeyCdm::OnSessionUpdated(uint32 promise_id,
744 const std::string& web_session_id) { 748 const std::string& web_session_id) {
745 // UpdateSession() may be called to finish loading sessions, so handle 749 // UpdateSession() may be called to finish loading sessions, so handle
746 // appropriately. 750 // appropriately.
747 if (web_session_id == session_id_for_emulated_loadsession_) { 751 if (web_session_id == session_id_for_emulated_loadsession_) {
748 session_id_for_emulated_loadsession_ = std::string(); 752 session_id_for_emulated_loadsession_ = std::string();
749 // |promise_id| is the LoadSession() promise, so resolve appropriately. 753 // |promise_id| is the LoadSession() promise, so resolve appropriately.
750 host_->OnResolveNewSessionPromise( 754 host_->OnResolveNewSessionPromise(
751 promise_id, kLoadableWebSessionId, strlen(kLoadableWebSessionId)); 755 promise_id, kLoadableWebSessionId, strlen(kLoadableWebSessionId));
756 // Generate the UsableKeys event now that the session is "loaded".
757 host_->OnSessionUsableKeysChange(
758 kLoadableWebSessionId, strlen(kLoadableWebSessionId), true);
752 return; 759 return;
753 } 760 }
754 761
755 host_->OnResolvePromise(promise_id); 762 host_->OnResolvePromise(promise_id);
756 } 763 }
757 764
758 void ClearKeyCdm::OnUsableKeyIdsObtained(uint32 promise_id, 765 void ClearKeyCdm::OnUsableKeyIdsObtained(uint32 promise_id,
759 const KeyIdsVector& key_ids) { 766 const KeyIdsVector& key_ids) {
760 scoped_ptr<cdm::BinaryData[]> result(new cdm::BinaryData[key_ids.size()]); 767 scoped_ptr<cdm::BinaryData[]> result(new cdm::BinaryData[key_ids.size()]);
761 for (uint32 i = 0; i < key_ids.size(); ++i) { 768 for (uint32 i = 0; i < key_ids.size(); ++i) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 host_->OnSessionMessage(last_session_id_.data(), 859 host_->OnSessionMessage(last_session_id_.data(),
853 last_session_id_.length(), 860 last_session_id_.length(),
854 message.data(), 861 message.data(),
855 message.length(), 862 message.length(),
856 NULL, 863 NULL,
857 0); 864 0);
858 file_io_test_runner_.reset(); 865 file_io_test_runner_.reset();
859 } 866 }
860 867
861 } // namespace media 868 } // namespace media
OLDNEW
« no previous file with comments | « chrome/browser/media/encrypted_media_browsertest.cc ('k') | media/test/data/eme_player_js/player_utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698