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

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

Issue 2580093002: Revert of Convert USE_PROPRIETARY_CODECS to a buildflag header. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « media/cdm/aes_decryptor_unittest.cc ('k') | media/filters/audio_decoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/cdm_adapter.h" 5 #include "media/cdm/cdm_adapter.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "media/base/cdm_callback_promise.h" 14 #include "media/base/cdm_callback_promise.h"
15 #include "media/base/cdm_key_information.h" 15 #include "media/base/cdm_key_information.h"
16 #include "media/base/content_decryption_module.h" 16 #include "media/base/content_decryption_module.h"
17 #include "media/base/mock_filters.h" 17 #include "media/base/mock_filters.h"
18 #include "media/cdm/cdm_file_io.h" 18 #include "media/cdm/cdm_file_io.h"
19 #include "media/cdm/external_clear_key_test_helper.h" 19 #include "media/cdm/external_clear_key_test_helper.h"
20 #include "media/cdm/simple_cdm_allocator.h" 20 #include "media/cdm/simple_cdm_allocator.h"
21 #include "media/media_features.h"
22 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
24 23
25 using ::testing::_; 24 using ::testing::_;
26 using ::testing::SaveArg; 25 using ::testing::SaveArg;
27 using ::testing::StrictMock; 26 using ::testing::StrictMock;
28 27
29 MATCHER(IsNotEmpty, "") { 28 MATCHER(IsNotEmpty, "") {
30 return !arg.empty(); 29 return !arg.empty();
31 } 30 }
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 std::vector<uint8_t> key_id(kKeyIdAsJWK, 261 std::vector<uint8_t> key_id(kKeyIdAsJWK,
263 kKeyIdAsJWK + arraysize(kKeyIdAsJWK) - 1); 262 kKeyIdAsJWK + arraysize(kKeyIdAsJWK) - 1);
264 CreateSessionAndExpect(EmeInitDataType::KEYIDS, key_id, SUCCESS); 263 CreateSessionAndExpect(EmeInitDataType::KEYIDS, key_id, SUCCESS);
265 } 264 }
266 265
267 TEST_F(CdmAdapterTest, CreateCencSession) { 266 TEST_F(CdmAdapterTest, CreateCencSession) {
268 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); 267 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS);
269 268
270 std::vector<uint8_t> key_id(kKeyIdAsPssh, 269 std::vector<uint8_t> key_id(kKeyIdAsPssh,
271 kKeyIdAsPssh + arraysize(kKeyIdAsPssh)); 270 kKeyIdAsPssh + arraysize(kKeyIdAsPssh));
272 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 271 #if defined(USE_PROPRIETARY_CODECS)
273 CreateSessionAndExpect(EmeInitDataType::CENC, key_id, SUCCESS); 272 CreateSessionAndExpect(EmeInitDataType::CENC, key_id, SUCCESS);
274 #else 273 #else
275 CreateSessionAndExpect(EmeInitDataType::CENC, key_id, FAILURE); 274 CreateSessionAndExpect(EmeInitDataType::CENC, key_id, FAILURE);
276 #endif 275 #endif
277 } 276 }
278 277
279 TEST_F(CdmAdapterTest, CreateSessionWithBadData) { 278 TEST_F(CdmAdapterTest, CreateSessionWithBadData) {
280 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); 279 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS);
281 280
282 // Use |kKeyId| but specify KEYIDS format. 281 // Use |kKeyId| but specify KEYIDS format.
(...skipping 21 matching lines...) Expand all
304 TEST_F(CdmAdapterTest, UpdateSessionWithBadData) { 303 TEST_F(CdmAdapterTest, UpdateSessionWithBadData) {
305 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS); 304 InitializeAndExpect(ExternalClearKeyLibrary(), SUCCESS);
306 305
307 std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId)); 306 std::vector<uint8_t> key_id(kKeyId, kKeyId + arraysize(kKeyId));
308 CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS); 307 CreateSessionAndExpect(EmeInitDataType::WEBM, key_id, SUCCESS);
309 308
310 UpdateSessionAndExpect(SessionId(), "random data", FAILURE, true); 309 UpdateSessionAndExpect(SessionId(), "random data", FAILURE, true);
311 } 310 }
312 311
313 } // namespace media 312 } // namespace media
OLDNEW
« no previous file with comments | « media/cdm/aes_decryptor_unittest.cc ('k') | media/filters/audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698