mirror of
https://gitee.com/openharmony/security_security_component_manager
synced 2024-11-23 06:29:45 +00:00
commit
8c2c67ca12
@ -130,6 +130,7 @@ void SecCompRegisterCallbackTest::TearDown()
|
||||
*/
|
||||
HWTEST_F(SecCompRegisterCallbackTest, RegisterSecurityComponent001, TestSize.Level1)
|
||||
{
|
||||
sleep(1);
|
||||
nlohmann::json jsonRes;
|
||||
TestCommon::BuildLocationComponentInfo(jsonRes);
|
||||
std::string locationInfo = jsonRes.dump();
|
||||
|
@ -57,7 +57,6 @@ ohos_unittest("sec_comp_service_test") {
|
||||
"unittest/src/sec_comp_stub_test.cpp",
|
||||
"unittest/src/service_test_common.cpp",
|
||||
"unittest/src/window_info_helper_test.cpp",
|
||||
"unittest/src/zzenv_exit_operate.cpp",
|
||||
]
|
||||
|
||||
configs = [ "${sec_comp_root_dir}/config:coverage_flags" ]
|
||||
|
@ -94,13 +94,24 @@ static LocationButton BuildValidLocationComponent()
|
||||
button.bg_ = SecCompBackground::CIRCLE;
|
||||
return button;
|
||||
}
|
||||
static const int32_t SLEEP_TIME = 5;
|
||||
}
|
||||
|
||||
void SecCompManagerTest::SetUpTestCase()
|
||||
{}
|
||||
|
||||
void SecCompManagerTest::TearDownTestCase()
|
||||
{}
|
||||
{
|
||||
if (SecCompManager::GetInstance().secRunner_ != nullptr) {
|
||||
SecCompManager::GetInstance().secRunner_->queue_.reset();
|
||||
SecCompManager::GetInstance().secRunner_ = nullptr;
|
||||
}
|
||||
if (SecCompManager::GetInstance().secHandler_ != nullptr) {
|
||||
SecCompManager::GetInstance().secHandler_->eventRunner_.reset();
|
||||
SecCompManager::GetInstance().secHandler_ = nullptr;
|
||||
}
|
||||
sleep(SLEEP_TIME);
|
||||
}
|
||||
|
||||
void SecCompManagerTest::SetUp()
|
||||
{
|
||||
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#define private public
|
||||
#include "event_handler.h"
|
||||
#include "event_runner.h"
|
||||
#include "sec_comp_manager.h"
|
||||
#undef private
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Security {
|
||||
namespace SecurityComponent {
|
||||
/**
|
||||
* @brief This test class is used to release resources before process end to avoid crash
|
||||
*/
|
||||
class ZZEnvExitOperate : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void ZZEnvExitOperate::SetUpTestCase()
|
||||
{}
|
||||
|
||||
void ZZEnvExitOperate::TearDownTestCase()
|
||||
{}
|
||||
|
||||
void ZZEnvExitOperate::SetUp()
|
||||
{}
|
||||
|
||||
void ZZEnvExitOperate::TearDown()
|
||||
{}
|
||||
|
||||
/**
|
||||
* @tc.name: ZExitOperateTest001
|
||||
* @tc.desc: remove ffrt handler to avoid uaf crash
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: None
|
||||
*/
|
||||
HWTEST_F(ZZEnvExitOperate, ZExitOperateTest001, TestSize.Level1)
|
||||
{
|
||||
if (SecCompManager::GetInstance().secRunner_ != nullptr) {
|
||||
SecCompManager::GetInstance().secRunner_->queue_.reset();
|
||||
SecCompManager::GetInstance().secRunner_ = nullptr;
|
||||
}
|
||||
if (SecCompManager::GetInstance().secHandler_ != nullptr) {
|
||||
SecCompManager::GetInstance().secHandler_->eventRunner_.reset();
|
||||
SecCompManager::GetInstance().secHandler_ = nullptr;
|
||||
}
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -80,6 +80,12 @@ std::string CompoRandomGenerator::ConstructLocationJson()
|
||||
// set default val
|
||||
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
|
||||
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData<bool>() },
|
||||
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData<bool>() },
|
||||
{ JsonTagConstants::JSON_TOP_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_LEFT_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_RIGHT_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_PARENT_TAG_TAG, "" },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_STYLE_TAG] = nlohmann::json {
|
||||
{ JsonTagConstants::JSON_TEXT_TAG,
|
||||
@ -116,6 +122,12 @@ std::string CompoRandomGenerator::ConstructSaveJson()
|
||||
// set default val
|
||||
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
|
||||
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData<bool>() },
|
||||
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData<bool>() },
|
||||
{ JsonTagConstants::JSON_TOP_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_LEFT_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_RIGHT_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_PARENT_TAG_TAG, "" },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_STYLE_TAG] = nlohmann::json {
|
||||
{ JsonTagConstants::JSON_TEXT_TAG,
|
||||
@ -152,6 +164,12 @@ std::string CompoRandomGenerator::ConstructPasteJson()
|
||||
// set default val
|
||||
jsonComponent[JsonTagConstants::JSON_PARENT_TAG] = nlohmann::json {
|
||||
{ JsonTagConstants::JSON_PARENT_EFFECT_TAG, GetData<bool>() },
|
||||
{ JsonTagConstants::JSON_IS_CLIPPED_TAG, GetData<bool>() },
|
||||
{ JsonTagConstants::JSON_TOP_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_BOTTOM_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_LEFT_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_RIGHT_CLIP_TAG, GetData<double>() },
|
||||
{ JsonTagConstants::JSON_PARENT_TAG_TAG, "" },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_STYLE_TAG] = nlohmann::json {
|
||||
{ JsonTagConstants::JSON_TEXT_TAG,
|
||||
|
Loading…
Reference in New Issue
Block a user