From 5fbd87afd8971faa6100b92d8292e756459efc72 Mon Sep 17 00:00:00 2001 From: wangyu Date: Thu, 18 Jul 2024 15:09:36 +0800 Subject: [PATCH] add finishtest for cj ability delegator Signed-off-by: wangyu --- frameworks/cj/ffi/cj_ability_delegator.cpp | 14 ++++++++++++++ frameworks/cj/ffi/cj_ability_delegator.h | 2 ++ frameworks/cj/mock/cj_ability_ffi.cpp | 1 + 3 files changed, 17 insertions(+) diff --git a/frameworks/cj/ffi/cj_ability_delegator.cpp b/frameworks/cj/ffi/cj_ability_delegator.cpp index 739d5c6e76..fc3fd3f030 100644 --- a/frameworks/cj/ffi/cj_ability_delegator.cpp +++ b/frameworks/cj/ffi/cj_ability_delegator.cpp @@ -64,6 +64,11 @@ std::string CJShellCmdResult::Dump() { return shellCmdResultr_->Dump(); } + +void CJAbilityDelegator::FinishTest(const char* msg, int64_t code) +{ + delegator_->FinishUserTest(msg, code); +} extern "C" { int64_t FFIAbilityDelegatorRegistryGetAbilityDelegator() @@ -145,6 +150,15 @@ int32_t FFIAbilityDelegatorApplicationContext(int64_t id) } return appContext->GetID(); } + +void FFIAbilityDelegatorFinishTest(int64_t id, const char* msg, int64_t code) +{ + auto cjDelegator = FFI::FFIData::GetData(id); + if (cjDelegator == nullptr) { + TAG_LOGE(AAFwkTag::CONTEXT, "cj delegator is null."); + } + cjDelegator->FinishTest(msg, code); +} } } } \ No newline at end of file diff --git a/frameworks/cj/ffi/cj_ability_delegator.h b/frameworks/cj/ffi/cj_ability_delegator.h index 5a5682b7da..55a9151224 100644 --- a/frameworks/cj/ffi/cj_ability_delegator.h +++ b/frameworks/cj/ffi/cj_ability_delegator.h @@ -34,6 +34,7 @@ public: int32_t StartAbility(const AAFwk::Want& want); std::shared_ptr ExecuteShellCommand(const char* cmd, int64_t timeoutSec); std::shared_ptr GetAppContext(); + void FinishTest(const char* msg, int64_t code); private: std::shared_ptr delegator_; @@ -58,6 +59,7 @@ CJ_EXPORT int32_t FFIGetExitCode(int64_t id); CJ_EXPORT const char* FFIGetStdResult(int64_t id); CJ_EXPORT const char* FFIDump(int64_t id); CJ_EXPORT int32_t FFIAbilityDelegatorApplicationContext(int64_t id); +CJ_EXPORT void FFIAbilityDelegatorFinishTest(int64_t id, const char* msg, int64_t code); }; } } diff --git a/frameworks/cj/mock/cj_ability_ffi.cpp b/frameworks/cj/mock/cj_ability_ffi.cpp index a51ac6bbac..c490a2588d 100644 --- a/frameworks/cj/mock/cj_ability_ffi.cpp +++ b/frameworks/cj/mock/cj_ability_ffi.cpp @@ -39,6 +39,7 @@ int FFIGetExitCode(); int FFIGetStdResult(); int FFIDump(); int FFIAbilityDelegatorApplicationContext(); +int FFIAbilityDelegatorFinishTest(); struct AbilityContextBroker { int64_t isAbilityContextExisted = 1;