Signed-off-by: xinxin13 <xinxin13@huawei.com>
This commit is contained in:
xinxin13
2022-12-26 15:50:15 +08:00
parent ed64ea5a5f
commit d234f0a103
6 changed files with 618 additions and 459 deletions
@@ -86,10 +86,6 @@ ohos_unittest("context_deal_interface_test") {
ohos_unittest("application_test") {
module_out_path = module_output_path
include_dirs =
[ "//base/global/resource_management/frameworks/resmgr/include" ]
sources = [
"${ability_runtime_native_path}/appkit/app/app_context.cpp",
"${ability_runtime_native_path}/appkit/app/app_loader.cpp",
@@ -202,13 +198,8 @@ ohos_unittest("application_impl_test") {
sources = [
"${ability_runtime_native_path}/appkit/app/app_context.cpp",
"${ability_runtime_native_path}/appkit/app/app_loader.cpp",
"${ability_runtime_native_path}/appkit/app/application_env.cpp",
"${ability_runtime_native_path}/appkit/app/application_env_impl.cpp",
"${ability_runtime_native_path}/appkit/app/application_impl.cpp",
"${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
"app_context_test.cpp",
"app_loader_test.cpp",
"application_env_impl_test.cpp",
"application_impl_test.cpp",
]
@@ -334,79 +325,6 @@ ohos_unittest("mix_stack_dumper_test") {
]
}
ohos_unittest("ability_stage_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_native_path}/appkit/app/app_context.cpp",
"${ability_runtime_native_path}/appkit/app/app_loader.cpp",
"${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
"${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp",
"${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp",
"ability_stage_test.cpp",
"application_data_manager_test.cpp",
"application_test.cpp",
"context_impl_test.cpp",
]
configs = [ ":module_private_config" ]
deps = [
"${ability_runtime_innerkits_path}/ability_manager:ability_manager",
"${ability_runtime_innerkits_path}/app_manager:app_manager",
"${ability_runtime_native_path}/ability/native:abilitykit_native",
"${ability_runtime_native_path}/appkit:app_context",
"${ability_runtime_native_path}/appkit:appkit_native",
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//third_party/googletest:gtest_main",
]
external_deps = [
"ability_base:base",
"ability_base:configuration",
"ability_base:want",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
}
ohos_unittest("form_extension_context_test") {
module_out_path = module_output_path
sources = [
"${ability_runtime_native_path}/appkit/app/app_loader.cpp",
"${ability_runtime_native_path}/appkit/app/ohos_application.cpp",
"form_extension_context_test.cpp",
]
configs = [ ":module_context_config" ]
deps = [
"${ability_runtime_native_path}/ability/native:abilitykit_native",
"${ability_runtime_native_path}/ability/native:form_extension",
"${ability_runtime_native_path}/appkit:app_context",
"${ability_runtime_native_path}/appkit:appkit_native",
"//third_party/googletest:gmock_main",
"//third_party/googletest:gtest_main",
]
external_deps = [
"ability_base:configuration",
"ability_base:want",
"ability_runtime:runtime",
"bundle_framework:appexecfwk_base",
"c_utils:utils",
"form_fwk:fmskit_native",
"form_fwk:form_manager",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
}
###############################################################################
group("unittest") {
@@ -414,13 +332,11 @@ group("unittest") {
deps = []
deps += [
":ability_stage_test",
":ability_start_setting_test",
":application_impl_test",
":application_test",
":context_container_test",
":context_deal_test",
":form_extension_context_test",
":mix_stack_dumper_test",
":watchdog_test",
]
File diff suppressed because it is too large Load Diff
+4
View File
@@ -16,4 +16,8 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni")
group("tools_target") {
deps = [ "aa:tools_aa" ]
if (ability_runtime_graphics) {
deps += [ "fm:tools_fm" ]
}
}
@@ -110,3 +110,30 @@ HWTEST_F(TestObserverTest, Test_Observer_Test_0300, Function | MediumTest | Leve
th.join();
EXPECT_TRUE(ret);
}
/**
* @tc.number: Test_Observer_Test_0400
* @tc.name: WaitForFinish
* @tc.desc: Verify the WaitForFinish return false.
*/
HWTEST_F(TestObserverTest, Test_Observer_Test_0400, Function | MediumTest | Level1)
{
HILOG_INFO("Test_Observer_Test_0400 is called");
TestObserver observer;
observer.isFinished_ = false;
bool ret = observer.WaitForFinish(1);
EXPECT_FALSE(ret);
}
/**
* @tc.number: Test_Observer_Test_0500
* @tc.name: WaitForFinish
* @tc.desc: Verify the TestStatus.
*/
HWTEST_F(TestObserverTest, Test_Observer_Test_0500, Function | MediumTest | Level1)
{
HILOG_INFO("Test_Observer_Test_0500 is called");
TestObserver observer;
observer.isFinished_ = false;
observer.TestStatus(MSG.c_str(), RESULT_CODE);
}
+39
View File
@@ -0,0 +1,39 @@
# Copyright (c) 2022 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.
import("//build/test.gni")
import("//foundation/ability/ability_runtime/ability_runtime.gni")
module_output_path = "ability_tools/tools"
ohos_unittest("system_time_test") {
module_out_path = module_output_path
sources = [ "system_time_test.cpp" ]
cflags = []
if (target_cpu == "arm") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${ability_runtime_path}/tools/aa:tools_aa_source_set",
"//third_party/googletest:gtest_main",
]
}
group("unittest") {
testonly = true
deps = [ ":system_time_test" ]
}
@@ -0,0 +1,59 @@
/*
* Copyright (c) 2022 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>
#include "system_time.h"
using namespace testing::ext;
using namespace OHOS;
using namespace OHOS::AAFwk;
namespace OHOS {
namespace AAFwk {
namespace {
} // namespace
class SystemTimeTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp();
void TearDown();
};
void SystemTimeTest::SetUpTestCase()
{}
void SystemTimeTest::TearDownTestCase()
{}
void SystemTimeTest::SetUp()
{}
void SystemTimeTest::TearDown()
{}
/**
* @tc.name: System_Time_Get_Now_System_0100
* @tc.desc: "Get System Time" test.
* @tc.type: FUNC
*/
HWTEST_F(SystemTimeTest, System_Time_Get_Now_System_0100, TestSize.Level1)
{
SystemTime systemTime;
EXPECT_GT(systemTime.GetNowSysTime(), 0);
}
} // namespace AAFwk
} // namespace OHOS