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

Side by Side Diff: media/filters/decrypting_demuxer_stream_unittest.cc

Issue 1904213003: Convert //media/filters from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove include Created 4 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 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 21 matching lines...) Expand all
32 static const uint8_t kFakeKeyId[] = {0x4b, 0x65, 0x79, 0x20, 0x49, 0x44}; 32 static const uint8_t kFakeKeyId[] = {0x4b, 0x65, 0x79, 0x20, 0x49, 0x44};
33 static const uint8_t kFakeIv[DecryptConfig::kDecryptionKeySize] = {0}; 33 static const uint8_t kFakeIv[DecryptConfig::kDecryptionKeySize] = {0};
34 34
35 // Create a fake non-empty buffer in an encrypted stream. When |is_clear| is 35 // Create a fake non-empty buffer in an encrypted stream. When |is_clear| is
36 // true, the buffer is not encrypted (signaled by an empty IV). 36 // true, the buffer is not encrypted (signaled by an empty IV).
37 static scoped_refptr<DecoderBuffer> CreateFakeEncryptedStreamBuffer( 37 static scoped_refptr<DecoderBuffer> CreateFakeEncryptedStreamBuffer(
38 bool is_clear) { 38 bool is_clear) {
39 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(kFakeBufferSize)); 39 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(kFakeBufferSize));
40 std::string iv = is_clear ? std::string() : 40 std::string iv = is_clear ? std::string() :
41 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv)); 41 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv));
42 buffer->set_decrypt_config(scoped_ptr<DecryptConfig>(new DecryptConfig( 42 buffer->set_decrypt_config(std::unique_ptr<DecryptConfig>(
43 std::string(reinterpret_cast<const char*>(kFakeKeyId), 43 new DecryptConfig(std::string(reinterpret_cast<const char*>(kFakeKeyId),
44 arraysize(kFakeKeyId)), 44 arraysize(kFakeKeyId)),
45 iv, std::vector<SubsampleEntry>()))); 45 iv, std::vector<SubsampleEntry>())));
46 return buffer; 46 return buffer;
47 } 47 }
48 48
49 // Use anonymous namespace here to prevent the actions to be defined multiple 49 // Use anonymous namespace here to prevent the actions to be defined multiple
50 // times across multiple test files. Sadly we can't use static for them. 50 // times across multiple test files. Sadly we can't use static for them.
51 namespace { 51 namespace {
52 52
53 ACTION_P(ReturnBuffer, buffer) { 53 ACTION_P(ReturnBuffer, buffer) {
54 arg0.Run(buffer.get() ? DemuxerStream::kOk : DemuxerStream::kAborted, buffer); 54 arg0.Run(buffer.get() ? DemuxerStream::kOk : DemuxerStream::kAborted, buffer);
55 } 55 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 demuxer_stream_->Reset(NewExpectedClosure()); 248 demuxer_stream_->Reset(NewExpectedClosure());
249 message_loop_.RunUntilIdle(); 249 message_loop_.RunUntilIdle();
250 } 250 }
251 251
252 MOCK_METHOD2(BufferReady, void(DemuxerStream::Status, 252 MOCK_METHOD2(BufferReady, void(DemuxerStream::Status,
253 const scoped_refptr<DecoderBuffer>&)); 253 const scoped_refptr<DecoderBuffer>&));
254 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); 254 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void));
255 255
256 base::MessageLoop message_loop_; 256 base::MessageLoop message_loop_;
257 scoped_ptr<DecryptingDemuxerStream> demuxer_stream_; 257 std::unique_ptr<DecryptingDemuxerStream> demuxer_stream_;
258 scoped_ptr<StrictMock<MockCdmContext>> cdm_context_; 258 std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_;
259 scoped_ptr<StrictMock<MockDecryptor>> decryptor_; 259 std::unique_ptr<StrictMock<MockDecryptor>> decryptor_;
260 // Whether the |demuxer_stream_| is successfully initialized. 260 // Whether the |demuxer_stream_| is successfully initialized.
261 bool is_initialized_; 261 bool is_initialized_;
262 scoped_ptr<StrictMock<MockDemuxerStream> > input_audio_stream_; 262 std::unique_ptr<StrictMock<MockDemuxerStream>> input_audio_stream_;
263 scoped_ptr<StrictMock<MockDemuxerStream> > input_video_stream_; 263 std::unique_ptr<StrictMock<MockDemuxerStream>> input_video_stream_;
264 264
265 DemuxerStream::ReadCB pending_demuxer_read_cb_; 265 DemuxerStream::ReadCB pending_demuxer_read_cb_;
266 Decryptor::NewKeyCB key_added_cb_; 266 Decryptor::NewKeyCB key_added_cb_;
267 Decryptor::DecryptCB pending_decrypt_cb_; 267 Decryptor::DecryptCB pending_decrypt_cb_;
268 268
269 // Constant buffers to be returned by the input demuxer streams and the 269 // Constant buffers to be returned by the input demuxer streams and the
270 // |decryptor_|. 270 // |decryptor_|.
271 scoped_refptr<DecoderBuffer> clear_buffer_; 271 scoped_refptr<DecoderBuffer> clear_buffer_;
272 scoped_refptr<DecoderBuffer> encrypted_buffer_; 272 scoped_refptr<DecoderBuffer> encrypted_buffer_;
273 scoped_refptr<DecoderBuffer> decrypted_buffer_; 273 scoped_refptr<DecoderBuffer> decrypted_buffer_;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 } 519 }
520 520
521 // Test destruction after reset. 521 // Test destruction after reset.
522 TEST_F(DecryptingDemuxerStreamTest, Destroy_AfterReset) { 522 TEST_F(DecryptingDemuxerStreamTest, Destroy_AfterReset) {
523 Initialize(); 523 Initialize();
524 EnterNormalReadingState(); 524 EnterNormalReadingState();
525 Reset(); 525 Reset();
526 } 526 }
527 527
528 } // namespace media 528 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/decrypting_audio_decoder_unittest.cc ('k') | media/filters/decrypting_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698