| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 294 } |
| 295 | 295 |
| 296 scoped_ptr<SimpleCdmPromise> CreatePromise(ExpectedResult expected_result) { | 296 scoped_ptr<SimpleCdmPromise> CreatePromise(ExpectedResult expected_result) { |
| 297 scoped_ptr<SimpleCdmPromise> promise( | 297 scoped_ptr<SimpleCdmPromise> promise( |
| 298 new CdmCallbackPromise<>(base::Bind(&AesDecryptorTest::OnResolve, | 298 new CdmCallbackPromise<>(base::Bind(&AesDecryptorTest::OnResolve, |
| 299 base::Unretained(this), | 299 base::Unretained(this), |
| 300 expected_result), | 300 expected_result), |
| 301 base::Bind(&AesDecryptorTest::OnReject, | 301 base::Bind(&AesDecryptorTest::OnReject, |
| 302 base::Unretained(this), | 302 base::Unretained(this), |
| 303 expected_result))); | 303 expected_result))); |
| 304 return promise.Pass(); | 304 return promise; |
| 305 } | 305 } |
| 306 | 306 |
| 307 scoped_ptr<NewSessionCdmPromise> CreateSessionPromise( | 307 scoped_ptr<NewSessionCdmPromise> CreateSessionPromise( |
| 308 ExpectedResult expected_result) { | 308 ExpectedResult expected_result) { |
| 309 scoped_ptr<NewSessionCdmPromise> promise( | 309 scoped_ptr<NewSessionCdmPromise> promise( |
| 310 new CdmCallbackPromise<std::string>( | 310 new CdmCallbackPromise<std::string>( |
| 311 base::Bind(&AesDecryptorTest::OnResolveWithSession, | 311 base::Bind(&AesDecryptorTest::OnResolveWithSession, |
| 312 base::Unretained(this), | 312 base::Unretained(this), |
| 313 expected_result), | 313 expected_result), |
| 314 base::Bind(&AesDecryptorTest::OnReject, | 314 base::Bind(&AesDecryptorTest::OnReject, |
| 315 base::Unretained(this), | 315 base::Unretained(this), |
| 316 expected_result))); | 316 expected_result))); |
| 317 return promise.Pass(); | 317 return promise; |
| 318 } | 318 } |
| 319 | 319 |
| 320 // Creates a new session using |key_id|. Returns the session ID. | 320 // Creates a new session using |key_id|. Returns the session ID. |
| 321 std::string CreateSession(const std::vector<uint8_t>& key_id) { | 321 std::string CreateSession(const std::vector<uint8_t>& key_id) { |
| 322 DCHECK(!key_id.empty()); | 322 DCHECK(!key_id.empty()); |
| 323 EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsJSONDictionary(), | 323 EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), _, IsJSONDictionary(), |
| 324 GURL::EmptyGURL())); | 324 GURL::EmptyGURL())); |
| 325 cdm_->CreateSessionAndGenerateRequest(MediaKeys::TEMPORARY_SESSION, | 325 cdm_->CreateSessionAndGenerateRequest(MediaKeys::TEMPORARY_SESSION, |
| 326 EmeInitDataType::WEBM, key_id, | 326 EmeInitDataType::WEBM, key_id, |
| 327 CreateSessionPromise(RESOLVED)); | 327 CreateSessionPromise(RESOLVED)); |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 INSTANTIATE_TEST_CASE_P(CdmAdapter, | 1012 INSTANTIATE_TEST_CASE_P(CdmAdapter, |
| 1013 AesDecryptorTest, | 1013 AesDecryptorTest, |
| 1014 testing::Values("CdmAdapter")); | 1014 testing::Values("CdmAdapter")); |
| 1015 #endif | 1015 #endif |
| 1016 | 1016 |
| 1017 // TODO(jrummell): Once MojoCdm/MojoCdmService/MojoDecryptor/ | 1017 // TODO(jrummell): Once MojoCdm/MojoCdmService/MojoDecryptor/ |
| 1018 // MojoDecryptorService are implemented, add a third version that tests the | 1018 // MojoDecryptorService are implemented, add a third version that tests the |
| 1019 // CDM via mojo. | 1019 // CDM via mojo. |
| 1020 | 1020 |
| 1021 } // namespace media | 1021 } // namespace media |
| OLD | NEW |