OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/cdm/aes_decryptor.h" | 5 #include "media/cdm/aes_decryptor.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 EmeInitDataType::WEBM, key_id, | 330 EmeInitDataType::WEBM, key_id, |
331 CreateSessionPromise(RESOLVED)); | 331 CreateSessionPromise(RESOLVED)); |
332 // This expects the promise to be called synchronously, which is the case | 332 // This expects the promise to be called synchronously, which is the case |
333 // for AesDecryptor. | 333 // for AesDecryptor. |
334 return session_id_; | 334 return session_id_; |
335 } | 335 } |
336 | 336 |
337 // Closes the session specified by |session_id|. | 337 // Closes the session specified by |session_id|. |
338 void CloseSession(const std::string& session_id) { | 338 void CloseSession(const std::string& session_id) { |
339 EXPECT_CALL(*this, OnSessionClosed(session_id)); | 339 EXPECT_CALL(*this, OnSessionClosed(session_id)); |
| 340 EXPECT_CALL(*this, OnSessionKeysChangeCalled(session_id, false)); |
340 cdm_->CloseSession(session_id, CreatePromise(RESOLVED)); | 341 cdm_->CloseSession(session_id, CreatePromise(RESOLVED)); |
341 } | 342 } |
342 | 343 |
343 // Removes the session specified by |session_id|. This should simply do a | 344 // Removes the session specified by |session_id|. This should simply do a |
344 // CloseSession(). | 345 // CloseSession(). |
345 // TODO(jrummell): Clean this up when the prefixed API is removed. | 346 // TODO(jrummell): Clean this up when the prefixed API is removed. |
346 // http://crbug.com/249976. | 347 // http://crbug.com/249976. |
347 void RemoveSession(const std::string& session_id) { | 348 void RemoveSession(const std::string& session_id) { |
348 if (GetParam() == "AesDecryptor") { | 349 if (GetParam() == "AesDecryptor") { |
349 EXPECT_CALL(*this, OnSessionClosed(session_id)); | 350 EXPECT_CALL(*this, OnSessionClosed(session_id)); |
| 351 EXPECT_CALL(*this, OnSessionKeysChangeCalled(session_id, false)); |
350 cdm_->RemoveSession(session_id, CreatePromise(RESOLVED)); | 352 cdm_->RemoveSession(session_id, CreatePromise(RESOLVED)); |
351 } else { | 353 } else { |
352 // CdmAdapter fails as only persistent sessions can be removed. | 354 // CdmAdapter fails as only persistent sessions can be removed. |
353 cdm_->RemoveSession(session_id, CreatePromise(REJECTED)); | 355 cdm_->RemoveSession(session_id, CreatePromise(REJECTED)); |
354 } | 356 } |
355 } | 357 } |
356 | 358 |
357 MOCK_METHOD2(OnSessionKeysChangeCalled, | 359 MOCK_METHOD2(OnSessionKeysChangeCalled, |
358 void(const std::string& session_id, | 360 void(const std::string& session_id, |
359 bool has_additional_usable_key)); | 361 bool has_additional_usable_key)); |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 INSTANTIATE_TEST_CASE_P(CdmAdapter, | 1023 INSTANTIATE_TEST_CASE_P(CdmAdapter, |
1022 AesDecryptorTest, | 1024 AesDecryptorTest, |
1023 testing::Values("CdmAdapter")); | 1025 testing::Values("CdmAdapter")); |
1024 #endif | 1026 #endif |
1025 | 1027 |
1026 // TODO(jrummell): Once MojoCdm/MojoCdmService/MojoDecryptor/ | 1028 // TODO(jrummell): Once MojoCdm/MojoCdmService/MojoDecryptor/ |
1027 // MojoDecryptorService are implemented, add a third version that tests the | 1029 // MojoDecryptorService are implemented, add a third version that tests the |
1028 // CDM via mojo. | 1030 // CDM via mojo. |
1029 | 1031 |
1030 } // namespace media | 1032 } // namespace media |
OLD | NEW |