From f5e50ba83c5f0cc13315eadf5aeb663cefe27d4c Mon Sep 17 00:00:00 2001 From: zhangzezhong Date: Thu, 19 Jun 2025 22:41:39 +0800 Subject: [PATCH] modify cj RegisterInstance Signed-off-by: zhangzezhong --- frameworks/native/appkit/app/main_thread.cpp | 4 ++-- .../appkit/main_thread_test/main_thread_test.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/frameworks/native/appkit/app/main_thread.cpp b/frameworks/native/appkit/app/main_thread.cpp index 7b446e28799..34d6f74d656 100644 --- a/frameworks/native/appkit/app/main_thread.cpp +++ b/frameworks/native/appkit/app/main_thread.cpp @@ -2466,7 +2466,7 @@ bool MainThread::PrepareAbilityDelegator(const std::shared_ptr & auto testRunner = TestRunner::Create(runtime, args, false); auto delegator = IAbilityDelegator::Create(runtime, application_->GetAppContext(), std::move(testRunner), record->observer); - AbilityDelegatorRegistry::RegisterInstance(delegator, args, AbilityRuntime::Runtime::Language::JS); + AbilityDelegatorRegistry::RegisterInstance(delegator, args, runtime->GetLanguage()); delegator->SetApiTargetVersion(targetVersion); delegator->Prepare(); } @@ -2477,7 +2477,7 @@ bool MainThread::PrepareAbilityDelegator(const std::shared_ptr & auto testRunner = TestRunner::Create(runtime, args, false); auto delegator = IAbilityDelegator::Create(runtime, application_->GetAppContext(), std::move(testRunner), record->observer); - AbilityDelegatorRegistry::RegisterInstance(delegator, args, AbilityRuntime::Runtime::Language::ETS); + AbilityDelegatorRegistry::RegisterInstance(delegator, args, runtime->GetLanguage()); delegator->SetApiTargetVersion(targetVersion); delegator->Prepare(); } diff --git a/test/unittest/appkit/main_thread_test/main_thread_test.cpp b/test/unittest/appkit/main_thread_test/main_thread_test.cpp index ac1a95f76c5..91d65cc3501 100644 --- a/test/unittest/appkit/main_thread_test/main_thread_test.cpp +++ b/test/unittest/appkit/main_thread_test/main_thread_test.cpp @@ -2553,5 +2553,18 @@ HWTEST_F(MainThreadTest, HandleUpdatePluginInfoInstalled_0100, TestSize.Level1) EXPECT_EQ(appLibPaths["pluginBundleName/moduleName"][0], "/data/storage/el1/bundle/+plugins/test"); } + +/** + * @tc.name: NotifyDeviceDisConnect_0100 + * @tc.desc: Notify device connect. + * @tc.type: FUNC + */ +HWTEST_F(MainThreadTest, NotifyDeviceDisConnect_0100, TestSize.Level1) +{ + std::shared_ptr mainThread = std::make_shared(); + ASSERT_NE(mainThread, nullptr); + bool ret = mainThread->NotifyDeviceDisConnect(); + EXPECT_EQ(ret, false); +} } // namespace AppExecFwk } // namespace OHOS -- Gitee