Index: media/base/android/media_source_player_unittest.cc |
diff --git a/media/base/android/media_source_player_unittest.cc b/media/base/android/media_source_player_unittest.cc |
index e329ac6eee6dc529fc3f4f6f46c40146036f6f21..a5426815d5c9497b2cdc41211b3ad1c11fe5121e 100644 |
--- a/media/base/android/media_source_player_unittest.cc |
+++ b/media/base/android/media_source_player_unittest.cc |
@@ -167,6 +167,12 @@ class MediaSourcePlayerTest : public testing::Test { |
return player_.preroll_timestamp_; |
} |
+ // Inspect internal pending_event_ state of |player_|. This is for infrequent |
+ // use by tests, only where required. |
+ bool IsPendingSurfaceChange() { |
+ return player_.IsEventPending(player_.SURFACE_CHANGE_EVENT_PENDING); |
+ } |
+ |
DemuxerConfigs CreateAudioDemuxerConfigs() { |
DemuxerConfigs configs; |
configs.audio_codec = kCodecVorbis; |
@@ -1379,6 +1385,26 @@ TEST_F(MediaSourcePlayerTest, NewSurfaceWhileChangingConfigs) { |
EXPECT_EQ(0, demuxer_->num_seek_requests()); |
} |
+// TODO(xhwang): Once we add tests to cover DrmBridge, update this test to |
wolenetz
2013/10/31 20:34:25
From chat with qinmin@, MSP should be able to crea
wolenetz
2013/10/31 21:19:17
Actually, MSP::GetMediaCrypto() requires previous
|
+// also verify that the job is successfully created if SetDrmBridge(), Start() |
+// and eventually OnMediaCrypto() occur. This would increase test coverage of |
+// http://crbug.com/313470 and allow us to remove inspection of internal player |
+// pending event state. |
+TEST_F(MediaSourcePlayerTest, SurfaceChangeClearedEvenIfMediaCryptoAbsent) { |
+ SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); |
+ |
+ // Test that |SURFACE_CHANGE_EVENT_PENDING| is not pending after |
+ // SetVideoSurface() for a player configured for encrypted video, when the |
+ // player has not yet received media crypto. |
+ DemuxerConfigs configs = CreateVideoDemuxerConfigs(); |
+ configs.is_video_encrypted = true; |
+ |
+ player_.OnDemuxerConfigsAvailable(configs); |
+ CreateNextTextureAndSetVideoSurface(); |
+ EXPECT_FALSE(IsPendingSurfaceChange()); |
+ EXPECT_FALSE(GetMediaDecoderJob(false)); |
+} |
+ |
// TODO(xhwang): Enable this test when the test devices are updated. |
TEST_F(MediaSourcePlayerTest, DISABLED_IsTypeSupported_Widevine) { |
if (!MediaCodecBridge::IsAvailable() || !MediaDrmBridge::IsAvailable()) { |