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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "media/base/decoder_buffer.h" | 12 #include "media/base/decoder_buffer.h" |
13 #include "media/base/media_keys.h" | 13 #include "media/base/media_keys.h" |
14 #include "media/base/media_switches.h" | 14 #include "media/base/media_switches.h" |
15 #include "media/base/test_data_util.h" | 15 #include "media/base/test_data_util.h" |
16 #include "media/cdm/aes_decryptor.h" | 16 #include "media/cdm/aes_decryptor.h" |
| 17 #include "media/cdm/json_web_key.h" |
17 #include "media/filters/chunk_demuxer.h" | 18 #include "media/filters/chunk_demuxer.h" |
18 | 19 |
19 using testing::AnyNumber; | 20 using testing::AnyNumber; |
20 using testing::AtMost; | 21 using testing::AtMost; |
21 | 22 |
22 namespace media { | 23 namespace media { |
23 | 24 |
24 const char kSourceId[] = "SourceId"; | 25 const char kSourceId[] = "SourceId"; |
25 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; | 26 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; |
26 | 27 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Clear Key really needs the key ID in |init_data|. For WebM, they are the | 183 // Clear Key really needs the key ID in |init_data|. For WebM, they are the |
183 // same, but this is not the case for ISO CENC. Therefore, provide the | 184 // same, but this is not the case for ISO CENC. Therefore, provide the |
184 // correct key ID. | 185 // correct key ID. |
185 const uint8* key_id = init_data.empty() ? NULL : &init_data[0]; | 186 const uint8* key_id = init_data.empty() ? NULL : &init_data[0]; |
186 size_t key_id_length = init_data.size(); | 187 size_t key_id_length = init_data.size(); |
187 if (type == kMP4AudioType || type == kMP4VideoType) { | 188 if (type == kMP4AudioType || type == kMP4VideoType) { |
188 key_id = kKeyId; | 189 key_id = kKeyId; |
189 key_id_length = arraysize(kKeyId); | 190 key_id_length = arraysize(kKeyId); |
190 } | 191 } |
191 | 192 |
| 193 // Convert key into a JSON structure and then add it. |
| 194 std::string jwk = GenerateJWKSet( |
| 195 kSecretKey, arraysize(kSecretKey), key_id, key_id_length); |
192 decryptor->AddKey(current_reference_id_, | 196 decryptor->AddKey(current_reference_id_, |
193 kSecretKey, arraysize(kSecretKey), | 197 reinterpret_cast<const uint8*>(jwk.data()), jwk.size(), |
194 key_id, key_id_length); | 198 NULL, 0); |
195 } | 199 } |
196 | 200 |
197 uint32 current_reference_id_; | 201 uint32 current_reference_id_; |
198 }; | 202 }; |
199 | 203 |
200 // Ignores needkey and does not perform a license request | 204 // Ignores needkey and does not perform a license request |
201 class NoResponseApp : public FakeEncryptedMedia::AppBase { | 205 class NoResponseApp : public FakeEncryptedMedia::AppBase { |
202 public: | 206 public: |
203 virtual void KeyAdded(uint32 reference_id) OVERRIDE { | 207 virtual void KeyAdded(uint32 reference_id) OVERRIDE { |
204 EXPECT_GT(reference_id, 0u); | 208 EXPECT_GT(reference_id, 0u); |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 // Verify that VP8 video with inband text track can be played back. | 1085 // Verify that VP8 video with inband text track can be played back. |
1082 TEST_F(PipelineIntegrationTest, | 1086 TEST_F(PipelineIntegrationTest, |
1083 BasicPlayback_VP8_WebVTT_WebM) { | 1087 BasicPlayback_VP8_WebVTT_WebM) { |
1084 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), | 1088 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), |
1085 PIPELINE_OK)); | 1089 PIPELINE_OK)); |
1086 Play(); | 1090 Play(); |
1087 ASSERT_TRUE(WaitUntilOnEnded()); | 1091 ASSERT_TRUE(WaitUntilOnEnded()); |
1088 } | 1092 } |
1089 | 1093 |
1090 } // namespace media | 1094 } // namespace media |
OLD | NEW |