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

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

Issue 2255943002: EME: Remove obsolete legacy APIs related to versions of prefixed EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build and add bug reference for obsoletes Created 4 years, 4 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 class FakeEncryptedMedia { 201 class FakeEncryptedMedia {
202 public: 202 public:
203 // Defines the behavior of the "app" that responds to EME events. 203 // Defines the behavior of the "app" that responds to EME events.
204 class AppBase { 204 class AppBase {
205 public: 205 public:
206 virtual ~AppBase() {} 206 virtual ~AppBase() {}
207 207
208 virtual void OnSessionMessage(const std::string& session_id, 208 virtual void OnSessionMessage(const std::string& session_id,
209 MediaKeys::MessageType message_type, 209 MediaKeys::MessageType message_type,
210 const std::vector<uint8_t>& message, 210 const std::vector<uint8_t>& message,
211 const GURL& legacy_destination_url,
212 AesDecryptor* decryptor) = 0; 211 AesDecryptor* decryptor) = 0;
213 212
214 virtual void OnSessionClosed(const std::string& session_id) = 0; 213 virtual void OnSessionClosed(const std::string& session_id) = 0;
215 214
216 virtual void OnSessionKeysChange(const std::string& session_id, 215 virtual void OnSessionKeysChange(const std::string& session_id,
217 bool has_additional_usable_key, 216 bool has_additional_usable_key,
218 CdmKeysInfo keys_info) = 0; 217 CdmKeysInfo keys_info) = 0;
219 218
220 // Errors are not expected unless overridden.
221 virtual void OnLegacySessionError(const std::string& session_id,
222 const std::string& error_name,
223 uint32_t system_code,
224 const std::string& error_message) {
225 FAIL() << "Unexpected Key Error";
226 }
227
228 virtual void OnEncryptedMediaInitData(EmeInitDataType init_data_type, 219 virtual void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
229 const std::vector<uint8_t>& init_data, 220 const std::vector<uint8_t>& init_data,
230 AesDecryptor* decryptor) = 0; 221 AesDecryptor* decryptor) = 0;
231 }; 222 };
232 223
233 FakeEncryptedMedia(AppBase* app) 224 FakeEncryptedMedia(AppBase* app)
234 : decryptor_(new AesDecryptor( 225 : decryptor_(new AesDecryptor(
235 GURL::EmptyGURL(), 226 GURL::EmptyGURL(),
236 base::Bind(&FakeEncryptedMedia::OnSessionMessage, 227 base::Bind(&FakeEncryptedMedia::OnSessionMessage,
237 base::Unretained(this)), 228 base::Unretained(this)),
238 base::Bind(&FakeEncryptedMedia::OnSessionClosed, 229 base::Bind(&FakeEncryptedMedia::OnSessionClosed,
239 base::Unretained(this)), 230 base::Unretained(this)),
240 base::Bind(&FakeEncryptedMedia::OnSessionKeysChange, 231 base::Bind(&FakeEncryptedMedia::OnSessionKeysChange,
241 base::Unretained(this)))), 232 base::Unretained(this)))),
242 cdm_context_(decryptor_.get()), 233 cdm_context_(decryptor_.get()),
243 app_(app) {} 234 app_(app) {}
244 235
245 CdmContext* GetCdmContext() { return &cdm_context_; } 236 CdmContext* GetCdmContext() { return &cdm_context_; }
246 237
247 // Callbacks for firing session events. Delegate to |app_|. 238 // Callbacks for firing session events. Delegate to |app_|.
248 void OnSessionMessage(const std::string& session_id, 239 void OnSessionMessage(const std::string& session_id,
249 MediaKeys::MessageType message_type, 240 MediaKeys::MessageType message_type,
250 const std::vector<uint8_t>& message, 241 const std::vector<uint8_t>& message) {
251 const GURL& legacy_destination_url) { 242 app_->OnSessionMessage(session_id, message_type, message, decryptor_.get());
252 app_->OnSessionMessage(session_id, message_type, message,
253 legacy_destination_url, decryptor_.get());
254 } 243 }
255 244
256 void OnSessionClosed(const std::string& session_id) { 245 void OnSessionClosed(const std::string& session_id) {
257 app_->OnSessionClosed(session_id); 246 app_->OnSessionClosed(session_id);
258 } 247 }
259 248
260 void OnSessionKeysChange(const std::string& session_id, 249 void OnSessionKeysChange(const std::string& session_id,
261 bool has_additional_usable_key, 250 bool has_additional_usable_key,
262 CdmKeysInfo keys_info) { 251 CdmKeysInfo keys_info) {
263 app_->OnSessionKeysChange(session_id, has_additional_usable_key, 252 app_->OnSessionKeysChange(session_id, has_additional_usable_key,
264 std::move(keys_info)); 253 std::move(keys_info));
265 } 254 }
266 255
267 void OnLegacySessionError(const std::string& session_id,
268 const std::string& error_name,
269 uint32_t system_code,
270 const std::string& error_message) {
271 app_->OnLegacySessionError(session_id, error_name, system_code,
272 error_message);
273 }
274
275 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, 256 void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
276 const std::vector<uint8_t>& init_data) { 257 const std::vector<uint8_t>& init_data) {
277 app_->OnEncryptedMediaInitData(init_data_type, init_data, decryptor_.get()); 258 app_->OnEncryptedMediaInitData(init_data_type, init_data, decryptor_.get());
278 } 259 }
279 260
280 private: 261 private:
281 class TestCdmContext : public CdmContext { 262 class TestCdmContext : public CdmContext {
282 public: 263 public:
283 TestCdmContext(Decryptor* decryptor) : decryptor_(decryptor) {} 264 TestCdmContext(Decryptor* decryptor) : decryptor_(decryptor) {}
284 265
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 base::Bind(&KeyProvidingApp::OnResolveWithSession, 315 base::Bind(&KeyProvidingApp::OnResolveWithSession,
335 base::Unretained(this), expected), 316 base::Unretained(this), expected),
336 base::Bind(&KeyProvidingApp::OnReject, base::Unretained(this), 317 base::Bind(&KeyProvidingApp::OnReject, base::Unretained(this),
337 expected))); 318 expected)));
338 return promise; 319 return promise;
339 } 320 }
340 321
341 void OnSessionMessage(const std::string& session_id, 322 void OnSessionMessage(const std::string& session_id,
342 MediaKeys::MessageType message_type, 323 MediaKeys::MessageType message_type,
343 const std::vector<uint8_t>& message, 324 const std::vector<uint8_t>& message,
344 const GURL& legacy_destination_url,
345 AesDecryptor* decryptor) override { 325 AesDecryptor* decryptor) override {
346 EXPECT_FALSE(session_id.empty()); 326 EXPECT_FALSE(session_id.empty());
347 EXPECT_FALSE(message.empty()); 327 EXPECT_FALSE(message.empty());
348 EXPECT_EQ(current_session_id_, session_id); 328 EXPECT_EQ(current_session_id_, session_id);
349 EXPECT_EQ(MediaKeys::MessageType::LICENSE_REQUEST, message_type); 329 EXPECT_EQ(MediaKeys::MessageType::LICENSE_REQUEST, message_type);
350 330
351 // Extract the key ID from |message|. For Clear Key this is a JSON object 331 // Extract the key ID from |message|. For Clear Key this is a JSON object
352 // containing a set of "kids". There should only be 1 key ID in |message|. 332 // containing a set of "kids". There should only be 1 key ID in |message|.
353 std::string message_string(message.begin(), message.end()); 333 std::string message_string(message.begin(), message.end());
354 KeyIdList key_ids; 334 KeyIdList key_ids;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 436
457 uint32_t num_distinct_need_key_calls_; 437 uint32_t num_distinct_need_key_calls_;
458 }; 438 };
459 439
460 // Ignores the encrypted event and does not perform a license request. 440 // Ignores the encrypted event and does not perform a license request.
461 class NoResponseApp : public FakeEncryptedMedia::AppBase { 441 class NoResponseApp : public FakeEncryptedMedia::AppBase {
462 public: 442 public:
463 void OnSessionMessage(const std::string& session_id, 443 void OnSessionMessage(const std::string& session_id,
464 MediaKeys::MessageType message_type, 444 MediaKeys::MessageType message_type,
465 const std::vector<uint8_t>& message, 445 const std::vector<uint8_t>& message,
466 const GURL& legacy_destination_url,
467 AesDecryptor* decryptor) override { 446 AesDecryptor* decryptor) override {
468 EXPECT_FALSE(session_id.empty()); 447 EXPECT_FALSE(session_id.empty());
469 EXPECT_FALSE(message.empty()); 448 EXPECT_FALSE(message.empty());
470 FAIL() << "Unexpected Message"; 449 FAIL() << "Unexpected Message";
471 } 450 }
472 451
473 void OnSessionClosed(const std::string& session_id) override { 452 void OnSessionClosed(const std::string& session_id) override {
474 EXPECT_FALSE(session_id.empty()); 453 EXPECT_FALSE(session_id.empty());
475 FAIL() << "Unexpected Closed"; 454 FAIL() << "Unexpected Closed";
476 } 455 }
(...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after
2398 2377
2399 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2378 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2400 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2379 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2401 Play(); 2380 Play();
2402 ASSERT_TRUE(WaitUntilOnEnded()); 2381 ASSERT_TRUE(WaitUntilOnEnded());
2403 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2382 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2404 demuxer_->GetStartTime()); 2383 demuxer_->GetStartTime());
2405 } 2384 }
2406 2385
2407 } // namespace media 2386 } // namespace media
OLDNEW
« media/cdm/ppapi/ppapi_cdm_adapter.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