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

Unified Diff: media/filters/video_frame_stream_unittest.cc

Issue 416333011: Allow setContentDecryptionModule() to get called when setting is done. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + android tweaks Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/video_decoder_selector_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_frame_stream_unittest.cc
diff --git a/media/filters/video_frame_stream_unittest.cc b/media/filters/video_frame_stream_unittest.cc
index 492e7cf9ffbb50e3b17f6fdfa28e7c46940a5fa5..96848e42cd5f56aac7c2d975a96e21a1fb4a84c8 100644
--- a/media/filters/video_frame_stream_unittest.cc
+++ b/media/filters/video_frame_stream_unittest.cc
@@ -17,6 +17,7 @@ using ::testing::_;
using ::testing::AnyNumber;
using ::testing::Assign;
using ::testing::Invoke;
+using ::testing::InvokeWithoutArgs;
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::SaveArg;
@@ -24,6 +25,22 @@ using ::testing::SaveArg;
static const int kNumConfigs = 3;
static const int kNumBuffersInOneConfig = 5;
+// Use anonymous namespace here to prevent the actions to be defined multiple
+// times across multiple test files. Sadly we can't use static for them.
+namespace {
+
+ACTION_P3(ExecuteCallbackWithVerifier, decryptor, done_cb, verifier) {
+ // verifier must be called first since |done_cb| call will invoke it as well.
+ verifier->RecordACalled();
+ arg0.Run(decryptor, done_cb);
+}
+
+ACTION_P(ReportCallback, verifier) {
+ verifier->RecordBCalled();
+}
+
+} // namespace
+
namespace media {
struct VideoFrameStreamTestParams {
@@ -93,6 +110,7 @@ class VideoFrameStreamTest
MOCK_METHOD1(OnNewSpliceBuffer, void(base::TimeDelta));
MOCK_METHOD1(SetDecryptorReadyCallback, void(const media::DecryptorReadyCB&));
+ MOCK_METHOD1(DecryptorSet, void(bool));
void OnStatistics(const PipelineStatistics& statistics) {
total_bytes_decoded_ += statistics.video_bytes_decoded;
@@ -197,6 +215,17 @@ class VideoFrameStreamTest
DECODER_RESET
};
+ void ExpectDecryptorNotification() {
+ EXPECT_CALL(*this, SetDecryptorReadyCallback(_))
+ .WillRepeatedly(ExecuteCallbackWithVerifier(
+ decryptor_.get(),
+ base::Bind(&VideoFrameStreamTest::DecryptorSet,
+ base::Unretained(this)),
+ &verifier_));
+ EXPECT_CALL(*this, DecryptorSet(true))
+ .WillRepeatedly(ReportCallback(&verifier_));
+ }
+
void EnterPendingState(PendingState state) {
DCHECK_NE(state, NOT_PENDING);
switch (state) {
@@ -219,15 +248,13 @@ class VideoFrameStreamTest
break;
case DECRYPTOR_NO_KEY:
- EXPECT_CALL(*this, SetDecryptorReadyCallback(_))
- .WillRepeatedly(RunCallback<0>(decryptor_.get()));
+ ExpectDecryptorNotification();
has_no_key_ = true;
ReadOneFrame();
break;
case DECODER_INIT:
- EXPECT_CALL(*this, SetDecryptorReadyCallback(_))
- .WillRepeatedly(RunCallback<0>(decryptor_.get()));
+ ExpectDecryptorNotification();
decoder_->HoldNextInit();
InitializeVideoFrameStream();
break;
@@ -332,6 +359,8 @@ class VideoFrameStreamTest
// Decryptor has no key to decrypt a frame.
bool has_no_key_;
+ CallbackPairChecker verifier_;
+
private:
DISALLOW_COPY_AND_ASSIGN(VideoFrameStreamTest);
};
« no previous file with comments | « media/filters/video_decoder_selector_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698