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 "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "media/base/decoder_buffer.h" | 9 #include "media/base/decoder_buffer.h" |
10 #include "media/base/decryptor_client.h" | |
11 #include "media/base/test_data_util.h" | 10 #include "media/base/test_data_util.h" |
12 #include "media/crypto/aes_decryptor.h" | 11 #include "media/crypto/aes_decryptor.h" |
13 | 12 |
14 using testing::AtMost; | 13 using testing::AtMost; |
15 | 14 |
16 namespace media { | 15 namespace media { |
17 | 16 |
18 static const char kSourceId[] = "SourceId"; | 17 static const char kSourceId[] = "SourceId"; |
19 static const char kClearKeySystem[] = "org.w3.clearkey"; | 18 static const char kClearKeySystem[] = "org.w3.clearkey"; |
20 static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; | 19 static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 size_t quote1 = mimetype_.find("\""); | 113 size_t quote1 = mimetype_.find("\""); |
115 size_t quote2 = mimetype_.find("\"", quote1 + 1); | 114 size_t quote2 = mimetype_.find("\"", quote1 + 1); |
116 std::string codecStr = mimetype_.substr(quote1 + 1, quote2 - quote1 - 1); | 115 std::string codecStr = mimetype_.substr(quote1 + 1, quote2 - quote1 - 1); |
117 std::vector<std::string> codecs; | 116 std::vector<std::string> codecs; |
118 Tokenize(codecStr, ",", &codecs); | 117 Tokenize(codecStr, ",", &codecs); |
119 | 118 |
120 CHECK_EQ(chunk_demuxer_->AddId(kSourceId, type, codecs), ChunkDemuxer::kOk); | 119 CHECK_EQ(chunk_demuxer_->AddId(kSourceId, type, codecs), ChunkDemuxer::kOk); |
121 AppendData(initial_append_size_); | 120 AppendData(initial_append_size_); |
122 } | 121 } |
123 | 122 |
| 123 MOCK_METHOD5(NeedKeyMock, void(const std::string& key_system, |
| 124 const std::string& session_id, |
| 125 const std::string& type, |
| 126 const uint8* init_data, |
| 127 int init_data_length)); |
| 128 void NeedKey(const std::string& key_system, |
| 129 const std::string& session_id, |
| 130 const std::string& type, |
| 131 scoped_array<uint8> init_data, int init_data_length) { |
| 132 NeedKeyMock(key_system, session_id, type, |
| 133 init_data.get(), init_data_length); |
| 134 } |
| 135 |
124 void DemuxerNeedKey(const std::string& type, | 136 void DemuxerNeedKey(const std::string& type, |
125 scoped_array<uint8> init_data, int init_data_size) { | 137 scoped_array<uint8> init_data, int init_data_size) { |
126 DCHECK(init_data.get()); | 138 DCHECK(init_data.get()); |
127 DCHECK_GT(init_data_size, 0); | 139 DCHECK_GT(init_data_size, 0); |
128 DCHECK(decryptor_client_); | 140 DCHECK(decryptor_client_); |
129 decryptor_client_->NeedKey("", "", type, init_data.Pass(), init_data_size); | 141 decryptor_client_->NeedKey("", "", type, init_data.Pass(), init_data_size); |
130 } | 142 } |
131 | 143 |
132 private: | 144 private: |
133 FilePath file_path_; | 145 FilePath file_path_; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // Verify video decoder & renderer can handle aborted demuxer reads. | 453 // Verify video decoder & renderer can handle aborted demuxer reads. |
442 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { | 454 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { |
443 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, | 455 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, |
444 32768, | 456 32768, |
445 base::TimeDelta::FromMilliseconds(200), | 457 base::TimeDelta::FromMilliseconds(200), |
446 base::TimeDelta::FromMilliseconds(1668), | 458 base::TimeDelta::FromMilliseconds(1668), |
447 0x1C896, 65536)); | 459 0x1C896, 65536)); |
448 } | 460 } |
449 | 461 |
450 } // namespace media | 462 } // namespace media |
OLD | NEW |