[ Merge of http://go/wvgerrit/94083 ]
Logs the test case and test name when widevine android unit/integration
tests are run.
Bug: 149664134
Test: wv unit/integration tests
Change-Id: I446b88aa2954a386765e4559358d386b1a263913
Merge of http://go/wvgerrit/93404
This CL updates the Widevine CDM to support OEMCrypto v16.1
Test: Tested in 16.2 CL
Bug: 141247171
Change-Id: I69bd993500f6fb63bf6010c8b0250dc7acc3d71b
This patch merges some features that were added to TestBase in
http://go/wvgerrit/92349 in the Widevine Repo. Certain parameters to
TestBase that could have been const but weren't now are. The caller to
Initialize() can now specify additional, platform-specific help text to
be displayed after the generic help text. And some missing headers were
added to test_base.h.
The Android code does not yet take advantage of any of this, but it
could in the future.
Bug: 145013234
Test: Android Unit Tests
Change-Id: I3c54532a39641622d454256b25979ad89727d43f
[ Merge of http://go/wvgerrit/88006 ]
Certain test files have yet to be formatted since we introduced
clang-formatting.
Test: android unit/integration tests
Bug: 134365840
Change-Id: I2d30ad367d76a9dfbf389614e1b31ed39fa17c72
[ Merge of http://go/wvgerrit/84490 ]
The unit tests will now make at most 10 attempts to provision
themselves before declaring failure.
This change is made to help with flaky provisioning requests that
have been experienced on the Jenkins build server.
Bug: 139298083
Test: Linux unit test, Jenkins build and Android unit tests
Change-Id: I6415a5ef9fdf10ceb893867d5fc73131338e9f76
[ Merge of http://go/wvgerrit/84647 ]
[ Merge of http://go/wvgerrit/84648 ]
Replacing most instances of C's NULL with C++'s nullptr. Also changed
how a NULL check is performed on smart pointers. They provided an
implicit boolean operator for null checks, meaning the underlying
pointer does not need to be compared directly (as it was in some places
before).
Note that clang-format has performed additional changes to some of the
test files that have not yet been formatted.
Bug: 120602075
Test: Linux and Android unittests
Change-Id: I06ddebe34b0ea6dfecedb5527e7e808e32f5269a
Merge from Widevine repo of http://go/wvgerrit/79463 and
http://go/wvgerrit/82383
Several tests explicitly set the log level. This CL unifies that a
little bit. When running the unit tests by hand, on android or for ce
cdm, the log level is 0 (ERROR) and can be incremented on the command
line using the "--verbose" switch.
When running on the desktop, you can set the environment variable
VERBOSE_LOG to "yes", and the log level is set to VERBOSE. This is
done by the buildbot so you can see full logs in the build archive.
When running with the test bed (i.e. Mod Mock) you can edit the
options.txt file and set log_level to 0=ERROR up to 4=VERBOSE. if you
are using the run_current_tests script, you can create a file in the
linux directory called override_options.txt and add the line
log_level 4
This CL only changes test code.
bug: 124390006
Test: unit tests
Change-Id: I1e042004692750e218b8c4220bce3ec1e387004e
(This is a merge of http://go/wvgerrit/76063)
Now that we have C++11, many places that do string formatting or parsing
can be replaced with std::to_string() or one of the std::sto*() family
of functions. This patch updates places that do simple stringifying or
parsing to use these functions. Some parts of the code are left
untouched because they were using StringStream to do more complex
actions, such as constructing more complex output or checking the status
of the parsing.
Bug: 120599938
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I482dc234ecd7c6014fa9b6874387ff51e04b772f
[ Merge from http://go/wvgerrit/69105 ]
This adds a metric collecting decorator class around cdm engine. This
implementation uses a templated decorator. The decorator enables:
1) Wrapping the CDM Engine methods to capture timing and error
information.
2) Allows use of a mock CDM Engine for testing.
Test: Unit tests. GPlay manual testing and GTS tests.
BUG: http://b/64724336
Change-Id: I5e4a0f552974fab1939bc7ab02719a1f5849cf3f
[ Merge of http://go/wvgerrit/71326 ]
Nonce flood, frame size, session and system invalidation errors
will now bubble up to the app. OEMCrypto v15 returns
OEMCrypto_ERROR_BUFFER_TOO_LARGE, OEMCrypto_ERROR_SESSION_LOST_STATE,
OEMCrypto_ERROR_SYSTEM_INVALIDATED and a variety of nonce errors.
These will be reported to HIDL as OUTPUT_TOO_LARGE_ERROR,
ERROR_DRM_SESSION_LOST_STATE, ERROR_DRM_INVALID_STATE and
ERROR_DRM_RESOURCE_CONTENTION.
Bug: 120572706
Test: Unit/Integration tests
Change-Id: Ida177300046327ce81592a273028ef6c3a0d9fd9
This reverts commit 408509efdc.
Reason for revert: just kidding. We want to run the tests on
old devices, too.
Change-Id: I920fa825380638122f638e057bcfbe98b5f7b301
Merge from Widevine repo of http://go/wvgerrit/71323
When running multithreaded tests, we need to make sure there are no other
OEMCrypto calls between OEMCrypto_Initialize and the installation of the test
keybox.
bug: 123319961
test: ran juce's threading test
Change-Id: Ibd8951c764f6538da4afa9ad146a6a72064eb13a
(This is a merge of http://go/wvgerrit/70343)
Instead of using the POSIX-specific getopt(), this uses a manual
string comparison so it works on Windows.
Test: Android Unit Tests
Bug: 122953649
Change-Id: If009f8b3bfc8581d252da0f5ed55293c46d70bc6
Merge from Widevine repo of http://go/wvgerrit/69563
This CL also disables unit tests that depend on the old test keybox when run
against OEMCrypto v13 or earlier.
Unit tests that require a particular API level have been
removed. This requirement for Android is tested in GTS tests.
Bug: 119316243
Test: unit tests
Change-Id: I9a13dbaee1693ecea906fd0184a8e2590dc5beed
(This is a merge of http://go/wvgerrit/70303)
This adds a platform.h file to abstract some of the differences
between Windows and POSIX platforms. This includes ntohl, setenv,
and ssize_t.
Bug: 122953649
Test: Android Unit Tests
Change-Id: I3235f3f284b53d24d7365ff3f4a06dcd9b403697
(This is a merge of http://go/wvgerrit/70384)
It turns out the reason the binary provisioning unit test was failing is
because the test base class was setting the property to turn on binary
provisioning before calling Init(), however all current Init()
implementations overwrite the value of that field. As such, the tests
weren't actually using binary provisioning. With that fixed, everything
passes; the binary provisioning flow doesn't appear to actually be
broken.
This is the exact same commit as was previously reverted,
cf5464d7a2fbecd1938ae0700199145b7b61c3c3. However, a pending patch fixes
the multiple runs of Properties::Init() that lead to the inconsistent
failures of the previous patch. (See http://go/wvgerrit/70383)
Bug: 112046733
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I79fc2c8d4d24505b46cab0e21eef85a37d66748d
(The matching reversion in the Widevine Repository is
http://go/wvgerrit/69923)
This reverts commit c207ef8ea6.
Reason for revert: Widevine Buildbot failures
Change-Id: Ied9e36f9eaa94bb7e9cd13b8dff7a2cbdca07a07
(This is a merge of http://go/wvgerrit/69843)
It turns out the reason the binary provisioning unit test was failing is
because the test base class was setting the property to turn on binary
provisioning before calling Init(), however all current Init()
implementations overwrite the value of that field. As such, the tests
weren't actually using binary provisioning. With that fixed, everything
passes; the binary provisioning flow doesn't appear to actually be
broken.
Bug: 112046733
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I7413f7fb2227e596fb610d6ddc5b95cda2f406b8
Import of http://go/wvgerrit/68188
This adds an attribute to metrics indicating if the license was online
or offline.
Also, added a unit test for CdmEngineMetricsImpl.
Test: Unit tests. GPlay manual. GTS tests.
Bug: 115523917
Change-Id: Id315c643048914a2c51904451f9665987bc87eb7
Merge from master branch of Widevine repo of http://go/wvgerrit/66073
Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64083
As part of the update to v15, LoadKeys, RefreshKeys, and
LoadEntitledContentKeys should all use offsets and lengths into the
message rather than a pointer for its parameters. The CDM, tests,
adapters, and OEMCrypto implementations are changed to reflect this.
Test: tested as part of http://go/ag/5501993
Bug: 115874964
Change-Id: I981fa322dec7c565066fd163ca5775dbff71fccf
Merge from Widevine repo of http://go/wvgerrit/65922
This CL puts the old 4121 test keybox back into the unit and android
integration tests so that we can run tests on a device with OEMCrypto v13.
This change should not be released, and should not be included in CE CDM. It
should be removed once we have more test devices with v14 or v15.
Bug: 119313532
Bug: 119316243
Test: unit tests
Test: tested as part of http://go/ag/5501993
Change-Id: If6a459e11176e07c66fbe6fc45c63d87595a20dc
(This is a merge of http://go/wvgerrit/60620)
The license code handles keys larger than 16 bytes correctly, but it
does not properly reject keys smaller than 16 bytes.
This patch adds unit tests not only for the new error case but also
the existing success cases which were not previously being tested. As
part of this, license_unittest was changed to use a Test Peer instead
of making the test fixture a friend class.
Bug: 111069024
Test: CE CDM unit tests
Test: Android unit tests
Change-Id: Idb2deb6fbe0aeb19b530f9818bebff480541f5c8
Merge from Widevine repo of http://go/wvgerrit/59700
This CL sets the environment variable MODEL_NAME to be the current
unit test. When running on a test platform, this environment variable
is used in the license request as model_name.
test: unit tests.
bug: 38004627
Change-Id: I347c5cec35942d68285cc01615b976097f37d214
Merge from Widevine repo of http://go/wvgerrit/56522
This CL moves provisioning from core/test/cdm_engine_test.cpp to
test_base.cpp because other tests should also only be run when the
device has been provisioned.
It also adds a fake license server. The license holder helps a test
create a license request and then generates a bare-bones license,
without actually sending anything to a real license server.
Test: more unit tests pass than before.
Bug: 72354901 Fix Generic Crypto tests.
Change-Id: Iec067a6a1fb91fa8fd7b904fdf36e90981e293a3
Merge from Widevine repo of http://go/wvgerrit/56521
This CL adds a common main routine for integration tests. It sets a
default test configuration for the provisioning and license server
urls and certificates, and allows the user to set them on the command
line.
Test: current unit tests still pass.
Bug: 72354901 Fix Generic Crypto tests.
Change-Id: I604a3d9e15d50da5041794624c4571c0dcb091f5
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