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

Unified Diff: media/filters/video_decoder_selector_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/pipeline_integration_test_base.cc ('k') | media/filters/video_frame_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_decoder_selector_unittest.cc
diff --git a/media/filters/video_decoder_selector_unittest.cc b/media/filters/video_decoder_selector_unittest.cc
index 57760b5e065439d48cceec13a57eff5ff4236df1..fdbcaaa0bcaa6893f798bb2b73cb31b08f3d023a 100644
--- a/media/filters/video_decoder_selector_unittest.cc
+++ b/media/filters/video_decoder_selector_unittest.cc
@@ -20,6 +20,22 @@ using ::testing::NotNull;
using ::testing::Return;
using ::testing::StrictMock;
+// 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 {
class VideoDecoderSelectorTest : public ::testing::Test {
@@ -51,6 +67,7 @@ class VideoDecoderSelectorTest : public ::testing::Test {
MOCK_METHOD1(SetDecryptorReadyCallback, void(const media::DecryptorReadyCB&));
MOCK_METHOD2(OnDecoderSelected,
void(VideoDecoder*, DecryptingDemuxerStream*));
+ MOCK_METHOD1(DecryptorSet, void(bool));
void MockOnDecoderSelected(
scoped_ptr<VideoDecoder> decoder,
@@ -80,7 +97,13 @@ class VideoDecoderSelectorTest : public ::testing::Test {
if (decryptor_capability == kDecryptOnly ||
decryptor_capability == kDecryptAndDecode) {
EXPECT_CALL(*this, SetDecryptorReadyCallback(_))
- .WillRepeatedly(RunCallback<0>(decryptor_.get()));
+ .WillRepeatedly(ExecuteCallbackWithVerifier(
+ decryptor_.get(),
+ base::Bind(&VideoDecoderSelectorTest::DecryptorSet,
+ base::Unretained(this)),
+ &verifier_));
+ EXPECT_CALL(*this, DecryptorSet(true))
+ .WillRepeatedly(ReportCallback(&verifier_));
if (decryptor_capability == kDecryptOnly) {
EXPECT_CALL(*decryptor_, InitializeVideoDecoder(_, _))
@@ -145,6 +168,8 @@ class VideoDecoderSelectorTest : public ::testing::Test {
base::MessageLoop message_loop_;
+ CallbackPairChecker verifier_;
+
private:
DISALLOW_COPY_AND_ASSIGN(VideoDecoderSelectorTest);
};
« no previous file with comments | « media/filters/pipeline_integration_test_base.cc ('k') | media/filters/video_frame_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698