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 "media/filters/pipeline_integration_test_base.h" | 5 #include "media/filters/pipeline_integration_test_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "media/base/decoder_buffer.h" | 8 #include "media/base/decoder_buffer.h" |
9 #include "media/base/decryptor_client.h" | 9 #include "media/base/decryptor_client.h" |
10 #include "media/base/test_data_util.h" | 10 #include "media/base/test_data_util.h" |
11 #include "media/crypto/aes_decryptor.h" | 11 #include "media/crypto/aes_decryptor.h" |
12 #include "media/filters/chunk_demuxer_client.h" | 12 #include "media/filters/chunk_demuxer_client.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 static const char kSourceId[] = "SourceId"; | 16 static const char kSourceId[] = "SourceId"; |
17 static const char kClearKeySystem[] = "org.w3.clearkey"; | 17 static const char kClearKeySystem[] = "org.w3.clearkey"; |
18 static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; | 18 static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; |
19 | 19 |
20 // Key used to encrypt video track in test file "bear-320x240-encrypted.webm". | 20 // Key used to encrypt video track in test file "bear-320x240-encrypted.webm". |
21 static const uint8 kSecretKey[] = { | 21 static const uint8 kSecretKey[] = { |
22 0xfb, 0x67, 0x8a, 0x91, 0x19, 0x12, 0x7b, 0x6b, | 22 0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b, |
23 0x0b, 0x63, 0x11, 0xf8, 0x6f, 0xe1, 0xc4, 0x2d | 23 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c |
24 }; | 24 }; |
25 | 25 |
26 // Helper class that emulates calls made on the ChunkDemuxer by the | 26 // Helper class that emulates calls made on the ChunkDemuxer by the |
27 // Media Source API. | 27 // Media Source API. |
28 class MockMediaSource : public ChunkDemuxerClient { | 28 class MockMediaSource : public ChunkDemuxerClient { |
29 public: | 29 public: |
30 MockMediaSource(const std::string& filename, int initial_append_size, | 30 MockMediaSource(const std::string& filename, int initial_append_size, |
31 bool has_audio, bool has_video) | 31 bool has_audio, bool has_video) |
32 : url_(GetTestDataURL(filename)), | 32 : url_(GetTestDataURL(filename)), |
33 current_position_(0), | 33 current_position_(0), |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 Stop(); | 283 Stop(); |
284 } | 284 } |
285 | 285 |
286 TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) { | 286 TEST_F(PipelineIntegrationTest, BasicPlayback_16x9AspectRatio) { |
287 ASSERT_TRUE(Start(GetTestDataURL("bear-320x240-16x9-aspect.webm"), | 287 ASSERT_TRUE(Start(GetTestDataURL("bear-320x240-16x9-aspect.webm"), |
288 PIPELINE_OK)); | 288 PIPELINE_OK)); |
289 Play(); | 289 Play(); |
290 ASSERT_TRUE(WaitUntilOnEnded()); | 290 ASSERT_TRUE(WaitUntilOnEnded()); |
291 } | 291 } |
292 | 292 |
293 // TODO(fgalligan): Enable test when encrypted test data is updated and new | 293 TEST_F(PipelineIntegrationTest, EncryptedPlayback) { |
294 // decryption code is landed. http://crbug.com/132801 | 294 MockMediaSource source("bear-320x240-encrypted.webm", 220788, true, true); |
295 TEST_F(PipelineIntegrationTest, DISABLED_EncryptedPlayback) { | |
296 MockMediaSource source("bear-320x240-encrypted.webm", 220730, true, true); | |
297 FakeDecryptorClient encrypted_media; | 295 FakeDecryptorClient encrypted_media; |
298 StartPipelineWithEncryptedMedia(&source, &encrypted_media); | 296 StartPipelineWithEncryptedMedia(&source, &encrypted_media); |
299 | 297 |
300 source.EndOfStream(); | 298 source.EndOfStream(); |
301 ASSERT_EQ(PIPELINE_OK, pipeline_status_); | 299 ASSERT_EQ(PIPELINE_OK, pipeline_status_); |
302 | 300 |
303 Play(); | 301 Play(); |
304 | 302 |
305 ASSERT_TRUE(WaitUntilOnEnded()); | 303 ASSERT_TRUE(WaitUntilOnEnded()); |
306 source.Abort(); | 304 source.Abort(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 359 |
362 // Verify video decoder & renderer can handle aborted demuxer reads. | 360 // Verify video decoder & renderer can handle aborted demuxer reads. |
363 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { | 361 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { |
364 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", 32768, | 362 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", 32768, |
365 base::TimeDelta::FromMilliseconds(200), | 363 base::TimeDelta::FromMilliseconds(200), |
366 base::TimeDelta::FromMilliseconds(1668), | 364 base::TimeDelta::FromMilliseconds(1668), |
367 0x1C896, 65536, false, true)); | 365 0x1C896, 65536, false, true)); |
368 } | 366 } |
369 | 367 |
370 } // namespace media | 368 } // namespace media |
OLD | NEW |