Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1196)

Side by Side Diff: media/cdm/aes_decryptor_unittest.cc

Issue 1888603002: Add CdmFileIOProvider interface for use by cdm_adapter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/debug/leak_annotations.h" 11 #include "base/debug/leak_annotations.h"
12 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "media/base/cdm_callback_promise.h" 15 #include "media/base/cdm_callback_promise.h"
16 #include "media/base/cdm_config.h" 16 #include "media/base/cdm_config.h"
17 #include "media/base/cdm_key_information.h" 17 #include "media/base/cdm_key_information.h"
18 #include "media/base/decoder_buffer.h" 18 #include "media/base/decoder_buffer.h"
19 #include "media/base/decrypt_config.h" 19 #include "media/base/decrypt_config.h"
20 #include "media/base/decryptor.h" 20 #include "media/base/decryptor.h"
21 #include "media/base/mock_filters.h" 21 #include "media/base/mock_filters.h"
22 #include "media/cdm/aes_decryptor.h" 22 #include "media/cdm/aes_decryptor.h"
23 #include "media/cdm/api/content_decryption_module.h" 23 #include "media/cdm/api/content_decryption_module.h"
24 #include "media/cdm/cdm_adapter.h" 24 #include "media/cdm/cdm_adapter.h"
25 #include "media/cdm/external_clear_key_test_helper.h" 25 #include "media/cdm/external_clear_key_test_helper.h"
26 #include "media/cdm/simple_cdm_allocator.h" 26 #include "media/cdm/simple_cdm_allocator.h"
27 #include "media/cdm/simple_cdm_file_io_provider.h"
27 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
28 #include "testing/gtest/include/gtest/gtest-param-test.h" 29 #include "testing/gtest/include/gtest/gtest-param-test.h"
29 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
30 #include "url/gurl.h" 31 #include "url/gurl.h"
31 32
32 using ::testing::_; 33 using ::testing::_;
33 using ::testing::Gt; 34 using ::testing::Gt;
34 using ::testing::IsNull; 35 using ::testing::IsNull;
35 using ::testing::NotNull; 36 using ::testing::NotNull;
36 using ::testing::SaveArg; 37 using ::testing::SaveArg;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 base::Bind(&AesDecryptorTest::OnSessionClosed, 240 base::Bind(&AesDecryptorTest::OnSessionClosed,
240 base::Unretained(this)), 241 base::Unretained(this)),
241 base::Bind(&AesDecryptorTest::OnSessionKeysChange, 242 base::Bind(&AesDecryptorTest::OnSessionKeysChange,
242 base::Unretained(this))), 243 base::Unretained(this))),
243 std::string()); 244 std::string());
244 } else if (GetParam() == "CdmAdapter") { 245 } else if (GetParam() == "CdmAdapter") {
245 CdmConfig cdm_config; // default settings of false are sufficient. 246 CdmConfig cdm_config; // default settings of false are sufficient.
246 247
247 helper_.reset(new ExternalClearKeyTestHelper()); 248 helper_.reset(new ExternalClearKeyTestHelper());
248 scoped_ptr<CdmAllocator> allocator(new SimpleCdmAllocator()); 249 scoped_ptr<CdmAllocator> allocator(new SimpleCdmAllocator());
250 scoped_ptr<CdmFileIOProvider> provider(new SimpleCdmFileIOProvider());
249 CdmAdapter::Create( 251 CdmAdapter::Create(
250 helper_->KeySystemName(), helper_->LibraryPath(), cdm_config, 252 helper_->KeySystemName(), helper_->LibraryPath(), cdm_config,
251 std::move(allocator), base::Bind(&AesDecryptorTest::OnSessionMessage, 253 std::move(allocator), std::move(provider),
252 base::Unretained(this)), 254 base::Bind(&AesDecryptorTest::OnSessionMessage,
255 base::Unretained(this)),
253 base::Bind(&AesDecryptorTest::OnSessionClosed, 256 base::Bind(&AesDecryptorTest::OnSessionClosed,
254 base::Unretained(this)), 257 base::Unretained(this)),
255 base::Bind(&AesDecryptorTest::OnLegacySessionError, 258 base::Bind(&AesDecryptorTest::OnLegacySessionError,
256 base::Unretained(this)), 259 base::Unretained(this)),
257 base::Bind(&AesDecryptorTest::OnSessionKeysChange, 260 base::Bind(&AesDecryptorTest::OnSessionKeysChange,
258 base::Unretained(this)), 261 base::Unretained(this)),
259 base::Bind(&AesDecryptorTest::OnSessionExpirationUpdate, 262 base::Bind(&AesDecryptorTest::OnSessionExpirationUpdate,
260 base::Unretained(this)), 263 base::Unretained(this)),
261 base::Bind(&AesDecryptorTest::OnCdmCreated, base::Unretained(this))); 264 base::Bind(&AesDecryptorTest::OnCdmCreated, base::Unretained(this)));
262 265
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 INSTANTIATE_TEST_CASE_P(CdmAdapter, 1017 INSTANTIATE_TEST_CASE_P(CdmAdapter,
1015 AesDecryptorTest, 1018 AesDecryptorTest,
1016 testing::Values("CdmAdapter")); 1019 testing::Values("CdmAdapter"));
1017 #endif 1020 #endif
1018 1021
1019 // TODO(jrummell): Once MojoCdm/MojoCdmService/MojoDecryptor/ 1022 // TODO(jrummell): Once MojoCdm/MojoCdmService/MojoDecryptor/
1020 // MojoDecryptorService are implemented, add a third version that tests the 1023 // MojoDecryptorService are implemented, add a third version that tests the
1021 // CDM via mojo. 1024 // CDM via mojo.
1022 1025
1023 } // namespace media 1026 } // namespace media
OLDNEW
« no previous file with comments | « media/BUILD.gn ('k') | media/cdm/cdm_adapter.h » ('j') | media/cdm/cdm_file_io_provider.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698