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

Side by Side Diff: media/crypto/aes_decryptor_unittest.cc

Issue 11348365: Encrypted Media: Allows empty key message to be fired. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update doc Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « media/crypto/aes_decryptor.cc ('k') | ppapi/api/private/ppb_content_decryptor_private.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "media/base/decoder_buffer.h" 10 #include "media/base/decoder_buffer.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 309 }
310 310
311 MockDecryptorClient client_; 311 MockDecryptorClient client_;
312 AesDecryptor decryptor_; 312 AesDecryptor decryptor_;
313 std::string session_id_string_; 313 std::string session_id_string_;
314 AesDecryptor::DecryptCB decrypt_cb_; 314 AesDecryptor::DecryptCB decrypt_cb_;
315 std::vector<SubsampleEntry> subsample_entries_; 315 std::vector<SubsampleEntry> subsample_entries_;
316 }; 316 };
317 317
318 TEST_F(AesDecryptorTest, GenerateKeyRequestWithNullInitData) { 318 TEST_F(AesDecryptorTest, GenerateKeyRequestWithNullInitData) {
319 EXPECT_FALSE(decryptor_.GenerateKeyRequest(kClearKeySystem, "", NULL, 0)); 319 EXPECT_CALL(client_, KeyMessageMock(kClearKeySystem, StrNe(""),
320 IsNull(), 0, ""));
321 EXPECT_TRUE(decryptor_.GenerateKeyRequest(kClearKeySystem, "", NULL, 0));
320 } 322 }
321 323
322 TEST_F(AesDecryptorTest, NormalWebMDecryption) { 324 TEST_F(AesDecryptorTest, NormalWebMDecryption) {
323 const WebmEncryptedData& frame = kWebmEncryptedFrames[0]; 325 const WebmEncryptedData& frame = kWebmEncryptedFrames[0];
324 GenerateKeyRequest(frame.key_id, frame.key_id_size); 326 GenerateKeyRequest(frame.key_id, frame.key_id_size);
325 AddKeyAndExpectToSucceed(frame.key_id, frame.key_id_size, 327 AddKeyAndExpectToSucceed(frame.key_id, frame.key_id_size,
326 frame.key, frame.key_size); 328 frame.key, frame.key_size);
327 scoped_refptr<DecoderBuffer> encrypted_data = 329 scoped_refptr<DecoderBuffer> encrypted_data =
328 CreateWebMEncryptedBuffer(frame.encrypted_data, 330 CreateWebMEncryptedBuffer(frame.encrypted_data,
329 frame.encrypted_data_size, 331 frame.encrypted_data_size,
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 scoped_refptr<DecoderBuffer> encrypted_data = CreateSubsampleEncryptedBuffer( 588 scoped_refptr<DecoderBuffer> encrypted_data = CreateSubsampleEncryptedBuffer(
587 kSubsampleData, arraysize(kSubsampleData), 589 kSubsampleData, arraysize(kSubsampleData),
588 kSubsampleKeyId, arraysize(kSubsampleKeyId), 590 kSubsampleKeyId, arraysize(kSubsampleKeyId),
589 kSubsampleIv, arraysize(kSubsampleIv), 591 kSubsampleIv, arraysize(kSubsampleIv),
590 0, 592 0,
591 entries); 593 entries);
592 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail(encrypted_data)); 594 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail(encrypted_data));
593 } 595 }
594 596
595 } // namespace media 597 } // namespace media
OLDNEW
« no previous file with comments | « media/crypto/aes_decryptor.cc ('k') | ppapi/api/private/ppb_content_decryptor_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698