OLD | NEW |
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/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 0, | 40 0, |
41 std::vector<SubsampleEntry>()))); | 41 std::vector<SubsampleEntry>()))); |
42 return buffer; | 42 return buffer; |
43 } | 43 } |
44 | 44 |
45 // Use anonymous namespace here to prevent the actions to be defined multiple | 45 // Use anonymous namespace here to prevent the actions to be defined multiple |
46 // times across multiple test files. Sadly we can't use static for them. | 46 // times across multiple test files. Sadly we can't use static for them. |
47 namespace { | 47 namespace { |
48 | 48 |
49 ACTION_P(ReturnBuffer, buffer) { | 49 ACTION_P(ReturnBuffer, buffer) { |
50 arg0.Run(buffer ? DemuxerStream::kOk : DemuxerStream::kAborted, buffer); | 50 arg0.Run(buffer.get() ? DemuxerStream::kOk : DemuxerStream::kAborted, buffer); |
51 } | 51 } |
52 | 52 |
53 ACTION_P(RunCallbackIfNotNull, param) { | 53 ACTION_P(RunCallbackIfNotNull, param) { |
54 if (!arg0.is_null()) | 54 if (!arg0.is_null()) |
55 arg0.Run(param); | 55 arg0.Run(param); |
56 } | 56 } |
57 | 57 |
58 ACTION_P2(ResetAndRunCallback, callback, param) { | 58 ACTION_P2(ResetAndRunCallback, callback, param) { |
59 base::ResetAndReturn(callback).Run(param); | 59 base::ResetAndReturn(callback).Run(param); |
60 } | 60 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 void Reinitialize() { | 109 void Reinitialize() { |
110 EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kVideo)); | 110 EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kVideo)); |
111 InitializeAndExpectStatus(TestVideoConfig::LargeEncrypted(), PIPELINE_OK); | 111 InitializeAndExpectStatus(TestVideoConfig::LargeEncrypted(), PIPELINE_OK); |
112 } | 112 } |
113 | 113 |
114 void ReadAndExpectFrameReadyWith( | 114 void ReadAndExpectFrameReadyWith( |
115 VideoDecoder::Status status, | 115 VideoDecoder::Status status, |
116 const scoped_refptr<VideoFrame>& video_frame) { | 116 const scoped_refptr<VideoFrame>& video_frame) { |
117 if (status != VideoDecoder::kOk) | 117 if (status != VideoDecoder::kOk) |
118 EXPECT_CALL(*this, FrameReady(status, IsNull())); | 118 EXPECT_CALL(*this, FrameReady(status, IsNull())); |
119 else if (video_frame && video_frame->IsEndOfStream()) | 119 else if (video_frame.get() && video_frame->IsEndOfStream()) |
120 EXPECT_CALL(*this, FrameReady(status, IsEndOfStream())); | 120 EXPECT_CALL(*this, FrameReady(status, IsEndOfStream())); |
121 else | 121 else |
122 EXPECT_CALL(*this, FrameReady(status, video_frame)); | 122 EXPECT_CALL(*this, FrameReady(status, video_frame)); |
123 | 123 |
124 decoder_->Read(base::Bind(&DecryptingVideoDecoderTest::FrameReady, | 124 decoder_->Read(base::Bind(&DecryptingVideoDecoderTest::FrameReady, |
125 base::Unretained(this))); | 125 base::Unretained(this))); |
126 message_loop_.RunUntilIdle(); | 126 message_loop_.RunUntilIdle(); |
127 } | 127 } |
128 | 128 |
129 // Sets up expectations and actions to put DecryptingVideoDecoder in an | 129 // Sets up expectations and actions to put DecryptingVideoDecoder in an |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 572 |
573 // Test stopping after the decoder has been stopped. | 573 // Test stopping after the decoder has been stopped. |
574 TEST_F(DecryptingVideoDecoderTest, Stop_AfterStop) { | 574 TEST_F(DecryptingVideoDecoderTest, Stop_AfterStop) { |
575 Initialize(); | 575 Initialize(); |
576 EnterNormalDecodingState(); | 576 EnterNormalDecodingState(); |
577 Stop(); | 577 Stop(); |
578 Stop(); | 578 Stop(); |
579 } | 579 } |
580 | 580 |
581 } // namespace media | 581 } // namespace media |
OLD | NEW |