IssueNo:#I4SFH8

Description:部件化 测试用例整改
Sig:SIG_ApplicationFramework
Feature or Bugfix: Bugfix
Binary Source: No

Signed-off-by: dy_study <dingyao5@huawei.com>
Change-Id: Ia1e827498726bc03b79acc8c884a90072be8a6f1
This commit is contained in:
dy_study 2022-01-27 12:00:20 +00:00
parent 0a3ddacd6d
commit ad6f4ca817
641 changed files with 170437 additions and 3 deletions

View File

@ -21,3 +21,6 @@ kits_path = "${aafwk_path}/frameworks/kits"
innerkits_path = "${aafwk_path}/interfaces/innerkits"
dispatcher_path = "${aafwk_path}/common/task_dispatcher"
system_test_app_path =
"${aafwk_path}/test/resource/amssystemtestability/abilitySrc"

View File

@ -11,7 +11,8 @@
"//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime:ability_context_native",
"//foundation/aafwk/standard/frameworks/kits/appkit:app_context",
"//foundation/aafwk/standard/frameworks/kits/appkit:appkit_native",
"//foundation/aafwk/standard/frameworks/kits/appkit:appexec"
"//foundation/aafwk/standard/frameworks/kits/appkit:appexec",
"//foundation/aafwk/standard/test/resource/amssystemtestability/abilitySrc:ams_system_test_app"
],
"inner_kits": [
{
@ -187,7 +188,8 @@
"//foundation/aafwk/standard/services:fms_services_target",
"//foundation/aafwk/standard/interfaces/innerkits:fms_innerkits_target",
"//foundation/aafwk/standard/frameworks/kits/fmskit:fmskit_native",
"//foundation/aafwk/standard/interfaces/kits/napi:form_napi_packages"
"//foundation/aafwk/standard/interfaces/kits/napi:form_napi_packages",
"//foundation/aafwk/standard/test/resource/formsystemtestability:fms_system_test_app"
],
"inner_kits": [
{
@ -225,7 +227,8 @@
}
],
"test_list": [
"//foundation/aafwk/standard/services/formmgr/test:unittest"
"//foundation/aafwk/standard/services/formmgr/test:unittest",
"//foundation/aafwk/standard/test/systemtest:systemtest"
]
}
},

View File

@ -0,0 +1 @@
4444

View File

@ -0,0 +1,204 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) 2021 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.
-->
<configuration ver="2.0">
<target name="ams_aa_command_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsSystemTestA.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_ability_append_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsAbilityAppendTestA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsAbilityAppendTestB.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_ability_state_age_manual_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/fwkAbilityState.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_ability_state_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/fwkAbilityState.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_app_process_manage_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsSystemTestA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestB.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestC.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_configuration_updated_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsConfigurationUpdatedTest.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_page_ability_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsSystemTestA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestB.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestC.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestD.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestE.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestF.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestG.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestH.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestI.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestM.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestN.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestO.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestP.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="acts_ams_kit_a_test">
<depend resource="ams_data_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<depend resource="../../../../event/common/test/systemtest/common/resource/testconfig/stress/."
pushpath="/data/testconfig" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_data_ability_bundle/amsKitSystemTestA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_data_ability_bundle/amsKitSystemTestB.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_kit_service_ability_test">
<depend resource="ams_service_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<depend resource="../../../../event/common/test/systemtest/common/resource/testconfig/stress/."
pushpath="/data/testconfig" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_service_ability_bundle/amsKitSystemTestService.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_service_ability_bundle/amsSystemTestServiceA.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_service_ability_test">
<depend resource="ams_service_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_service_ability_bundle/amsSystemTestServiceA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_service_ability_bundle/amsSystemTestServiceB.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_service_ability_bundle/amsSystemTestServiceC.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_service_ability_bundle/amsSystemTestServiceD.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_service_ability_bundle/amsSystemTestServiceE.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_service_ability_bundle/amsSystemTestServiceF.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_service_ability_bundle/amsSystemTestServiceG.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_service_ability_bundle/amsSystemTestServiceH.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_kit_data_test">
<depend resource="ams_data_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<depend resource="../../../../event/common/test/systemtest/common/resource/testconfig/stress/."
pushpath="/data/testconfig" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_data_ability_bundle/amsKitSystemTestDataA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_data_ability_bundle/amsKitSystemTestDataB.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_data_ability_test">
<depend resource="ams_data_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_data_ability_bundle/amsDataSystemTestA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_data_ability_bundle/amsDataSystemTestB.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_data_ability_bundle/amsDataSystemTestC.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_kit_want_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<depend resource="../../../../event/common/test/systemtest/common/resource/testconfig/stress/."
pushpath="/data/testconfig" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsKitSystemTest.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_kit_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<depend resource="../../../../event/common/test/systemtest/common/resource/testconfig/stress/."
pushpath="/data/testconfig" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsKitSystemTest.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestN.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_kit_skills_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<depend resource="../../../../event/common/test/systemtest/common/resource/testconfig/stress/."
pushpath="/data/testconfig" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsKitSystemTest.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_kit_lifecycle_test">
<depend resource="ams_service_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<depend resource="../../../../event/common/test/systemtest/common/resource/testconfig/stress/."
pushpath="/data/testconfig" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_service_ability_bundle/amsKitSystemTestPageA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_service_ability_bundle/amsSystemTestServiceA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_service_ability_bundle/amsKitSystemTestService.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_kit_processinfo_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<depend resource="../../../../event/common/test/systemtest/common/resource/testconfig/stress/."
pushpath="/data/testconfig" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsKitSystemTest.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_dfx_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsSystemTestQ.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestR.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestDFX.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_missionstack_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsMissionStackTest.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsMissionStackTestSubsidiary.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_power_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsSystemTestA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestB.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsSystemTestN.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="ams_ability_visible_test">
<depend resource="ams_page_ability_bundle/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_page_ability_bundle/amsAbilityVisibleTestPageA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_page_ability_bundle/amsAbilityVisibleTestServiceB.hap -> /system/vendor/" src="res" />
</preparer>
</target>
<target name="task_dispatcher_test">
<depend resource="ams_task_dispatcher/." pushpath="/system/vendor/" findpath="res" presetcmd=""/>
<depend resource="../../../../event/common/test/systemtest/common/resource/testconfig/stress/."
pushpath="/data/testconfig" findpath="res" presetcmd=""/>
<preparer>
<option name="push" value="ams_task_dispatcher/taskDispatcherTestA.hap -> /system/vendor/" src="res" />
<option name="push" value="ams_task_dispatcher/taskDispatcherTestB.hap -> /system/vendor/" src="res" />
</preparer>
</target>
</configuration>

View File

@ -0,0 +1,70 @@
# Copyright (c) 2021 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.
group("ams_system_test_app") {
deps = [
"amsAbilityAppendTestA:amsAbilityAppendTestA",
"amsAbilityAppendTestB:amsAbilityAppendTestB",
"amsAbilityVisibleTestPageA:amsAbilityVisibleTestPageA",
"amsAbilityVisibleTestServiceB:amsAbilityVisibleTestServiceB",
"amsConfigurationUpdatedSingletonTest:amsConfigurationUpdatedSingletonTest",
"amsConfigurationUpdatedTest:amsConfigurationUpdatedTest",
"amsDataSystemTestA:amsDataSystemTestA",
"amsDataSystemTestB:amsDataSystemTestB",
"amsDataSystemTestC:amsDataSystemTestC",
"amsKitSTAbilityManager:amsKitSTAbilityManager",
"amsKitSTAbilityManagerFirst:amsKitSTAbilityManagerFirst",
"amsKitSystemTest:amsKitSystemTest",
"amsKitSystemTestA:amsKitSystemTestA",
"amsKitSystemTestB:amsKitSystemTestB",
"amsKitSystemTestDataA:amsKitSystemTestDataA",
"amsKitSystemTestDataB:amsKitSystemTestDataB",
"amsKitSystemTestPageA:amsKitSystemTestPageA",
"amsKitSystemTestService:amsKitSystemTestService",
"amsMissionStackTest:amsMissionStackTest",
"amsMissionStackTestSubsidiary:amsMissionStackTestSubsidiary",
"amsStDataAbility:amsStDataAbility",
"amsSystemTestA:amsSystemTestA",
"amsSystemTestB:amsSystemTestB",
"amsSystemTestC:amsSystemTestC",
"amsSystemTestD:amsSystemTestD",
"amsSystemTestDFX:amsSystemTestDFX",
"amsSystemTestE:amsSystemTestE",
"amsSystemTestErrorK:amsSystemTestErrorK",
"amsSystemTestErrorL:amsSystemTestErrorL",
"amsSystemTestF:amsSystemTestF",
"amsSystemTestG:amsSystemTestG",
"amsSystemTestH:amsSystemTestH",
"amsSystemTestI:amsSystemTestI",
"amsSystemTestM:amsSystemTestM",
"amsSystemTestN:amsSystemTestN",
"amsSystemTestO:amsSystemTestO",
"amsSystemTestP:amsSystemTestP",
"amsSystemTestQ:amsSystemTestQ",
"amsSystemTestR:amsSystemTestR",
"amsSystemTestServiceA:amsSystemTestServiceA",
"amsSystemTestServiceB:amsSystemTestServiceB",
"amsSystemTestServiceC:amsSystemTestServiceC",
"amsSystemTestServiceD:amsSystemTestServiceD",
"amsSystemTestServiceE:amsSystemTestServiceE",
"amsSystemTestServiceF:amsSystemTestServiceF",
"amsSystemTestServiceG:amsSystemTestServiceG",
"amsSystemTestServiceH:amsSystemTestServiceH",
"fwkAbilityState:fwkAbilityState",
"serviceAbilityA:serviceAbilityA",
"taskDispatcherTestA:taskDispatcherTestA",
"taskDispatcherTestB:taskDispatcherTestB",
# "launcherAbility:launcher_ability_native",
]
}

View File

@ -0,0 +1,72 @@
# Copyright (c) 2021 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/ohos.gni")
import("//foundation/appexecfwk/standard/appexecfwk.gni")
SUBDEMOSYSTEM_DIR = "${appexecfwk_path}/test/resource/amssystemtestability/abilitySrc/amsAbilityAppendTestA"
SUBST_TOOLS_DIR =
"${appexecfwk_path}/test/resource/amssystemtestability/abilitySrc/tools"
config("amsAbilityAppendTestAConfig") {
visibility = [ ":*" ]
include_dirs = [
"${SUBDEMOSYSTEM_DIR}/include",
"${aafwk_path}/frameworks/kits/appkit/native/app",
"${aafwk_path}/interfaces/innerkits/want/include/ohos/aafwk/content",
"${aafwk_path}/interfaces/innerkits/ability_manager/include",
"${innerkits_path}/libeventhandler/include",
"${services_path}/bundlemgr/include",
"${aafwk_path}/services/abilitymgr/include",
"${common_path}/log/include",
"//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include",
"${appexecfwk_path}/test/resource/amssystemtestability/abilitySrc/common",
"${SUBST_TOOLS_DIR}/include",
"//third_party/jsoncpp/include",
]
defines = [
"APP_LOG_TAG = \"amsAbilityAppendTestA\"",
"LOG_DOMAIN = 0xD002200",
]
cflags = []
if (target_cpu == "arm") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
}
ohos_shared_library("amsAbilityAppendTestA") {
sources = [
"${SUBDEMOSYSTEM_DIR}/src/main_ability.cpp",
"${SUBDEMOSYSTEM_DIR}/src/second_ability.cpp",
"${SUBDEMOSYSTEM_DIR}/src/test_utils.cpp",
]
configs = [ ":amsAbilityAppendTestAConfig" ]
deps = [
"${aafwk_path}/frameworks/kits/ability/native:abilitykit_native",
"${aafwk_path}/frameworks/kits/ability/native:dummy_classes",
"${aafwk_path}/frameworks/kits/appkit:appkit_native",
"${aafwk_path}/interfaces/innerkits/app_manager:app_manager",
"${aafwk_path}/interfaces/innerkits/want:want",
"${common_path}:libappexecfwk_common",
"${innerkits_path}/appexecfwk_base:appexecfwk_base",
"${innerkits_path}/appexecfwk_core:appexecfwk_core",
"${services_path}/bundlemgr:libbms",
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_dataability:native_dataability",
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_rdb:native_rdb",
"//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
"//third_party/jsoncpp:jsoncpp",
"//utils/native/base:utilsbase",
]
external_deps = [
"ces_standard:cesfwk_innerkits",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
subsystem_name = "amssystemtestability"
}

View File

@ -0,0 +1,53 @@
{
"app":{
"bundleName": "com.ohos.amsst.AppAppendA",
"vendor": "ix",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 3,
"target": 3
}
},
"deviceConfig": {
"default": {
}
},
"module": {
"package":"com.ohos.AppAppendA.src",
"name":"MainAbility",
"deviceType": [
"tv",
"car"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "testability",
"moduleType": "entry"
},
"abilities": [{
"name": "MainAbility",
"icon": "$media:snowball",
"srcLanguage": "c++",
"label": "Main Ability",
"launchType": "standard",
"orientation": "unspecified",
"type": "page",
"visible": true,
"skills": [
]
},
{
"name": "SecondAbility",
"icon": "$media:snowflakes",
"srcLanguage": "c++",
"label": "Second Ability",
"launchType": "standard",
"orientation": "unspecified",
"type": "service",
"visible": true
}]
}
}

View File

@ -0,0 +1,123 @@
/*
* Copyright (c) 2021 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.
*/
#ifndef AMS_ABILITY_APPEND_TEST_A_MAIN_ABILITY_H
#define AMS_ABILITY_APPEND_TEST_A_MAIN_ABILITY_H
#include "ability.h"
#include "ability_loader.h"
#include "common_event.h"
#include "common_event_manager.h"
#include "ability_append_test_info.h"
namespace OHOS {
namespace AppExecFwk {
using namespace OHOS::EventFwk;
class FirstEventSubscriber;
class MainAbility : public Ability {
public:
void SubscribeEvent();
void TestAbility(int apiIndex, int caseIndex, int code);
void OnSetCallerCase1(int code);
void TerminateAndRemoveMissonCase1(int code);
void TerminateAbilityResultCase1(int code);
void GetDispalyOrientationCase1(int code);
void GetPreferencesDirCase1(int code);
void StartAbilitiesCase1(int code);
void GetColorModeCase1(int code);
void SetColorModeCase1(int code);
void IsFirstInMissionCase1(int code);
MainAbility()
{
mapCase_ = {
{(int)AppendApi::OnSetCaller,
{
[this](int code) { OnSetCallerCase1(code); },
}},
{(int)AppendApi::TerminateAndRemoveMisson,
{
[this](int code) { TerminateAndRemoveMissonCase1(code); },
}},
{(int)AppendApi::TerminateAbilityResult,
{
[this](int code) { TerminateAbilityResultCase1(code); },
}},
{(int)AppendApi::GetDispalyOrientation,
{
[this](int code) { GetDispalyOrientationCase1(code); },
}},
{(int)AppendApi::GetPreferencesDir,
{
[this](int code) { GetPreferencesDirCase1(code); },
}},
{(int)AppendApi::StartAbilities,
{
[this](int code) { StartAbilitiesCase1(code); },
}},
{(int)AppendApi::GetColorMode,
{
[this](int code) { GetColorModeCase1(code); },
}},
{(int)AppendApi::SetColorMode,
{
[this](int code) { SetColorModeCase1(code); },
}},
{(int)AppendApi::IsFirstInMission,
{
[this](int code) { IsFirstInMissionCase1(code); },
}},
};
}
std::unordered_map<int, std::vector<std::function<void(int)>>> mapCase_;
~MainAbility();
protected:
void Init(const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<OHOSApplication> &application,
std::shared_ptr<AbilityHandler> &handler, const sptr<IRemoteObject> &token) override;
virtual void OnStart(const Want &want) override;
virtual void OnStop() override;
virtual void OnActive() override;
virtual void OnInactive() override;
virtual void OnBackground() override;
virtual void OnForeground(const Want &want) override;
virtual Uri OnSetCaller() override;
std::shared_ptr<FirstEventSubscriber> subscriber_;
};
class FirstEventSubscriber : public EventFwk::CommonEventSubscriber {
public:
explicit FirstEventSubscriber(const EventFwk::CommonEventSubscribeInfo &sp) : CommonEventSubscriber(sp)
{
mapTestFunc_ = {
{"Ability", [this](int apiIndex, int caseIndex, int code) { TestAbility(apiIndex, caseIndex, code); }},
};
mainAbility = nullptr;
}
void TestAbility(int apiIndex, int caseIndex, int code)
{
mainAbility->TestAbility(apiIndex, caseIndex, code);
}
virtual void OnReceiveEvent(const EventFwk::CommonEventData &data);
MainAbility *mainAbility;
std::unordered_map<std::string, std::function<void(int, int, int)>> mapTestFunc_;
~FirstEventSubscriber() = default;
};
} // namespace AppExecFwk
} // namespace OHOS
#endif // AMS_ABILITY_APPEND_TEST_A_MAIN_ABILITY_H

View File

@ -0,0 +1,84 @@
/*
* Copyright (c) 2021 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.
*/
#ifndef AMS_ABILITY_APPEND_TEST_A_SECOND_ABILITY_H
#define AMS_ABILITY_APPEND_TEST_A_SECOND_ABILITY_H
#include "ability.h"
#include "ability_loader.h"
#include "common_event.h"
#include "common_event_manager.h"
#include "ability_append_test_info.h"
namespace OHOS {
namespace AppExecFwk {
using namespace OHOS::EventFwk;
class SecondEventSubscriber;
class SecondAbility : public Ability {
public:
void SubscribeEvent();
void TestAbility(int apiIndex, int caseIndex, int code);
void TerminateAbilityResultCase1(int code);
SecondAbility()
{
mapCase_ = {
{(int)AppendApi::TerminateAbilityResult,
{
[this](int code) { TerminateAbilityResultCase1(code); },
}},
};
}
std::unordered_map<int, std::vector<std::function<void(int)>>> mapCase_;
~SecondAbility();
protected:
void Init(const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<OHOSApplication> &application,
std::shared_ptr<AbilityHandler> &handler, const sptr<IRemoteObject> &token) override;
virtual void OnStart(const Want &want) override;
virtual void OnStop() override;
virtual void OnActive() override;
virtual void OnInactive() override;
virtual void OnBackground() override;
virtual void OnForeground(const Want &want) override;
virtual void OnCommand(const AAFwk::Want &want, bool restart, int startId) override;
virtual sptr<IRemoteObject> OnConnect(const Want &want) override;
virtual void OnDisconnect(const Want &want) override;
std::shared_ptr<SecondEventSubscriber> subscriber_;
};
class SecondEventSubscriber : public EventFwk::CommonEventSubscriber {
public:
explicit SecondEventSubscriber(const EventFwk::CommonEventSubscribeInfo &sp) : CommonEventSubscriber(sp)
{
mapTestFunc_ = {
{"Ability", [this](int apiIndex, int caseIndex, int code) { TestAbility(apiIndex, caseIndex, code); }},
};
mainAbility = nullptr;
}
void TestAbility(int apiIndex, int caseIndex, int code)
{
mainAbility->TestAbility(apiIndex, caseIndex, code);
}
virtual void OnReceiveEvent(const EventFwk::CommonEventData &data);
SecondAbility *mainAbility;
std::unordered_map<std::string, std::function<void(int, int, int)>> mapTestFunc_;
~SecondEventSubscriber() = default;
};
} // namespace AppExecFwk
} // namespace OHOS
#endif // AMS_ABILITY_APPEND_TEST_A_SECOND_ABILITY_H

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2021 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.
*/
#ifndef TEST_UTILS_H
#define TEST_UTILS_H
#include "ability_info.h"
#include "ability_lifecycle.h"
#include "application_info.h"
#include "process_info.h"
#include "want.h"
namespace OHOS {
namespace AppExecFwk {
const int OnStateChangedEventWant = LifeCycle::Event::UNDEFINED;
const int OnStateChangedEvent = (int)LifeCycle::Event::UNDEFINED + 1;
const int requestCodeForTerminate = 10;
const int requestCodeForResult = 20;
class TestUtils {
public:
TestUtils() = default;
virtual ~TestUtils() = default;
static bool PublishEvent(const std::string &eventName, const int &code, const std::string &data);
static Want MakeWant(std::string deviceId, std::string abilityName, std::string bundleName,
std::map<std::string, std::string> params);
static std::vector<std::string> split(const std::string &in, const std::string &delim);
};
} // namespace AppExecFwk
} // namespace OHOS
#endif // TEST_UTILS_H

View File

@ -0,0 +1,212 @@
/*
* Copyright (c) 2021 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 "main_ability.h"
#include "app_log_wrapper.h"
#include "test_utils.h"
namespace OHOS {
namespace AppExecFwk {
using namespace OHOS::EventFwk;
namespace {
constexpr int numZero = 0;
constexpr int numOne = 1;
constexpr int numTwo = 2;
constexpr int numThree = 3;
}
void MainAbility::Init(const std::shared_ptr<AbilityInfo> &abilityInfo,
const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler,
const sptr<IRemoteObject> &token)
{
APP_LOGI("MainAbility::Init");
Ability::Init(abilityInfo, application, handler, token);
}
MainAbility::~MainAbility()
{
CommonEventManager::UnSubscribeCommonEvent(subscriber_);
}
void MainAbility::OnStart(const Want &want)
{
APP_LOGI("MainAbility::onStart");
SubscribeEvent();
Ability::OnStart(want);
TestUtils::PublishEvent(g_EVENT_RESP_FIRST_LIFECYCLE, MAIN_ABILITY_A_CODE, "onStart");
}
void MainAbility::OnStop()
{
APP_LOGI("MainAbility::OnStop");
Ability::OnStop();
CommonEventManager::UnSubscribeCommonEvent(subscriber_);
TestUtils::PublishEvent(g_EVENT_RESP_FIRST_LIFECYCLE, MAIN_ABILITY_A_CODE, "OnStop");
}
void MainAbility::OnActive()
{
APP_LOGI("MainAbility::OnActive");
Ability::OnActive();
TestUtils::PublishEvent(g_EVENT_RESP_FIRST_LIFECYCLE, MAIN_ABILITY_A_CODE, "OnActive");
}
void MainAbility::OnInactive()
{
APP_LOGI("MainAbility::OnInactive");
Ability::OnInactive();
TestUtils::PublishEvent(g_EVENT_RESP_FIRST_LIFECYCLE, MAIN_ABILITY_A_CODE, "OnInactive");
}
void MainAbility::OnBackground()
{
APP_LOGI("MainAbility::OnBackground");
Ability::OnBackground();
TestUtils::PublishEvent(g_EVENT_RESP_FIRST_LIFECYCLE, MAIN_ABILITY_A_CODE, "OnBackground");
}
void MainAbility::OnForeground(const Want &want)
{
APP_LOGI("MainAbility::OnForeground");
Ability::OnForeground(want);
TestUtils::PublishEvent(g_EVENT_RESP_FIRST_LIFECYCLE, MAIN_ABILITY_A_CODE, "OnForeground");
}
Uri MainAbility::OnSetCaller()
{
APP_LOGI("MainAbility::OnSetCaller");
TestUtils::PublishEvent(g_EVENT_RESP_FIRST_LIFECYCLE, MAIN_ABILITY_A_CODE, "OnSetCaller");
return Ability::OnSetCaller();
}
void MainAbility::SubscribeEvent()
{
std::vector<std::string> eventList = {
g_EVENT_REQU_FIRST,
};
MatchingSkills matchingSkills;
for (const auto &e : eventList) {
matchingSkills.AddEvent(e);
}
CommonEventSubscribeInfo subscribeInfo(matchingSkills);
subscribeInfo.SetPriority(1);
subscriber_ = std::make_shared<FirstEventSubscriber>(subscribeInfo);
subscriber_->mainAbility = this;
CommonEventManager::SubscribeCommonEvent(subscriber_);
}
void FirstEventSubscriber::OnReceiveEvent(const CommonEventData &data)
{
APP_LOGI("FirstEventSubscriber::OnReceiveEvent:event=%{public}s", data.GetWant().GetAction().c_str());
APP_LOGI("FirstEventSubscriber::OnReceiveEvent:data=%{public}s", data.GetData().c_str());
APP_LOGI("FirstEventSubscriber::OnReceiveEvent:code=%{public}d", data.GetCode());
auto eventName = data.GetWant().GetAction();
if (std::strcmp(eventName.c_str(), g_EVENT_REQU_FIRST.c_str()) == 0) {
auto target = data.GetData();
auto caseInfo = TestUtils::split(target, "_");
if (caseInfo.size() < numThree) {
return;
}
if (mapTestFunc_.find(caseInfo[numZero]) != mapTestFunc_.end()) {
mapTestFunc_[caseInfo[numZero]](std::stoi(caseInfo[numOne]), std::stoi(caseInfo[numTwo]), data.GetCode());
} else {
APP_LOGI("OnReceiveEvent: CommonEventData error(%{public}s)", target.c_str());
}
}
}
void MainAbility::TestAbility(int apiIndex, int caseIndex, int code)
{
APP_LOGI("MainAbility::TestAbility");
if (mapCase_.find(apiIndex) != mapCase_.end()) {
if (caseIndex < (int)mapCase_[apiIndex].size()) {
mapCase_[apiIndex][caseIndex](code);
}
}
}
void MainAbility::OnSetCallerCase1(int code)
{
bool result = true;
TestUtils::PublishEvent(g_EVENT_RESP_FIRST, code, std::to_string(result));
}
void MainAbility::TerminateAndRemoveMissonCase1(int code)
{
bool result = true;
TestUtils::PublishEvent(g_EVENT_RESP_FIRST, code, std::to_string(result));
TerminateAndRemoveMission();
}
void MainAbility::TerminateAbilityResultCase1(int code)
{
bool result = TerminateAbilityResult(1);
TestUtils::PublishEvent(g_EVENT_RESP_FIRST, code, std::to_string(result));
}
void MainAbility::GetDispalyOrientationCase1(int code)
{
bool result = true;
int orientation = GetDisplayOrientation();
result = orientation == static_cast<int>(DisplayOrientation::UNSPECIFIED);
TestUtils::PublishEvent(g_EVENT_RESP_FIRST, code, std::to_string(result));
}
void MainAbility::GetPreferencesDirCase1(int code)
{
bool result = true;
string preferencesDir = GetPreferencesDir();
result = !preferencesDir.empty();
result = result && (bool)preferencesDir.find(this->GetBundleName());
result = result && (bool)preferencesDir.find("com.ohos.amsst.AppAppendA/files/MainAbility/preferences");
TestUtils::PublishEvent(g_EVENT_RESP_FIRST, code, std::to_string(result));
}
void MainAbility::StartAbilitiesCase1(int code)
{
bool result = true;
std::map<std::string, std::string> params;
Want want1 = TestUtils::MakeWant("", "SecondAbility", "com.ohos.amsst.AppAppendA", params);
Want want2 = TestUtils::MakeWant("", "MainAbility", "com.ohos.amsst.AppAppendB", params);
std::vector<Want> wants = {want1, want2};
AbilityContext::StartAbilities(wants);
TestUtils::PublishEvent(g_EVENT_RESP_FIRST, code, std::to_string(result));
}
void MainAbility::GetColorModeCase1(int code)
{
int colormode = GetColorMode();
bool result = colormode == static_cast<int>(ModuleColorMode::AUTO);
TestUtils::PublishEvent(g_EVENT_RESP_FIRST, code, std::to_string(result));
}
void MainAbility::SetColorModeCase1(int code)
{
SetColorMode((int)ModuleColorMode::DARK);
int colormode = GetColorMode();
bool result = colormode == static_cast<int>(ModuleColorMode::DARK);
TestUtils::PublishEvent(g_EVENT_RESP_FIRST, code, std::to_string(result));
}
void MainAbility::IsFirstInMissionCase1(int code)
{
bool result = IsFirstInMission();
TestUtils::PublishEvent(g_EVENT_RESP_FIRST, code, std::to_string(result));
}
REGISTER_AA(MainAbility)
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,165 @@
/*
* Copyright (c) 2021 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 "second_ability.h"
#include "app_log_wrapper.h"
#include "test_utils.h"
namespace OHOS {
namespace AppExecFwk {
using namespace OHOS::EventFwk;
namespace {
constexpr int numZero = 0;
constexpr int numOne = 1;
constexpr int numTwo = 2;
constexpr int numThree = 3;
}
void SecondAbility::Init(const std::shared_ptr<AbilityInfo> &abilityInfo,
const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler,
const sptr<IRemoteObject> &token)
{
APP_LOGI("SecondAbility::Init");
Ability::Init(abilityInfo, application, handler, token);
}
SecondAbility::~SecondAbility()
{
CommonEventManager::UnSubscribeCommonEvent(subscriber_);
}
void SecondAbility::OnStart(const Want &want)
{
APP_LOGI("SecondAbility::onStart");
SubscribeEvent();
Ability::OnStart(want);
TestUtils::PublishEvent(g_EVENT_RESP_SECOND_LIFECYCLE, SECOND_ABILITY_A_CODE, "onStart");
}
void SecondAbility::OnStop()
{
APP_LOGI("SecondAbility::OnStop");
Ability::OnStop();
CommonEventManager::UnSubscribeCommonEvent(subscriber_);
TestUtils::PublishEvent(g_EVENT_RESP_SECOND_LIFECYCLE, SECOND_ABILITY_A_CODE, "OnStop");
}
void SecondAbility::OnActive()
{
APP_LOGI("SecondAbility::OnActive");
Ability::OnActive();
TestUtils::PublishEvent(g_EVENT_RESP_SECOND_LIFECYCLE, SECOND_ABILITY_A_CODE, "OnActive");
}
void SecondAbility::OnInactive()
{
APP_LOGI("SecondAbility::OnInactive");
Ability::OnInactive();
TestUtils::PublishEvent(g_EVENT_RESP_SECOND_LIFECYCLE, SECOND_ABILITY_A_CODE, "OnInactive");
}
void SecondAbility::OnBackground()
{
APP_LOGI("SecondAbility::OnBackground");
Ability::OnBackground();
TestUtils::PublishEvent(g_EVENT_RESP_SECOND_LIFECYCLE, SECOND_ABILITY_A_CODE, "OnBackground");
}
void SecondAbility::OnForeground(const Want &want)
{
APP_LOGI("SecondAbility::OnForeground");
Ability::OnForeground(want);
TestUtils::PublishEvent(g_EVENT_RESP_SECOND_LIFECYCLE, SECOND_ABILITY_A_CODE, "OnForeground");
}
void SecondAbility::OnCommand(const AAFwk::Want &want, bool restart, int startId)
{
APP_LOGI("AmsStServiceAbilityA1::OnCommand");
Ability::OnCommand(want, restart, startId);
TestUtils::PublishEvent(g_EVENT_RESP_SECOND_LIFECYCLE, SECOND_ABILITY_A_CODE, "OnActive");
}
sptr<IRemoteObject> SecondAbility::OnConnect(const Want &want)
{
APP_LOGI("AmsStServiceAbilityA1::OnConnect");
sptr<IRemoteObject> ret = Ability::OnConnect(want);
TestUtils::PublishEvent(g_EVENT_RESP_SECOND_LIFECYCLE, SECOND_ABILITY_A_CODE, "OnActive");
return ret;
}
void SecondAbility::OnDisconnect(const Want &want)
{
APP_LOGI("AmsStServiceAbilityA1::OnDisconnect");
Ability::OnDisconnect(want);
TestUtils::PublishEvent(g_EVENT_RESP_SECOND_LIFECYCLE, SECOND_ABILITY_A_CODE, "OnDisconnect");
}
void SecondAbility::SubscribeEvent()
{
std::vector<std::string> eventList = {
g_EVENT_REQU_SECOND,
};
MatchingSkills matchingSkills;
for (const auto &e : eventList) {
matchingSkills.AddEvent(e);
}
CommonEventSubscribeInfo subscribeInfo(matchingSkills);
subscribeInfo.SetPriority(1);
subscriber_ = std::make_shared<SecondEventSubscriber>(subscribeInfo);
subscriber_->mainAbility = this;
CommonEventManager::SubscribeCommonEvent(subscriber_);
}
void SecondEventSubscriber::OnReceiveEvent(const CommonEventData &data)
{
APP_LOGI("SecondEventSubscriber::OnReceiveEvent:event=%{public}s", data.GetWant().GetAction().c_str());
APP_LOGI("SecondEventSubscriber::OnReceiveEvent:data=%{public}s", data.GetData().c_str());
APP_LOGI("SecondEventSubscriber::OnReceiveEvent:code=%{public}d", data.GetCode());
auto eventName = data.GetWant().GetAction();
if (std::strcmp(eventName.c_str(), g_EVENT_REQU_SECOND.c_str()) == 0) {
auto target = data.GetData();
auto caseInfo = TestUtils::split(target, "_");
if (caseInfo.size() < numThree) {
return;
}
if (mapTestFunc_.find(caseInfo[numZero]) != mapTestFunc_.end()) {
mapTestFunc_[caseInfo[numZero]](std::stoi(caseInfo[numOne]), std::stoi(caseInfo[numTwo]), data.GetCode());
} else {
APP_LOGI("OnReceiveEvent: CommonEventData error(%{public}s)", target.c_str());
}
}
}
void SecondAbility::TestAbility(int apiIndex, int caseIndex, int code)
{
APP_LOGI("SecondAbility::TestAbility");
if (mapCase_.find(apiIndex) != mapCase_.end()) {
if (caseIndex < (int)mapCase_[apiIndex].size()) {
mapCase_[apiIndex][caseIndex](code);
}
}
}
void SecondAbility::TerminateAbilityResultCase1(int code)
{
bool result = TerminateAbilityResult(1);
TestUtils::PublishEvent(g_EVENT_RESP_SECOND, code, std::to_string(result));
}
REGISTER_AA(SecondAbility)
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,56 @@
/*
* Copyright (c) 2021 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 "test_utils.h"
#include <iostream>
#include <numeric>
#include <sstream>
#include <regex>
#include "common_event_data.h"
#include "common_event_manager.h"
namespace OHOS {
namespace AppExecFwk {
using namespace OHOS::EventFwk;
bool TestUtils::PublishEvent(const std::string &eventName, const int &code, const std::string &data)
{
Want want;
want.SetAction(eventName);
CommonEventData commonData;
commonData.SetWant(want);
commonData.SetCode(code);
commonData.SetData(data);
return CommonEventManager::PublishCommonEvent(commonData);
}
Want TestUtils::MakeWant(
std::string deviceId, std::string abilityName, std::string bundleName, std::map<std::string, std::string> params)
{
ElementName element(deviceId, bundleName, abilityName);
Want want;
want.SetElement(element);
for (const auto &param : params) {
want.SetParam(param.first, param.second);
}
return want;
}
std::vector<std::string> TestUtils::split(const std::string &in, const std::string &delim)
{
std::regex reg {delim};
return std::vector<std::string> {
std::sregex_token_iterator(in.begin(), in.end(), reg, -1), std::sregex_token_iterator()
};
}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,71 @@
# Copyright (c) 2021 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/ohos.gni")
import("//foundation/appexecfwk/standard/appexecfwk.gni")
SUBDEMOSYSTEM_DIR = "${appexecfwk_path}/test/resource/amssystemtestability/abilitySrc/amsAbilityAppendTestB"
SUBST_TOOLS_DIR =
"${appexecfwk_path}/test/resource/amssystemtestability/abilitySrc/tools"
config("amsAbilityAppendTestBConfig") {
visibility = [ ":*" ]
include_dirs = [
"${SUBDEMOSYSTEM_DIR}/include",
"${aafwk_path}/frameworks/kits/appkit/native/app",
"${aafwk_path}/interfaces/innerkits/want/include/ohos/aafwk/content",
"${aafwk_path}/interfaces/innerkits/ability_manager/include",
"${innerkits_path}/libeventhandler/include",
"${services_path}/bundlemgr/include",
"${aafwk_path}/services/abilitymgr/include",
"${common_path}/log/include",
"//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include",
"${appexecfwk_path}/test/resource/amssystemtestability/abilitySrc/common",
"${SUBST_TOOLS_DIR}/include",
"//third_party/jsoncpp/include",
]
defines = [
"APP_LOG_TAG = \"amsAbilityAppendTestB\"",
"LOG_DOMAIN = 0xD002200",
]
cflags = []
if (target_cpu == "arm") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
}
ohos_shared_library("amsAbilityAppendTestB") {
sources = [
"${SUBDEMOSYSTEM_DIR}/src/main_ability.cpp",
"${SUBDEMOSYSTEM_DIR}/src/test_utils.cpp",
]
configs = [ ":amsAbilityAppendTestBConfig" ]
deps = [
"${aafwk_path}/frameworks/kits/ability/native:abilitykit_native",
"${aafwk_path}/frameworks/kits/ability/native:dummy_classes",
"${aafwk_path}/frameworks/kits/appkit:appkit_native",
"${aafwk_path}/interfaces/innerkits/app_manager:app_manager",
"${aafwk_path}/interfaces/innerkits/want:want",
"${common_path}:libappexecfwk_common",
"${innerkits_path}/appexecfwk_base:appexecfwk_base",
"${innerkits_path}/appexecfwk_core:appexecfwk_core",
"${services_path}/bundlemgr:libbms",
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_dataability:native_dataability",
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_rdb:native_rdb",
"//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
"//third_party/jsoncpp:jsoncpp",
"//utils/native/base:utilsbase",
]
external_deps = [
"ces_standard:cesfwk_innerkits",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
subsystem_name = "amssystemtestability"
}

View File

@ -0,0 +1,43 @@
{
"app":{
"bundleName": "com.ohos.amsst.AppAppendB",
"vendor": "ix",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 3,
"target": 3
}
},
"deviceConfig": {
"default": {
}
},
"module": {
"package":"com.ohos.AppAppendB.src",
"name":"MainAbility",
"deviceType": [
"tv",
"car"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "testability",
"moduleType": "entry"
},
"abilities": [{
"name": "MainAbility",
"icon": "$media:snowball",
"srcLanguage": "c++",
"label": "Main Ability",
"launchType": "standard",
"orientation": "unspecified",
"type": "page",
"visible": true,
"skills": [
]
}]
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2021 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.
*/
#ifndef AMS_ABILITY_APPEND_TEST_B_MAIN_ABILITY_H
#define AMS_ABILITY_APPEND_TEST_B_MAIN_ABILITY_H
#include "ability.h"
#include "ability_loader.h"
#include "common_event.h"
#include "common_event_manager.h"
#include "ability_append_test_info.h"
namespace OHOS {
namespace AppExecFwk {
using namespace OHOS::EventFwk;
class FirstEventSubscriber;
class MainAbility : public Ability {
public:
MainAbility()
{
mapCase_ = {};
}
void SubscribeEvent();
void TestAbility(int apiIndex, int caseIndex, int code);
~MainAbility();
std::unordered_map<int, std::vector<std::function<void(int)>>> mapCase_;
protected:
void Init(const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<OHOSApplication> &application,
std::shared_ptr<AbilityHandler> &handler, const sptr<IRemoteObject> &token) override;
virtual void OnStart(const Want &want) override;
virtual void OnStop() override;
virtual void OnActive() override;
virtual void OnInactive() override;
virtual void OnBackground() override;
virtual void OnForeground(const Want &want) override;
std::shared_ptr<FirstEventSubscriber> subscriber_;
};
class FirstEventSubscriber : public EventFwk::CommonEventSubscriber {
public:
explicit FirstEventSubscriber(const EventFwk::CommonEventSubscribeInfo &sp) : CommonEventSubscriber(sp)
{
mapTestFunc_ = {
{"Ability", [this](int apiIndex, int caseIndex, int code) { TestAbility(apiIndex, caseIndex, code); }},
};
mainAbility = nullptr;
}
void TestAbility(int apiIndex, int caseIndex, int code)
{
mainAbility->TestAbility(apiIndex, caseIndex, code);
}
virtual void OnReceiveEvent(const EventFwk::CommonEventData &data);
MainAbility *mainAbility;
std::unordered_map<std::string, std::function<void(int, int, int)>> mapTestFunc_;
~FirstEventSubscriber(){};
};
} // namespace AppExecFwk
} // namespace OHOS
#endif // AMS_ABILITY_APPEND_TEST_B_MAIN_ABILITY_H

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2021 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.
*/
#ifndef TEST_UTILS_H
#define TEST_UTILS_H
#include "ability_info.h"
#include "ability_lifecycle.h"
#include "application_info.h"
#include "process_info.h"
#include "want.h"
namespace OHOS {
namespace AppExecFwk {
const int OnStateChangedEventWant = LifeCycle::Event::UNDEFINED;
const int OnStateChangedEvent = (int)LifeCycle::Event::UNDEFINED + 1;
const int requestCodeForTerminate = 10;
const int requestCodeForResult = 20;
class TestUtils {
public:
TestUtils() = default;
virtual ~TestUtils() = default;
static bool PublishEvent(const std::string &eventName, const int &code, const std::string &data);
static Want MakeWant(std::string deviceId, std::string abilityName, std::string bundleName,
std::map<std::string, std::string> params);
static std::vector<std::string> split(const std::string &in, const std::string &delim);
};
} // namespace AppExecFwk
} // namespace OHOS
#endif // TEST_UTILS_H

View File

@ -0,0 +1,135 @@
/*
* Copyright (c) 2021 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 "main_ability.h"
#include "app_log_wrapper.h"
#include "test_utils.h"
namespace OHOS {
namespace AppExecFwk {
using namespace OHOS::EventFwk;
namespace {
constexpr int numZero = 0;
constexpr int numOne = 1;
constexpr int numTwo = 2;
constexpr int numThree = 3;
}
void MainAbility::Init(const std::shared_ptr<AbilityInfo> &abilityInfo,
const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler,
const sptr<IRemoteObject> &token)
{
APP_LOGI("MainAbility::Init");
Ability::Init(abilityInfo, application, handler, token);
}
void MainAbility::OnStart(const Want &want)
{
APP_LOGI("MainAbility::onStart");
SubscribeEvent();
Ability::OnStart(want);
TestUtils::PublishEvent(g_EVENT_RESP_FIRSTB_LIFECYCLE, MAIN_ABILITY_B_CODE, "onStart");
}
void MainAbility::OnStop()
{
APP_LOGI("MainAbility::OnStop");
Ability::OnStop();
CommonEventManager::UnSubscribeCommonEvent(subscriber_);
TestUtils::PublishEvent(g_EVENT_RESP_FIRSTB_LIFECYCLE, MAIN_ABILITY_B_CODE, "OnStop");
}
void MainAbility::OnActive()
{
APP_LOGI("MainAbility::OnActive");
Ability::OnActive();
TestUtils::PublishEvent(g_EVENT_RESP_FIRSTB_LIFECYCLE, MAIN_ABILITY_B_CODE, "OnActive");
}
void MainAbility::OnInactive()
{
APP_LOGI("MainAbility::OnInactive");
Ability::OnInactive();
TestUtils::PublishEvent(g_EVENT_RESP_FIRSTB_LIFECYCLE, MAIN_ABILITY_B_CODE, "OnInactive");
}
void MainAbility::OnBackground()
{
APP_LOGI("MainAbility::OnBackground");
Ability::OnBackground();
TestUtils::PublishEvent(g_EVENT_RESP_FIRSTB_LIFECYCLE, MAIN_ABILITY_B_CODE, "OnBackground");
}
void MainAbility::OnForeground(const Want &want)
{
APP_LOGI("MainAbility::OnForeground");
Ability::OnForeground(want);
TestUtils::PublishEvent(g_EVENT_RESP_FIRSTB_LIFECYCLE, MAIN_ABILITY_B_CODE, "OnForeground");
}
MainAbility::~MainAbility()
{
CommonEventManager::UnSubscribeCommonEvent(subscriber_);
}
void MainAbility::SubscribeEvent()
{
std::vector<std::string> eventList = {
g_EVENT_REQU_FIRSTB,
};
MatchingSkills matchingSkills;
for (const auto &e : eventList) {
matchingSkills.AddEvent(e);
}
CommonEventSubscribeInfo subscribeInfo(matchingSkills);
subscribeInfo.SetPriority(1);
subscriber_ = std::make_shared<FirstEventSubscriber>(subscribeInfo);
subscriber_->mainAbility = this;
CommonEventManager::SubscribeCommonEvent(subscriber_);
}
void FirstEventSubscriber::OnReceiveEvent(const CommonEventData &data)
{
APP_LOGI("FirstEventSubscriber::OnReceiveEvent:event=%{public}s", data.GetWant().GetAction().c_str());
APP_LOGI("FirstEventSubscriber::OnReceiveEvent:data=%{public}s", data.GetData().c_str());
APP_LOGI("FirstEventSubscriber::OnReceiveEvent:code=%{public}d", data.GetCode());
auto eventName = data.GetWant().GetAction();
if (std::strcmp(eventName.c_str(), g_EVENT_REQU_FIRSTB.c_str()) == 0) {
auto target = data.GetData();
auto caseInfo = TestUtils::split(target, "_");
if (caseInfo.size() < numThree) {
return;
}
if (mapTestFunc_.find(caseInfo[numZero]) != mapTestFunc_.end()) {
mapTestFunc_[caseInfo[numZero]](std::stoi(caseInfo[numOne]), std::stoi(caseInfo[numTwo]), data.GetCode());
} else {
APP_LOGI("OnReceiveEvent: CommonEventData error(%{public}s)", target.c_str());
}
}
}
void MainAbility::TestAbility(int apiIndex, int caseIndex, int code)
{
APP_LOGI("MainAbility::TestAbility");
if (mapCase_.find(apiIndex) != mapCase_.end()) {
if (caseIndex < (int)mapCase_[apiIndex].size()) {
mapCase_[apiIndex][caseIndex](code);
}
}
}
REGISTER_AA(MainAbility)
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,56 @@
/*
* Copyright (c) 2021 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 "test_utils.h"
#include <iostream>
#include <numeric>
#include <sstream>
#include <regex>
#include "common_event_data.h"
#include "common_event_manager.h"
namespace OHOS {
namespace AppExecFwk {
using namespace OHOS::EventFwk;
bool TestUtils::PublishEvent(const std::string &eventName, const int &code, const std::string &data)
{
Want want;
want.SetAction(eventName);
CommonEventData commonData;
commonData.SetWant(want);
commonData.SetCode(code);
commonData.SetData(data);
return CommonEventManager::PublishCommonEvent(commonData);
}
Want TestUtils::MakeWant(
std::string deviceId, std::string abilityName, std::string bundleName, std::map<std::string, std::string> params)
{
ElementName element(deviceId, bundleName, abilityName);
Want want;
want.SetElement(element);
for (const auto &param : params) {
want.SetParam(param.first, param.second);
}
return want;
}
std::vector<std::string> TestUtils::split(const std::string &in, const std::string &delim)
{
std::regex reg {delim};
return std::vector<std::string> {
std::sregex_token_iterator(in.begin(), in.end(), reg, -1), std::sregex_token_iterator()
};
}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -0,0 +1,73 @@
# Copyright (c) 2021 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/ohos.gni")
SUBDEMOSYSTEM_DIR = "//foundation/appexecfwk/standard/test/resource/amssystemtestability/abilitySrc/amsAbilityVisibleTestPageA"
SUBST_TOOLS_DIR = "//foundation/appexecfwk/standard/test/resource/amssystemtestability/abilitySrc/tools"
config("amsAbilityVisibleTestPageAConfig") {
visibility = [ ":*" ]
include_dirs = [
"${SUBDEMOSYSTEM_DIR}/include",
"//base/notification/ans_standard/interfaces/innerkits/wantagent/include",
"//foundation/appexecfwk/standard/kits/appkit/native/app",
"//foundation/aafwk/standard/frameworks/kits/appkit/native/ability_runtime",
"//foundation/aafwk/standard/frameworks/kits/appkit/native/app",
"//foundation/aafwk/standard/interfaces/innerkits/want/include/ohos/aafwk/content",
"//foundation/aafwk/standard/interfaces/innerkits/ability_manager/include",
"//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler/include",
"//foundation/appexecfwk/standard/services/bundlemgr/include",
"//foundation/aafwk/standard/services/abilitymgr/include",
"//foundation/appexecfwk/standard/common/log/include",
"//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include",
"${SUBST_TOOLS_DIR}/include",
]
defines = [
"APP_LOG_TAG = \"amsAbilityVisibleTestPageA\"",
"LOG_DOMAIN = 0xD002200",
]
}
ohos_shared_library("amsAbilityVisibleTestPageA") {
sources = [
"${SUBDEMOSYSTEM_DIR}/src/amsabilityvisibletestpagea1.cpp",
"${SUBDEMOSYSTEM_DIR}/src/amsabilityvisibletestpagea2.cpp",
"${SUBDEMOSYSTEM_DIR}/src/amsabilityvisibletestpagea3.cpp",
"${SUBDEMOSYSTEM_DIR}/src/amsabilityvisibletestpagea4.cpp",
"${SUBST_TOOLS_DIR}/src/stpageabilityevent.cpp",
]
configs = [ ":amsAbilityVisibleTestPageAConfig" ]
deps = [
"//base/notification/ans_standard/frameworks/wantagent:wantagent_innerkits",
"//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
"//foundation/aafwk/standard/frameworks/kits/appkit:app_context",
"//foundation/aafwk/standard/frameworks/kits/appkit:appkit_native",
"//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager",
"//foundation/aafwk/standard/interfaces/innerkits/app_manager:app_manager",
"//foundation/aafwk/standard/interfaces/innerkits/want:want",
"//foundation/appexecfwk/standard/common:libappexecfwk_common",
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core",
"//foundation/appexecfwk/standard/services/bundlemgr:libbms",
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_dataability:native_dataability",
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_rdb:native_rdb",
"//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
"//utils/native/base:utilsbase",
]
external_deps = [
"ces_standard:cesfwk_core",
"ces_standard:cesfwk_innerkits",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"native_appdatamgr:native_dataability",
"native_appdatamgr:native_rdb",
]
subsystem_name = "amssystemtestability"
}

View File

@ -0,0 +1,70 @@
{
"app":{
"bundleName": "com.ohos.amsst.appAbilityVisiblePageA",
"vendor": "ix",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 3,
"target": 3
}
},
"deviceConfig": {
"default": {
}
},
"module": {
"package":"com.hos.AmsSystemTestR.src",
"name":"AmsSystemTestR",
"deviceType": [
"tv",
"car"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "testability",
"moduleType": "entry"
},
"abilities": [{
"name": "AmsAbilityVisibleTestPageA1",
"icon": "$media:snowball",
"srcLanguage": "c++",
"label": "AmsAbilityVisibleTestPageA1 Ability",
"launchType": "standard",
"orientation": "unspecified",
"type": "page",
"visible": false
},
{
"name": "AmsAbilityVisibleTestPageA2",
"icon": "$media:snowball",
"srcLanguage": "c++",
"label": "AmsAbilityVisibleTestPageA2 Ability",
"launchType": "standard",
"orientation": "unspecified",
"type": "page",
"visible": true
},
{
"name": "AmsAbilityVisibleTestPageA3",
"icon": "$media:snowball",
"srcLanguage": "c++",
"label": "AmsAbilityVisibleTestPageA3 Ability",
"launchType": "singleton",
"orientation": "unspecified",
"type": "page",
"visible": false
},
{
"name": "AmsAbilityVisibleTestPageA4",
"icon": "$media:snowball",
"srcLanguage": "c++",
"label": "AmsAbilityVisibleTestPageA4 Ability",
"launchType": "standard",
"orientation": "unspecified",
"type": "page"
}]
}
}

View File

@ -0,0 +1,87 @@
/*
* Copyright (c) 2021 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.
*/
#ifndef AMS_ABILITY_VISIBLE_TEST_PAGE_A1
#define AMS_ABILITY_VISIBLE_TEST_PAGE_A1
#include "stpageabilityevent.h"
#include <string>
#include <thread>
#include "ability_connect_callback_stub.h"
#include "ability_connect_callback_proxy.h"
#include "abs_shared_result_set.h"
#include "ability_loader.h"
#include "app_log_wrapper.h"
#include "data_ability_predicates.h"
#include "values_bucket.h"
namespace OHOS {
namespace AppExecFwk {
using AbilityConnectionStub = OHOS::AAFwk::AbilityConnectionStub;
using Uri = OHOS::Uri;
class AbilityConnectCallback : public AbilityConnectionStub {
public:
/**
* OnAbilityConnectDone, AbilityMs notify caller ability the result of connect.
*
* @param element,.service ability's ElementName.
* @param remoteObject,.the session proxy of service ability.
* @param resultCode, ERR_OK on success, others on failure.
*/
void OnAbilityConnectDone(
const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int resultCode) override
{
APP_LOGI("AbilityConnectCallback::OnAbilityConnectDone:resultCode = %{public}d", resultCode);
}
/**
* OnAbilityDisconnectDone, AbilityMs notify caller ability the result of disconnect.
*
* @param element,.service ability's ElementName.
* @param resultCode, ERR_OK on success, others on failure.
*/
void OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) override
{
APP_LOGI("AbilityConnectCallback::OnAbilityDisconnectDone:resultCode = %{public}d", resultCode);
}
};
class AmsAbilityVisibleTestPageA1 : public Ability {
protected:
virtual void Init(const std::shared_ptr<AbilityInfo> &abilityInfo,
const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler,
const sptr<IRemoteObject> &token) override;
virtual void OnStart(const Want &want) override;
virtual void OnStop() override;
virtual void OnActive() override;
virtual void OnInactive() override;
virtual void OnBackground() override;
virtual void OnForeground(const Want &want) override;
virtual void OnNewWant(const Want &want) override;
private:
void Clear();
void GetWantInfo(const Want &want);
std::string Split(std::string &str, std::string delim);
std::string targetType_;
std::string targetBundle_;
std::string targetAbility_;
sptr<AbilityConnectCallback> stub_;
STPageAbilityEvent pageAbilityEvent;
};
} // namespace AppExecFwk
} // namespace OHOS
#endif // AMS_ABILITY_VISIBLE_TEST_PAGE_A1

Some files were not shown because too many files have changed in this diff Show More