Merge from Widevine repo of http://go/wvgerrit/56520 This CL adds a test base that installs a test keybox and catches nonce flood errors for all CDM tests. In order to do this, a new class is added called a CryptoSessionFactory. The default factory just creates a new CryptoSession. All places in the code that create a new CryptoSession now call the static method MakeCryptoSession, which uses the current factory to create a CryptoSession. If MakeCryptoSession is called and there is no current factory, a default factory is created. The CryptoSession constructor is now private, so that we do not accidentally try to create one without using the factory. For the new test base, we first create a special test CryptoSessionFactory that creates a TestCryptoSession. The test factory catches the first call to MakeCryptoSession and injects an installation of the test keybox after OEMCrypto_Initialize is called. The TestCryptoSession injects a sleep statement and a retry whenever it detects a nonce flood. Test: current unit tests still pass. bug: 72354901 Fix Generic Crypto tests. bug: 111361440 Remove #ifdef from unit tests Change-Id: I248e7f3c53721c04d2af412ef835e19bb4d15d9a
68 lines
1.7 KiB
Makefile
68 lines
1.7 KiB
Makefile
# -------------------------------------------------------------------
|
|
# Makes a unit or end to end test.
|
|
# test_name must be passed in as the base filename(without the .cpp).
|
|
#
|
|
$(call assert-not-null,test_name)
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := $(test_name)
|
|
LOCAL_MODULE_TAGS := tests
|
|
|
|
LOCAL_SRC_FILES := \
|
|
$(test_src_dir)/$(test_name).cpp \
|
|
../../oemcrypto/test/oec_device_features.cpp \
|
|
../core/test/config_test_env.cpp \
|
|
../core/test/http_socket.cpp \
|
|
../core/test/license_request.cpp \
|
|
../core/test/test_base.cpp \
|
|
../core/test/test_printers.cpp \
|
|
../core/test/url_request.cpp
|
|
|
|
LOCAL_C_INCLUDES := \
|
|
vendor/widevine/libwvdrmengine/android/cdm/test \
|
|
vendor/widevine/libwvdrmengine/cdm/core/include \
|
|
vendor/widevine/libwvdrmengine/cdm/core/test \
|
|
vendor/widevine/libwvdrmengine/cdm/include \
|
|
vendor/widevine/libwvdrmengine/cdm/metrics/include \
|
|
vendor/widevine/libwvdrmengine/cdm/util/include \
|
|
vendor/widevine/libwvdrmengine/oemcrypto/include \
|
|
vendor/widevine/libwvdrmengine/oemcrypto/test \
|
|
|
|
LOCAL_C_INCLUDES += external/protobuf/src
|
|
|
|
LOCAL_STATIC_LIBRARIES := \
|
|
libcdm \
|
|
libcdm_protos \
|
|
libcdm_utils \
|
|
libcrypto_static \
|
|
libjsmn \
|
|
libgmock \
|
|
libgtest \
|
|
libgtest_main \
|
|
libwvlevel3 \
|
|
|
|
LOCAL_SHARED_LIBRARIES := \
|
|
libcutils \
|
|
libdl \
|
|
liblog \
|
|
libmedia_omx \
|
|
libprotobuf-cpp-lite \
|
|
libssl \
|
|
libstagefright_foundation \
|
|
libutils \
|
|
|
|
LOCAL_CFLAGS += -DUNIT_TEST
|
|
|
|
LOCAL_MODULE_OWNER := widevine
|
|
LOCAL_PROPRIETARY_MODULE := true
|
|
|
|
# When built, explicitly put it in the DATA/bin directory.
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/bin
|
|
|
|
ifneq ($(TARGET_ENABLE_MEDIADRM_64), true)
|
|
LOCAL_MODULE_TARGET_ARCH := arm x86 mips
|
|
endif
|
|
|
|
include $(BUILD_EXECUTABLE)
|