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

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

Issue 833963003: Pass key_information on SessionKeysChange message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GN changes Created 5 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "media/base/cdm_callback_promise.h" 10 #include "media/base/cdm_callback_promise.h"
11 #include "media/base/cdm_context.h" 11 #include "media/base/cdm_context.h"
12 #include "media/base/cdm_key_information.h"
12 #include "media/base/decoder_buffer.h" 13 #include "media/base/decoder_buffer.h"
13 #include "media/base/media_keys.h" 14 #include "media/base/media_keys.h"
14 #include "media/base/media_switches.h" 15 #include "media/base/media_switches.h"
15 #include "media/base/test_data_util.h" 16 #include "media/base/test_data_util.h"
16 #include "media/cdm/aes_decryptor.h" 17 #include "media/cdm/aes_decryptor.h"
17 #include "media/cdm/json_web_key.h" 18 #include "media/cdm/json_web_key.h"
18 #include "media/filters/chunk_demuxer.h" 19 #include "media/filters/chunk_demuxer.h"
19 #include "media/filters/renderer_impl.h" 20 #include "media/filters/renderer_impl.h"
20 #include "media/test/pipeline_integration_test_base.h" 21 #include "media/test/pipeline_integration_test_base.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 class AppBase { 116 class AppBase {
116 public: 117 public:
117 virtual ~AppBase() {} 118 virtual ~AppBase() {}
118 119
119 virtual void OnSessionMessage(const std::string& web_session_id, 120 virtual void OnSessionMessage(const std::string& web_session_id,
120 const std::vector<uint8>& message, 121 const std::vector<uint8>& message,
121 const GURL& destination_url) = 0; 122 const GURL& destination_url) = 0;
122 123
123 virtual void OnSessionClosed(const std::string& web_session_id) = 0; 124 virtual void OnSessionClosed(const std::string& web_session_id) = 0;
124 125
125 virtual void OnSessionKeysChange(const std::string& web_session_id, 126 virtual void OnSessionKeysChange(
126 bool has_additional_usable_key) = 0; 127 const std::string& web_session_id,
128 bool has_additional_usable_key,
129 const CdmKeyInformationVector& key_information) = 0;
127 130
128 // Errors are not expected unless overridden. 131 // Errors are not expected unless overridden.
129 virtual void OnSessionError(const std::string& web_session_id, 132 virtual void OnSessionError(const std::string& web_session_id,
130 const std::string& error_name, 133 const std::string& error_name,
131 uint32 system_code, 134 uint32 system_code,
132 const std::string& error_message) { 135 const std::string& error_message) {
133 FAIL() << "Unexpected Key Error"; 136 FAIL() << "Unexpected Key Error";
134 } 137 }
135 138
136 virtual void OnEncryptedMediaInitData(const std::string& init_data_type, 139 virtual void OnEncryptedMediaInitData(const std::string& init_data_type,
(...skipping 18 matching lines...) Expand all
155 const std::vector<uint8>& message, 158 const std::vector<uint8>& message,
156 const GURL& destination_url) { 159 const GURL& destination_url) {
157 app_->OnSessionMessage(web_session_id, message, destination_url); 160 app_->OnSessionMessage(web_session_id, message, destination_url);
158 } 161 }
159 162
160 void OnSessionClosed(const std::string& web_session_id) { 163 void OnSessionClosed(const std::string& web_session_id) {
161 app_->OnSessionClosed(web_session_id); 164 app_->OnSessionClosed(web_session_id);
162 } 165 }
163 166
164 void OnSessionKeysChange(const std::string& web_session_id, 167 void OnSessionKeysChange(const std::string& web_session_id,
165 bool has_additional_usable_key) { 168 bool has_additional_usable_key,
166 app_->OnSessionKeysChange(web_session_id, has_additional_usable_key); 169 const CdmKeyInformationVector& key_information) {
170 app_->OnSessionKeysChange(web_session_id, has_additional_usable_key,
171 key_information);
167 } 172 }
168 173
169 void OnSessionError(const std::string& web_session_id, 174 void OnSessionError(const std::string& web_session_id,
170 const std::string& error_name, 175 const std::string& error_name,
171 uint32 system_code, 176 uint32 system_code,
172 const std::string& error_message) { 177 const std::string& error_message) {
173 app_->OnSessionError( 178 app_->OnSessionError(
174 web_session_id, error_name, system_code, error_message); 179 web_session_id, error_name, system_code, error_message);
175 } 180 }
176 181
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 const GURL& destination_url) override { 255 const GURL& destination_url) override {
251 EXPECT_FALSE(web_session_id.empty()); 256 EXPECT_FALSE(web_session_id.empty());
252 EXPECT_FALSE(message.empty()); 257 EXPECT_FALSE(message.empty());
253 EXPECT_EQ(current_session_id_, web_session_id); 258 EXPECT_EQ(current_session_id_, web_session_id);
254 } 259 }
255 260
256 void OnSessionClosed(const std::string& web_session_id) override { 261 void OnSessionClosed(const std::string& web_session_id) override {
257 EXPECT_EQ(current_session_id_, web_session_id); 262 EXPECT_EQ(current_session_id_, web_session_id);
258 } 263 }
259 264
260 void OnSessionKeysChange(const std::string& web_session_id, 265 void OnSessionKeysChange(
261 bool has_additional_usable_key) override { 266 const std::string& web_session_id,
267 bool has_additional_usable_key,
268 const CdmKeyInformationVector& key_information) override {
262 EXPECT_EQ(current_session_id_, web_session_id); 269 EXPECT_EQ(current_session_id_, web_session_id);
263 EXPECT_EQ(has_additional_usable_key, true); 270 EXPECT_EQ(has_additional_usable_key, true);
264 } 271 }
265 272
266 void OnEncryptedMediaInitData(const std::string& init_data_type, 273 void OnEncryptedMediaInitData(const std::string& init_data_type,
267 const std::vector<uint8>& init_data, 274 const std::vector<uint8>& init_data,
268 AesDecryptor* decryptor) override { 275 AesDecryptor* decryptor) override {
269 if (current_session_id_.empty()) { 276 if (current_session_id_.empty()) {
270 decryptor->CreateSession(init_data_type, kInitData, arraysize(kInitData), 277 decryptor->CreateSession(init_data_type, kInitData, arraysize(kInitData),
271 MediaKeys::TEMPORARY_SESSION, 278 MediaKeys::TEMPORARY_SESSION,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 EXPECT_FALSE(web_session_id.empty()); 382 EXPECT_FALSE(web_session_id.empty());
376 EXPECT_FALSE(message.empty()); 383 EXPECT_FALSE(message.empty());
377 FAIL() << "Unexpected Message"; 384 FAIL() << "Unexpected Message";
378 } 385 }
379 386
380 void OnSessionClosed(const std::string& web_session_id) override { 387 void OnSessionClosed(const std::string& web_session_id) override {
381 EXPECT_FALSE(web_session_id.empty()); 388 EXPECT_FALSE(web_session_id.empty());
382 FAIL() << "Unexpected Closed"; 389 FAIL() << "Unexpected Closed";
383 } 390 }
384 391
385 void OnSessionKeysChange(const std::string& web_session_id, 392 void OnSessionKeysChange(
386 bool has_additional_usable_key) override { 393 const std::string& web_session_id,
394 bool has_additional_usable_key,
395 const CdmKeyInformationVector& key_information) override {
387 EXPECT_FALSE(web_session_id.empty()); 396 EXPECT_FALSE(web_session_id.empty());
388 EXPECT_EQ(has_additional_usable_key, true); 397 EXPECT_EQ(has_additional_usable_key, true);
389 } 398 }
390 399
391 void OnEncryptedMediaInitData(const std::string& init_data_type, 400 void OnEncryptedMediaInitData(const std::string& init_data_type,
392 const std::vector<uint8>& init_data, 401 const std::vector<uint8>& init_data,
393 AesDecryptor* decryptor) override {} 402 AesDecryptor* decryptor) override {}
394 }; 403 };
395 404
396 // Helper class that emulates calls made on the ChunkDemuxer by the 405 // Helper class that emulates calls made on the ChunkDemuxer by the
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 1619
1611 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 1620 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
1612 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 1621 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
1613 Play(); 1622 Play();
1614 ASSERT_TRUE(WaitUntilOnEnded()); 1623 ASSERT_TRUE(WaitUntilOnEnded());
1615 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 1624 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
1616 demuxer_->GetStartTime()); 1625 demuxer_->GetStartTime());
1617 } 1626 }
1618 1627
1619 } // namespace media 1628 } // namespace media
OLDNEW
« media/mojo/services/media_type_converters.cc ('K') | « media/mojo/services/mojo_cdm_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698