Commit c03ce23c authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Commit Bot

media: clang format on decrypting decoders and demuxer streams

Clang-format only. No functionality or code change.

TBR=jrummell@chromium.org

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I7fada73aca62544a47e41401c3812768f3db4f7a
Reviewed-on: https://chromium-review.googlesource.com/1077623
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562992}
parent 5af8e7eb
......@@ -141,10 +141,9 @@ void DecryptingAudioDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
void DecryptingAudioDecoder::Reset(const base::Closure& closure) {
DVLOG(2) << "Reset() - state: " << state_;
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == kIdle ||
state_ == kPendingDecode ||
state_ == kWaitingForKey ||
state_ == kDecodeFinished) << state_;
DCHECK(state_ == kIdle || state_ == kPendingDecode ||
state_ == kWaitingForKey || state_ == kDecodeFinished)
<< state_;
DCHECK(init_cb_.is_null()); // No Reset() during pending initialization.
DCHECK(reset_cb_.is_null());
......@@ -194,9 +193,8 @@ DecryptingAudioDecoder::~DecryptingAudioDecoder() {
void DecryptingAudioDecoder::InitializeDecoder() {
state_ = kPendingDecoderInit;
decryptor_->InitializeAudioDecoder(
config_,
BindToCurrentLoop(base::Bind(
&DecryptingAudioDecoder::FinishInitialization, weak_this_)));
config_, BindToCurrentLoop(base::Bind(
&DecryptingAudioDecoder::FinishInitialization, weak_this_)));
}
void DecryptingAudioDecoder::FinishInitialization(bool success) {
......@@ -204,12 +202,12 @@ void DecryptingAudioDecoder::FinishInitialization(bool success) {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == kPendingDecoderInit) << state_;
DCHECK(!init_cb_.is_null());
DCHECK(reset_cb_.is_null()); // No Reset() before initialization finished.
DCHECK(reset_cb_.is_null()); // No Reset() before initialization finished.
DCHECK(decode_cb_.is_null()); // No Decode() before initialization finished.
if (!success) {
MEDIA_LOG(DEBUG, media_log_) << GetDisplayName()
<< ": failed to init decoder on decryptor";
MEDIA_LOG(DEBUG, media_log_)
<< GetDisplayName() << ": failed to init decoder on decryptor";
base::ResetAndReturn(&init_cb_).Run(false);
decryptor_ = NULL;
state_ = kError;
......@@ -221,9 +219,8 @@ void DecryptingAudioDecoder::FinishInitialization(bool success) {
new AudioTimestampHelper(config_.samples_per_second()));
decryptor_->RegisterNewKeyCB(
Decryptor::kAudio,
BindToCurrentLoop(
base::Bind(&DecryptingAudioDecoder::OnKeyAdded, weak_this_)));
Decryptor::kAudio, BindToCurrentLoop(base::Bind(
&DecryptingAudioDecoder::OnKeyAdded, weak_this_)));
state_ = kIdle;
base::ResetAndReturn(&init_cb_).Run(true);
......@@ -240,8 +237,8 @@ void DecryptingAudioDecoder::DecodePendingBuffer() {
decryptor_->DecryptAndDecodeAudio(
pending_buffer_to_decode_,
BindToCurrentLoop(base::Bind(
&DecryptingAudioDecoder::DeliverFrame, weak_this_, buffer_size)));
BindToCurrentLoop(base::Bind(&DecryptingAudioDecoder::DeliverFrame,
weak_this_, buffer_size)));
}
void DecryptingAudioDecoder::DeliverFrame(
......@@ -271,7 +268,7 @@ void DecryptingAudioDecoder::DeliverFrame(
if (status == Decryptor::kError) {
DVLOG(2) << "DeliverFrame() - kError";
MEDIA_LOG(ERROR, media_log_) << GetDisplayName() << ": decode error";
state_ = kDecodeFinished; // TODO add kError state
state_ = kDecodeFinished; // TODO add kError state
base::ResetAndReturn(&decode_cb_).Run(DecodeStatus::DECODE_ERROR);
return;
}
......@@ -281,8 +278,8 @@ void DecryptingAudioDecoder::DeliverFrame(
scoped_pending_buffer_to_decode->decrypt_config()->key_id();
std::string missing_key_id = base::HexEncode(key_id.data(), key_id.size());
DVLOG(1) << "DeliverFrame() - no key for key ID " << missing_key_id;
MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no key for key ID "
<< missing_key_id;
MEDIA_LOG(DEBUG, media_log_)
<< GetDisplayName() << ": no key for key ID " << missing_key_id;
// Set |pending_buffer_to_decode_| back as we need to try decoding the
// pending buffer again when new key is added to the decryptor.
......@@ -290,8 +287,8 @@ void DecryptingAudioDecoder::DeliverFrame(
if (need_to_try_again_if_nokey_is_returned) {
// The |state_| is still kPendingDecode.
MEDIA_LOG(INFO, media_log_) << GetDisplayName()
<< ": key was added, resuming decode";
MEDIA_LOG(INFO, media_log_)
<< GetDisplayName() << ": key was added, resuming decode";
DecodePendingBuffer();
return;
}
......@@ -334,8 +331,8 @@ void DecryptingAudioDecoder::OnKeyAdded() {
}
if (state_ == kWaitingForKey) {
MEDIA_LOG(INFO, media_log_) << GetDisplayName()
<< ": key added, resuming decode";
MEDIA_LOG(INFO, media_log_)
<< GetDisplayName() << ": key added, resuming decode";
state_ = kPendingDecode;
DecodePendingBuffer();
}
......@@ -352,8 +349,7 @@ void DecryptingAudioDecoder::DoReset() {
void DecryptingAudioDecoder::ProcessDecodedFrames(
const Decryptor::AudioFrames& frames) {
for (Decryptor::AudioFrames::const_iterator iter = frames.begin();
iter != frames.end();
++iter) {
iter != frames.end(); ++iter) {
scoped_refptr<AudioBuffer> frame = *iter;
DCHECK(!frame->end_of_stream()) << "EOS frame returned.";
......
......@@ -111,16 +111,14 @@ class DecryptingAudioDecoderTest : public testing::Test {
InitializeAndExpectResult(config_, true);
}
void Reinitialize() {
ReinitializeConfigChange(config_);
}
void Reinitialize() { ReinitializeConfigChange(config_); }
void ReinitializeConfigChange(const AudioDecoderConfig& new_config) {
EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kAudio));
EXPECT_CALL(*decryptor_, InitializeAudioDecoder(_, _))
.WillOnce(RunCallback<1>(true));
EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kAudio, _))
.WillOnce(SaveArg<1>(&key_added_cb_));
.WillOnce(SaveArg<1>(&key_added_cb_));
decoder_->Initialize(
new_config, cdm_context_.get(), NewExpectedBoolCB(true),
base::Bind(&DecryptingAudioDecoderTest::FrameReady,
......@@ -133,9 +131,8 @@ class DecryptingAudioDecoderTest : public testing::Test {
void DecodeAndExpect(scoped_refptr<DecoderBuffer> buffer,
DecodeStatus status) {
EXPECT_CALL(*this, DecodeDone(status));
decoder_->Decode(buffer,
base::Bind(&DecryptingAudioDecoderTest::DecodeDone,
base::Unretained(this)));
decoder_->Decode(buffer, base::Bind(&DecryptingAudioDecoderTest::DecodeDone,
base::Unretained(this)));
base::RunLoop().RunUntilIdle();
}
......@@ -161,8 +158,9 @@ class DecryptingAudioDecoderTest : public testing::Test {
// Sets up expectations and actions to put DecryptingAudioDecoder in an
// active normal decoding state.
void EnterNormalDecodingState() {
EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _)).WillRepeatedly(
Invoke(this, &DecryptingAudioDecoderTest::DecryptAndDecodeAudio));
EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _))
.WillRepeatedly(
Invoke(this, &DecryptingAudioDecoderTest::DecryptAndDecodeAudio));
EXPECT_CALL(*this, FrameReady(decoded_frame_));
for (int i = 0; i < kDecodingDelay + 1; ++i)
DecodeAndExpect(encrypted_buffer_, DecodeStatus::OK);
......@@ -173,8 +171,7 @@ class DecryptingAudioDecoderTest : public testing::Test {
// EnterNormalDecodingState() to work.
void EnterEndOfStreamState() {
// The codec in the |decryptor_| will be flushed.
EXPECT_CALL(*this, FrameReady(decoded_frame_))
.Times(kDecodingDelay);
EXPECT_CALL(*this, FrameReady(decoded_frame_)).Times(kDecodingDelay);
DecodeAndExpect(DecoderBuffer::CreateEOSBuffer(), DecodeStatus::OK);
EXPECT_EQ(0, num_frames_in_decryptor_);
}
......@@ -196,8 +193,8 @@ class DecryptingAudioDecoderTest : public testing::Test {
void EnterWaitingForKeyState() {
EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(encrypted_buffer_, _))
.WillRepeatedly(RunCallback<1>(Decryptor::kNoKey,
Decryptor::AudioFrames()));
.WillRepeatedly(
RunCallback<1>(Decryptor::kNoKey, Decryptor::AudioFrames()));
EXPECT_CALL(*this, OnWaitingForDecryptionKey());
decoder_->Decode(encrypted_buffer_,
base::Bind(&DecryptingAudioDecoderTest::DecodeDone,
......@@ -208,8 +205,8 @@ class DecryptingAudioDecoderTest : public testing::Test {
void AbortPendingAudioDecodeCB() {
if (!pending_audio_decode_cb_.is_null()) {
base::ResetAndReturn(&pending_audio_decode_cb_).Run(
Decryptor::kSuccess, Decryptor::AudioFrames());
base::ResetAndReturn(&pending_audio_decode_cb_)
.Run(Decryptor::kSuccess, Decryptor::AudioFrames());
}
}
......@@ -315,8 +312,8 @@ TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_DecodeError) {
Initialize();
EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _))
.WillRepeatedly(RunCallback<1>(Decryptor::kError,
Decryptor::AudioFrames()));
.WillRepeatedly(
RunCallback<1>(Decryptor::kError, Decryptor::AudioFrames()));
DecodeAndExpect(encrypted_buffer_, DecodeStatus::DECODE_ERROR);
}
......@@ -423,8 +420,8 @@ TEST_F(DecryptingAudioDecoderTest, KeyAdded_DruingPendingDecode) {
// The audio decode callback is returned after the correct decryption key is
// added.
key_added_cb_.Run();
base::ResetAndReturn(&pending_audio_decode_cb_).Run(
Decryptor::kNoKey, Decryptor::AudioFrames());
base::ResetAndReturn(&pending_audio_decode_cb_)
.Run(Decryptor::kNoKey, Decryptor::AudioFrames());
base::RunLoop().RunUntilIdle();
}
......
......@@ -235,8 +235,7 @@ void DecryptingDemuxerStream::DecryptPendingBuffer() {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, kPendingDecrypt) << state_;
decryptor_->Decrypt(
GetDecryptorStreamType(),
pending_buffer_to_decrypt_,
GetDecryptorStreamType(), pending_buffer_to_decrypt_,
BindToCurrentLoop(
base::Bind(&DecryptingDemuxerStream::DeliverBuffer, weak_this_)));
}
......@@ -276,13 +275,13 @@ void DecryptingDemuxerStream::DeliverBuffer(
std::string key_id = pending_buffer_to_decrypt_->decrypt_config()->key_id();
std::string missing_key_id = base::HexEncode(key_id.data(), key_id.size());
DVLOG(1) << "DeliverBuffer() - no key for key ID " << missing_key_id;
MEDIA_LOG(INFO, media_log_) << GetDisplayName() << ": no key for key ID "
<< missing_key_id;
MEDIA_LOG(INFO, media_log_)
<< GetDisplayName() << ": no key for key ID " << missing_key_id;
if (need_to_try_again_if_nokey) {
// The |state_| is still kPendingDecrypt.
MEDIA_LOG(INFO, media_log_) << GetDisplayName()
<< ": key was added, resuming decrypt";
MEDIA_LOG(INFO, media_log_)
<< GetDisplayName() << ": key was added, resuming decrypt";
DecryptPendingBuffer();
return;
}
......
......@@ -41,8 +41,10 @@ static const uint8_t kFakeIv[DecryptConfig::kDecryptionKeySize] = {0};
static scoped_refptr<DecoderBuffer> CreateFakeEncryptedStreamBuffer(
bool is_clear) {
scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(kFakeBufferSize));
std::string iv = is_clear ? std::string() :
std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv));
std::string iv = is_clear
? std::string()
: std::string(reinterpret_cast<const char*>(kFakeIv),
arraysize(kFakeIv));
if (!is_clear) {
buffer->set_decrypt_config(DecryptConfig::CreateCencConfig(
std::string(reinterpret_cast<const char*>(kFakeKeyId),
......@@ -227,8 +229,8 @@ class DecryptingDemuxerStreamTest : public testing::Test {
EXPECT_CALL(*input_audio_stream_, Read(_))
.WillRepeatedly(ReturnBuffer(encrypted_buffer_));
EXPECT_CALL(*decryptor_, Decrypt(_, encrypted_buffer_, _))
.WillRepeatedly(RunCallback<2>(Decryptor::kNoKey,
scoped_refptr<DecoderBuffer>()));
.WillRepeatedly(
RunCallback<2>(Decryptor::kNoKey, scoped_refptr<DecoderBuffer>()));
EXPECT_MEDIA_LOG(HasSubstr("DecryptingDemuxerStream: no key for key ID"));
EXPECT_CALL(*this, OnWaitingForDecryptionKey());
demuxer_stream_->Read(base::Bind(&DecryptingDemuxerStreamTest::BufferReady,
......@@ -343,8 +345,8 @@ TEST_F(DecryptingDemuxerStreamTest, Read_DecryptError) {
EXPECT_CALL(*input_audio_stream_, Read(_))
.WillRepeatedly(ReturnBuffer(encrypted_buffer_));
EXPECT_CALL(*decryptor_, Decrypt(_, encrypted_buffer_, _))
.WillRepeatedly(RunCallback<2>(Decryptor::kError,
scoped_refptr<DecoderBuffer>()));
.WillRepeatedly(
RunCallback<2>(Decryptor::kError, scoped_refptr<DecoderBuffer>()));
EXPECT_MEDIA_LOG(HasSubstr("DecryptingDemuxerStream: decrypt error"));
ReadAndExpectBufferReadyWith(DemuxerStream::kError, nullptr);
}
......
......@@ -47,9 +47,9 @@ void DecryptingVideoDecoder::Initialize(
DVLOG(2) << __func__ << ": " << config.AsHumanReadableString();
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == kUninitialized ||
state_ == kIdle ||
state_ == kDecodeFinished) << state_;
DCHECK(state_ == kUninitialized || state_ == kIdle ||
state_ == kDecodeFinished)
<< state_;
DCHECK(decode_cb_.is_null());
DCHECK(reset_cb_.is_null());
DCHECK(config.IsValidConfig());
......@@ -102,9 +102,8 @@ void DecryptingVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
const DecodeCB& decode_cb) {
DVLOG(3) << "Decode()";
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == kIdle ||
state_ == kDecodeFinished ||
state_ == kError) << state_;
DCHECK(state_ == kIdle || state_ == kDecodeFinished || state_ == kError)
<< state_;
DCHECK(!decode_cb.is_null());
CHECK(decode_cb_.is_null()) << "Overlapping decodes are not supported.";
......@@ -129,11 +128,10 @@ void DecryptingVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
void DecryptingVideoDecoder::Reset(const base::Closure& closure) {
DVLOG(2) << "Reset() - state: " << state_;
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == kIdle ||
state_ == kPendingDecode ||
state_ == kWaitingForKey ||
state_ == kDecodeFinished ||
state_ == kError) << state_;
DCHECK(state_ == kIdle || state_ == kPendingDecode ||
state_ == kWaitingForKey || state_ == kDecodeFinished ||
state_ == kError)
<< state_;
DCHECK(init_cb_.is_null()); // No Reset() during pending initialization.
DCHECK(reset_cb_.is_null());
......@@ -184,12 +182,12 @@ void DecryptingVideoDecoder::FinishInitialization(bool success) {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, kPendingDecoderInit) << state_;
DCHECK(!init_cb_.is_null());
DCHECK(reset_cb_.is_null()); // No Reset() before initialization finished.
DCHECK(reset_cb_.is_null()); // No Reset() before initialization finished.
DCHECK(decode_cb_.is_null()); // No Decode() before initialization finished.
if (!success) {
MEDIA_LOG(DEBUG, media_log_) << GetDisplayName()
<< ": failed to init decoder on decryptor";
MEDIA_LOG(DEBUG, media_log_)
<< GetDisplayName() << ": failed to init decoder on decryptor";
base::ResetAndReturn(&init_cb_).Run(false);
decryptor_ = NULL;
state_ = kError;
......@@ -197,16 +195,14 @@ void DecryptingVideoDecoder::FinishInitialization(bool success) {
}
decryptor_->RegisterNewKeyCB(
Decryptor::kVideo,
BindToCurrentLoop(
base::Bind(&DecryptingVideoDecoder::OnKeyAdded, weak_this_)));
Decryptor::kVideo, BindToCurrentLoop(base::Bind(
&DecryptingVideoDecoder::OnKeyAdded, weak_this_)));
// Success!
state_ = kIdle;
base::ResetAndReturn(&init_cb_).Run(true);
}
void DecryptingVideoDecoder::DecodePendingBuffer() {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, kPendingDecode) << state_;
......@@ -219,8 +215,9 @@ void DecryptingVideoDecoder::DecodePendingBuffer() {
}
decryptor_->DecryptAndDecodeVideo(
pending_buffer_to_decode_, BindToCurrentLoop(base::Bind(
&DecryptingVideoDecoder::DeliverFrame, weak_this_, buffer_size)));
pending_buffer_to_decode_,
BindToCurrentLoop(base::Bind(&DecryptingVideoDecoder::DeliverFrame,
weak_this_, buffer_size)));
}
void DecryptingVideoDecoder::DeliverFrame(
......@@ -233,9 +230,9 @@ void DecryptingVideoDecoder::DeliverFrame(
DCHECK(!decode_cb_.is_null());
DCHECK(pending_buffer_to_decode_.get());
TRACE_EVENT_ASYNC_END2(
"media", "DecryptingVideoDecoder::DecodePendingBuffer", trace_id_,
"buffer_size", buffer_size, "status", status);
TRACE_EVENT_ASYNC_END2("media", "DecryptingVideoDecoder::DecodePendingBuffer",
trace_id_, "buffer_size", buffer_size, "status",
status);
bool need_to_try_again_if_nokey_is_returned = key_added_while_decode_pending_;
key_added_while_decode_pending_ = false;
......@@ -264,8 +261,8 @@ void DecryptingVideoDecoder::DeliverFrame(
scoped_pending_buffer_to_decode->decrypt_config()->key_id();
std::string missing_key_id = base::HexEncode(key_id.data(), key_id.size());
DVLOG(1) << "DeliverFrame() - no key for key ID " << missing_key_id;
MEDIA_LOG(INFO, media_log_) << GetDisplayName() << ": no key for key ID "
<< missing_key_id;
MEDIA_LOG(INFO, media_log_)
<< GetDisplayName() << ": no key for key ID " << missing_key_id;
// Set |pending_buffer_to_decode_| back as we need to try decoding the
// pending buffer again when new key is added to the decryptor.
......@@ -273,8 +270,8 @@ void DecryptingVideoDecoder::DeliverFrame(
if (need_to_try_again_if_nokey_is_returned) {
// The |state_| is still kPendingDecode.
MEDIA_LOG(INFO, media_log_) << GetDisplayName()
<< ": key was added, resuming decode";
MEDIA_LOG(INFO, media_log_)
<< GetDisplayName() << ": key was added, resuming decode";
DecodePendingBuffer();
return;
}
......@@ -331,8 +328,8 @@ void DecryptingVideoDecoder::OnKeyAdded() {
}
if (state_ == kWaitingForKey) {
MEDIA_LOG(INFO, media_log_) << GetDisplayName()
<< ": key added, resuming decode";
MEDIA_LOG(INFO, media_log_)
<< GetDisplayName() << ": key added, resuming decode";
state_ = kPendingDecode;
DecodePendingBuffer();
}
......
......@@ -108,9 +108,8 @@ class DecryptingVideoDecoderTest : public testing::Test {
void DecodeAndExpect(scoped_refptr<DecoderBuffer> buffer,
DecodeStatus status) {
EXPECT_CALL(*this, DecodeDone(status));
decoder_->Decode(buffer,
base::Bind(&DecryptingVideoDecoderTest::DecodeDone,
base::Unretained(this)));
decoder_->Decode(buffer, base::Bind(&DecryptingVideoDecoderTest::DecodeDone,
base::Unretained(this)));
base::RunLoop().RunUntilIdle();
}
......@@ -136,8 +135,9 @@ class DecryptingVideoDecoderTest : public testing::Test {
// Sets up expectations and actions to put DecryptingVideoDecoder in an
// active normal decoding state.
void EnterNormalDecodingState() {
EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _)).WillRepeatedly(
Invoke(this, &DecryptingVideoDecoderTest::DecryptAndDecodeVideo));
EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
.WillRepeatedly(
Invoke(this, &DecryptingVideoDecoderTest::DecryptAndDecodeVideo));
EXPECT_CALL(*this, FrameReady(decoded_video_frame_));
for (int i = 0; i < kDecodingDelay + 1; ++i)
DecodeAndExpect(encrypted_buffer_, DecodeStatus::OK);
......@@ -148,8 +148,7 @@ class DecryptingVideoDecoderTest : public testing::Test {
// EnterNormalDecodingState() to work.
void EnterEndOfStreamState() {
// The codec in the |decryptor_| will be flushed.
EXPECT_CALL(*this, FrameReady(decoded_video_frame_))
.Times(kDecodingDelay);
EXPECT_CALL(*this, FrameReady(decoded_video_frame_)).Times(kDecodingDelay);
DecodeAndExpect(DecoderBuffer::CreateEOSBuffer(), DecodeStatus::OK);
EXPECT_EQ(0, num_frames_in_decryptor_);
}
......@@ -181,8 +180,8 @@ class DecryptingVideoDecoderTest : public testing::Test {
void AbortPendingVideoDecodeCB() {
if (!pending_video_decode_cb_.is_null()) {
base::ResetAndReturn(&pending_video_decode_cb_).Run(
Decryptor::kSuccess, scoped_refptr<VideoFrame>(NULL));
base::ResetAndReturn(&pending_video_decode_cb_)
.Run(Decryptor::kSuccess, scoped_refptr<VideoFrame>(NULL));
}
}
......@@ -299,8 +298,8 @@ TEST_F(DecryptingVideoDecoderTest, DecryptAndDecode_DecodeError) {
Initialize();
EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
.WillRepeatedly(RunCallback<1>(Decryptor::kError,
scoped_refptr<VideoFrame>(NULL)));
.WillRepeatedly(
RunCallback<1>(Decryptor::kError, scoped_refptr<VideoFrame>(NULL)));
DecodeAndExpect(encrypted_buffer_, DecodeStatus::DECODE_ERROR);
......@@ -322,8 +321,8 @@ TEST_F(DecryptingVideoDecoderTest, KeyAdded_DuringWaitingForKey) {
EnterWaitingForKeyState();
EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
.WillRepeatedly(RunCallback<1>(Decryptor::kSuccess,
decoded_video_frame_));
.WillRepeatedly(
RunCallback<1>(Decryptor::kSuccess, decoded_video_frame_));
EXPECT_CALL(*this, FrameReady(decoded_video_frame_));
EXPECT_CALL(*this, DecodeDone(DecodeStatus::OK));
key_added_cb_.Run();
......@@ -337,15 +336,15 @@ TEST_F(DecryptingVideoDecoderTest, KeyAdded_DuringPendingDecode) {
EnterPendingDecodeState();
EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
.WillRepeatedly(RunCallback<1>(Decryptor::kSuccess,
decoded_video_frame_));
.WillRepeatedly(
RunCallback<1>(Decryptor::kSuccess, decoded_video_frame_));
EXPECT_CALL(*this, FrameReady(decoded_video_frame_));
EXPECT_CALL(*this, DecodeDone(DecodeStatus::OK));
// The video decode callback is returned after the correct decryption key is
// added.
key_added_cb_.Run();
base::ResetAndReturn(&pending_video_decode_cb_).Run(Decryptor::kNoKey,
null_video_frame_);
base::ResetAndReturn(&pending_video_decode_cb_)
.Run(Decryptor::kNoKey, null_video_frame_);
base::RunLoop().RunUntilIdle();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment