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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/stl_util.h" | |
10 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
11 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
12 #include "build/build_config.h" | 11 #include "build/build_config.h" |
13 #include "media/base/cdm_callback_promise.h" | 12 #include "media/base/cdm_callback_promise.h" |
14 #include "media/base/cdm_context.h" | 13 #include "media/base/cdm_context.h" |
15 #include "media/base/cdm_key_information.h" | 14 #include "media/base/cdm_key_information.h" |
16 #include "media/base/decoder_buffer.h" | 15 #include "media/base/decoder_buffer.h" |
17 #include "media/base/media.h" | 16 #include "media/base/media.h" |
18 #include "media/base/media_keys.h" | 17 #include "media/base/media_keys.h" |
19 #include "media/base/media_switches.h" | 18 #include "media/base/media_switches.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 EXPECT_TRUE(ExtractKeyIdsFromKeyIdsInitData(message_string, &key_ids, | 329 EXPECT_TRUE(ExtractKeyIdsFromKeyIdsInitData(message_string, &key_ids, |
331 &error_message)) | 330 &error_message)) |
332 << error_message; | 331 << error_message; |
333 EXPECT_EQ(1u, key_ids.size()); | 332 EXPECT_EQ(1u, key_ids.size()); |
334 | 333 |
335 // Determine the key that matches the key ID |key_ids[0]|. | 334 // Determine the key that matches the key ID |key_ids[0]|. |
336 std::vector<uint8_t> key; | 335 std::vector<uint8_t> key; |
337 EXPECT_TRUE(LookupKey(key_ids[0], &key)); | 336 EXPECT_TRUE(LookupKey(key_ids[0], &key)); |
338 | 337 |
339 // Update the session with the key ID and key. | 338 // Update the session with the key ID and key. |
340 std::string jwk = | 339 std::string jwk = GenerateJWKSet(key.data(), key.size(), key_ids[0].data(), |
341 GenerateJWKSet(vector_as_array(&key), key.size(), | 340 key_ids[0].size()); |
342 vector_as_array(&key_ids[0]), key_ids[0].size()); | |
343 decryptor->UpdateSession(session_id, | 341 decryptor->UpdateSession(session_id, |
344 std::vector<uint8_t>(jwk.begin(), jwk.end()), | 342 std::vector<uint8_t>(jwk.begin(), jwk.end()), |
345 CreatePromise(RESOLVED)); | 343 CreatePromise(RESOLVED)); |
346 } | 344 } |
347 | 345 |
348 void OnSessionClosed(const std::string& session_id) override { | 346 void OnSessionClosed(const std::string& session_id) override { |
349 EXPECT_EQ(current_session_id_, session_id); | 347 EXPECT_EQ(current_session_id_, session_id); |
350 } | 348 } |
351 | 349 |
352 void OnSessionKeysChange(const std::string& session_id, | 350 void OnSessionKeysChange(const std::string& session_id, |
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 | 1832 |
1835 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 1833 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
1836 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 1834 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
1837 Play(); | 1835 Play(); |
1838 ASSERT_TRUE(WaitUntilOnEnded()); | 1836 ASSERT_TRUE(WaitUntilOnEnded()); |
1839 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 1837 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
1840 demuxer_->GetStartTime()); | 1838 demuxer_->GetStartTime()); |
1841 } | 1839 } |
1842 | 1840 |
1843 } // namespace media | 1841 } // namespace media |
OLD | NEW |