From 0ab663d8a5caa1dfcd3786fd0f68e9d9ede5d429 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Wed, 28 Aug 2013 18:21:55 -0700 Subject: [PATCH] Rename Unit Test In order to run all disabled OEMCrypto unit tests with one gtest filter, one of them needs to be renamed so it matches the others. These tests are disabled by default because they install a test keybox, which would be dangerous on a production device. Merged from CDM change https://widevine-internal-review.googlesource.com/7440 bug: 10508973 Change-Id: I9508b133c6500ec28ce8890a4af89f016344b842 --- .../oemcrypto/test/oemcrypto_test.cpp | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp index 7525e5e2..9ecd2f95 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp @@ -1494,8 +1494,7 @@ TEST_F(OEMCryptoClientTest, NormalGetKeyData) { OEMCryptoResult sts; uint8_t key_data[256]; - uint32_t req_len = 256; - size_t key_data_len = req_len; + size_t key_data_len = sizeof(key_data); sts = OEMCrypto_GetKeyData(key_data, &key_data_len); uint32_t* data = reinterpret_cast(key_data); @@ -1513,38 +1512,6 @@ TEST_F(OEMCryptoClientTest, NormalGetKeyData) { testTearDown(); } -TEST_F(OEMCryptoClientTest, DISABLED_CheckSystemID) { - testSetUp(); - - OEMCryptoResult sts; - uint8_t key_data[256]; - uint32_t req_len = 256; - size_t key_data_len = req_len; - sts = OEMCrypto_GetKeyData(key_data, &key_data_len); - ASSERT_EQ(OEMCrypto_SUCCESS, sts); - - uint32_t* data = reinterpret_cast(key_data); - uint32_t system_id = htonl(data[1]); - if (system_id != 0x1019) { - - cout << "================================================================\n" - << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n" - << "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING \n" - << "You have enabled the keybox tests. This code WILL INSTALL A \n" - << "TEST KEYBOX. IT WILL REPLACE THE EXISTING KEYBOX, and you will.\n" - << "NOT have access to production content. Your current keybox has \n" - << "system id " << system_id << ".\n" - << "\n" - << "Continue? [y/N]:\n"; - int answer = getchar(); - if (tolower(answer) != 'y') { - cout << "Quitting tests. whew, that was close.\n"; - exit(1); - } - } - testTearDown(); -} - TEST_F(OEMCryptoClientTest, KeyboxValid) { bool success; success = init(); @@ -1811,6 +1778,38 @@ class DISABLED_TestKeybox : public OEMCryptoClientTest { } }; +TEST_F(DISABLED_TestKeybox, CheckSystemID) { + testSetUp(); + + OEMCryptoResult sts; + uint8_t key_data[256]; + size_t key_data_len = sizeof(key_data); + sts = OEMCrypto_GetKeyData(key_data, &key_data_len); + ASSERT_EQ(OEMCrypto_SUCCESS, sts); + + uint32_t* data = reinterpret_cast(key_data); + uint32_t system_id = htonl(data[1]); + if (system_id != 0x1019) { + + cout << "================================================================\n" + << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n" + << "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING \n" + << "You have enabled the keybox tests. This code WILL INSTALL A \n" + << "TEST KEYBOX. IT WILL REPLACE THE EXISTING KEYBOX, and you will.\n" + << "NOT have access to production content. Your current keybox has \n" + << "system id " << system_id << ".\n" + << "\n" + << "Continue? [y/N]:\n"; + int answer = getchar(); + if (tolower(answer) != 'y') { + cout << "Quitting tests. whew, that was close.\n"; + exit(1); + } + } + testTearDown(); +} + + TEST_F(DISABLED_TestKeybox, GoodKeybox) { testSetUp(); wvoec_mock::WidevineKeybox keybox = kValidKeybox02;