// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary // source code may only be used and distributed under the Widevine License // Agreement. // #include #include "OEMCryptoCENC.h" #include "clock.h" #include "log.h" #include "oec_decrypt_fallback_chain.h" #include "oec_device_features.h" #include "oec_session_util.h" #include "oec_test_data.h" #include "oemcrypto_session_tests_helper.h" #include "oemcrypto_types.h" #include "platform.h" #include "string_conversions.h" #include "test_sleep.h" using namespace std; namespace wvoec { class OTAKeyboxProvisioningTest : public ::testing::Test, public SessionUtil { protected: void SetUp() override { ::testing::Test::SetUp(); wvcdm::TestSleep::SyncFakeClock(); const ::testing::TestInfo* const test_info = ::testing::UnitTest::GetInstance()->current_test_info(); LOGD("Running test %s.%s", test_info->test_case_name(), test_info->name()); OEMCrypto_SetSandbox(kTestSandbox, sizeof(kTestSandbox)); ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize()); } void TearDown() override { OEMCrypto_Terminate(); ::testing::Test::TearDown(); } }; TEST_F(OTAKeyboxProvisioningTest, BasicTest) { OEMCryptoResult result = OEMCrypto_IsKeyboxValid(); if (result == OEMCrypto_SUCCESS) { cout << " " << "Keybox valid after initialization. Skipping rest of test." << endl; return; } ASSERT_EQ(result, OEMCrypto_ERROR_NEEDS_KEYBOX_PROVISIONING); cout << " " << "OTA Keybox functions supported. Device needs provisioning." << endl; } } // namespace wvoec