Files
ce_cdm/cdm/cdm_unittests.gyp
2024-09-05 07:02:36 +00:00

264 lines
8.3 KiB
Python

# Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
# source code may only be used and distributed under the Widevine License
# Agreement.
#
# Any top-level targets in this file (and their dependencies) will be built by
# the CE CDM's ./build.py build system. Refer to the distribution package's
# README for details.
{
'includes': [
'platform_properties.gypi',
],
'variables': {
# Directory where OEMCrypto header, test, and reference files lives.
'oemcrypto_dir': '../oemcrypto',
# Directory where widevine utilities live.
'util_dir': '../util',
'third_party_path%': '../third_party',
'metrics_target': 'cdm.gyp:metrics_proto',
'device_files_target': 'cdm.gyp:device_files',
# The path to the prebuilt CDM to test against. (iOS only)
'prebuilt_cdm_path%': '',
# The path to the include directory.
'test_include_dir%': 'include',
'expected_cdm_version%': '',
'supports_dynamic_perf_test%': 0,
'json_dir': '../third_party/nlohmann-json',
'jsmn_dir': '../third_party/jsmn',
},
'targets': [{
'toolsets' : [ 'target' ],
'target_name': 'widevine_ce_cdm_unittest',
'sources': [
'test/cdm_test_main.cpp',
'test/cdm_test_runner.cpp',
'test/create_test_file_system.cpp',
# The test host, which is required for all test suites on CE.
'test/test_host.cpp',
'test/test_host.h',
'../util/test/test_sleep.cpp',
],
'includes': [
'../oemcrypto/test/oemcrypto_unittests.gypi',
'../oemcrypto/odk/src/kdo.gypi',
'../oemcrypto/odk/test/odk_test.gypi',
'../oemcrypto/util/oec_ref_util_unittests.gypi',
'cdm_unittests.gypi',
'core_unittests.gypi',
'util_unittests.gypi',
],
'dependencies': [
'cdm.gyp:widevine_ce_cdm_static',
'../oemcrypto/util/oec_ref_util.gyp:oec_ref_util',
'../third_party/googletest.gyp:gmock',
'../third_party/googletest.gyp:gtest',
],
'msvs_settings': {
'VCLinkerTool': {
# Additionally, since they are loaded locally, suppress these
# warnings.
'AdditionalOptions': [
'/IGNORE:4049',
'/IGNORE:4217',
],
},
},
'conditions': [
['OS=="ios"', {
'type': 'loadable_module',
'mac_xctest_bundle': '1',
'defines': [
'GTEST_FILTER="<(gtest_filter)"',
],
'dependencies': [
'dummy_app',
],
'sources': [
'test/gtest_xctest_wrapper.mm',
],
'xcode_settings': {
'BUNDLE_LOADER': '$(TEST_HOST)',
'INFOPLIST_FILE': 'test/info.plist',
'PRODUCT_BUNDLE_IDENTIFIER': 'EQHXZ8M8AV.widevine_ce_cdm_unittest',
'TEST_HOST': '<(PRODUCT_DIR)/dummy_app.app/dummy_app',
'WRAPPER_EXTENSION': 'xctest',
},
}, {
'type': 'executable',
}],
['oemcrypto_lib=="level3"', {
'sources': [
# The test impl of OEMCrypto_Level3FileSystem and its factory.
'test/level3_file_system_ce_test.h',
'test/level3_file_system_ce_test.cpp',
'test/level3_file_system_ce_test_factory.cpp',
],
'conditions': [
['oemcrypto_adapter_type=="dynamic" ', {
'dependencies': [
'../oemcrypto/level3/oec_level3.gyp:oec_level3_dynamic',
],
}, {
'dependencies': [
'../oemcrypto/level3/oec_level3.gyp:oec_level3_static',
],
}],
],
}],
['oemcrypto_lib=="target"', {
'dependencies': [
'<(oemcrypto_gyp_path)',
],
}],
],
}],
'conditions': [
['supports_dynamic_perf_test', {
'targets': [{
'target_name': 'widevine_perf_test_dynamic',
'type': 'executable',
'sources': [
'../core/test/config_test_env.cpp',
'../core/test/http_socket.cpp',
'../core/test/license_request.cpp',
'../core/test/url_request.cpp',
'../util/src/string_conversions.cpp',
'../util/src/string_format.cpp',
'../util/test/test_sleep.cpp',
'src/log.cpp',
'src/logger_global.cpp',
'test/perf_test.cpp',
'test/perf_test_dynamic.cpp',
'test/test_host.cpp',
],
'includes': [ '../util/libssl_dependency.gypi' ],
'include_dirs': [
'../core/include',
'../core/test',
'../oemcrypto/include',
'../util/include',
'../util/test',
'include',
],
'dependencies': [
'../cdm/cdm.gyp:device_files',
'../third_party/googletest.gyp:gmock',
'../third_party/googletest.gyp:gtest',
'<(device_files_target)',
],
'conditions': [
['OS=="linux"', {
'libraries': [ '-ldl' ],
}],
],
}],
}], # condition: supports_dynamic_perf_test
['prebuilt_cdm_path!=""', {
'targets': [{
'target_name': 'widevine_check_version',
'type': 'executable',
'sources': [
'test/test_version.cpp',
],
'include_dirs': [
'<(test_include_dir)',
],
'libraries': [
'<(prebuilt_cdm_path)',
],
}],
}],
['OS=="ios"', {
'targets': [{
'toolsets' : [ 'target' ],
'target_name': 'dummy_app',
'type': 'executable',
'mac_bundle': '1',
'sources': [
'test/dummy_app.mm',
],
'libraries': [
'CoreFoundation.framework',
'UIKit.framework',
],
'xcode_settings': {
'INFOPLIST_FILE': 'test/info.plist',
'PROVISIONING_PROFILE_SPECIFIER': 'Google Development',
},
'conditions': [
['prebuilt_cdm_path!=""', {
'copies': [{
'destination': '<(PRODUCT_DIR)/dummy_app.app/Frameworks',
'xcode_code_sign': 1,
'files': [
# GYP seems to always use relative paths here, even if they
# start with '/'.
'<!(realpath --relative-to=. "<(prebuilt_cdm_path)")',
],
}],
}],
],
}],
'conditions': [
['supports_dynamic_perf_test', {
'targets': [{
'target_name': 'widevine_perf_test_xctest',
'type': 'loadable_module',
'mac_xctest_bundle': '1',
'defines': [
'EXPECTED_CDM_VERSION="<(expected_cdm_version)"',
'GTEST_FILTER="<(gtest_filter)"',
],
'xcode_settings': {
'BUNDLE_LOADER': '$(TEST_HOST)',
'INFOPLIST_FILE': 'test/info.plist',
'PRODUCT_BUNDLE_IDENTIFIER': 'EQHXZ8M8AV.widevine_perf_test_xctest',
'TEST_HOST': '<(PRODUCT_DIR)/dummy_app.app/dummy_app',
'WRAPPER_EXTENSION': 'xctest',
'OTHER_LDFLAGS': [
'-iframework',
'<(prebuilt_cdm_path)/..',
],
},
'libraries': [
'<(prebuilt_cdm_path)',
],
'sources': [
'../core/test/config_test_env.cpp',
'../core/test/http_socket.cpp',
'../core/test/license_request.cpp',
'../core/test/url_request.cpp',
'../util/src/string_conversions.cpp',
'../util/src/string_format.cpp',
'../util/test/test_clock.cpp',
'../util/test/test_sleep.cpp',
'src/log.cpp',
'src/logger_global.cpp',
'test/perf_test.cpp',
'test/perf_test_xctest.mm',
'test/test_host.cpp',
'test/test_version_xctest.mm',
],
'includes': [ '../util/libssl_dependency.gypi' ],
'include_dirs': [
'<(test_include_dir)',
'../core/include',
'../core/test',
'../oemcrypto/include',
'../util/include',
'../util/test',
],
'dependencies': [
'../cdm/cdm.gyp:device_files',
'../third_party/googletest.gyp:gmock',
'../third_party/googletest.gyp:gtest',
'dummy_app',
],
}],
}], # condition: supports_dynamic_perf_test
],
}], # condition: OS=="ios"
],
}