diff options
Diffstat (limited to 'components/app/ts-demo/test/ts-demo_tests.cpp')
-rw-r--r-- | components/app/ts-demo/test/ts-demo_tests.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/components/app/ts-demo/test/ts-demo_tests.cpp b/components/app/ts-demo/test/ts-demo_tests.cpp index 98ca5a05d..66295572a 100644 --- a/components/app/ts-demo/test/ts-demo_tests.cpp +++ b/components/app/ts-demo/test/ts-demo_tests.cpp @@ -1,29 +1,53 @@ /* - * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include <app/ts-demo/ts-demo.h> -#include <service/crypto/client/test/test_crypto_client.h> +#include <protocols/rpc/common/packed-c/encoding.h> #include <CppUTest/TestHarness.h> +#include <service_locator.h> +#include <service/crypto/client/cpp/crypto_client.h> + TEST_GROUP(TsDemoTests) { void setup() { - m_crypto_client = test_crypto_client::create_default(); - m_crypto_client->init(); + struct rpc_caller *caller; + int status; + + m_rpc_session_handle = NULL; + m_crypto_service_context = NULL; + m_crypto_client = NULL; + + service_locator_init(); + + m_crypto_service_context = service_locator_query("sn:trustedfirmware.org:crypto:0", &status); + CHECK(m_crypto_service_context); + + m_rpc_session_handle = service_context_open(m_crypto_service_context, TS_RPC_ENCODING_PROTOBUF, &caller); + CHECK(m_rpc_session_handle); + + m_crypto_client = new crypto_client(caller); } void teardown() { - m_crypto_client->deinit(); delete m_crypto_client; m_crypto_client = NULL; + + service_context_close(m_crypto_service_context, m_rpc_session_handle); + m_rpc_session_handle = NULL; + + service_context_relinquish(m_crypto_service_context); + m_crypto_service_context = NULL; } - test_crypto_client *m_crypto_client; + rpc_session_handle m_rpc_session_handle; + struct service_context *m_crypto_service_context; + crypto_client *m_crypto_client; }; TEST(TsDemoTests, runTsDemo) |