bundlemanager code Inspection

Signed-off-by: xinking129 <xinxin13@huawei.com>
This commit is contained in:
xinking129 2024-06-14 14:34:09 +08:00
parent aaa1d44696
commit b7cb334961
4 changed files with 211 additions and 11 deletions

View File

@ -22,6 +22,7 @@ import { hilog } from '@kit.PerformanceAnalysisKit';
const TAG: string = '[Sample_BundleManager]';
const DOMAIN_NUMBER: number = 0xFF00;
const abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
let resourceManager = abilityDelegator.getAppContext().resourceManager;
async function sleep(time: number) {
return new Promise<void>((resolve: Function) => setTimeout(resolve, time));
@ -57,7 +58,8 @@ export default function abilityTest() {
hilog.info(DOMAIN_NUMBER, TAG, 'driver err ' + JSON.stringify(driver));
startAbility();
await sleep(2000);
let registerBtn = await driver.findComponent(ON.text('获取BundleInfo'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.GetBundleInfoTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(1000);
@ -77,7 +79,8 @@ export default function abilityTest() {
hilog.info(DOMAIN_NUMBER, TAG, 'BundleManager_GetBundleInfoForSelfSync_002 start');
let driver = Driver.create();
await sleep(1000);
let registerBtn = await driver.findComponent(ON.text('获取BundleInfo(sync)'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.GetBundleInfoSyncTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(1000);
@ -97,7 +100,8 @@ export default function abilityTest() {
hilog.info(DOMAIN_NUMBER, TAG, 'BundleManager_GetProfileByAbility_004 start');
let driver = Driver.create();
await sleep(1000);
let registerBtn = await driver.findComponent(ON.text('获取配置json'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.GetConfigurationJsonTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(1000);
@ -117,7 +121,8 @@ export default function abilityTest() {
hilog.info(DOMAIN_NUMBER, TAG, 'BundleManager_GetProfileByExtensionAbility_005 start');
let driver = Driver.create();
await sleep(1000);
let registerBtn = await driver.findComponent(ON.text('获取配置数组'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.GetConfigurationArrayTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(2000);
@ -137,7 +142,8 @@ export default function abilityTest() {
hilog.info(DOMAIN_NUMBER, TAG, 'BundleManager_GetProfileByExtensionAbilitySync_006 start');
let driver = Driver.create();
await sleep(2000);
let registerBtn = await driver.findComponent(ON.text('获取配置json(sync)'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.GetConfigurationJsonSyncTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(1000);
@ -157,7 +163,8 @@ export default function abilityTest() {
hilog.info(DOMAIN_NUMBER, TAG, 'BundleManager_CanOpenLink_007 start');
let driver = Driver.create();
await sleep(1000);
let registerBtn = await driver.findComponent(ON.text('校验链接是否可打开'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.VerifyLinkOpenedTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(1000);
@ -178,7 +185,8 @@ export default function abilityTest() {
let driver = Driver.create();
await sleep(1000);
await driver.swipe(360, 1070, 360, 600);
let registerBtn = await driver.findComponent(ON.text('判断默认应用'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.DetermineDefaultApplicationTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(1000);
@ -198,7 +206,8 @@ export default function abilityTest() {
hilog.info(DOMAIN_NUMBER, TAG, 'DefaultAppMgr_IsDefaultApplicationSync_009 start');
let driver = Driver.create();
await sleep(1000);
let registerBtn = await driver.findComponent(ON.text('判断默认应用(sync)'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.DetermineDefaultApplicationSyncTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(1000);
@ -218,7 +227,8 @@ export default function abilityTest() {
hilog.info(DOMAIN_NUMBER, TAG, 'Overlay_SetOverlayEnabled_010 start');
let driver = Driver.create();
await sleep(1000);
let registerBtn = await driver.findComponent(ON.text('设置禁用使能状态'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.SetDisableEnableStatusTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(1000);
@ -238,7 +248,8 @@ export default function abilityTest() {
hilog.info(DOMAIN_NUMBER, TAG, 'Overlay_GetOverlayModuleInfo_011 start');
let driver = Driver.create();
await sleep(1000);
let registerBtn = await driver.findComponent(ON.text('获取overlayModuleInfo信息'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.ObtainOverlayModuleInfoInformationTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(1000);
@ -258,7 +269,8 @@ export default function abilityTest() {
hilog.info(DOMAIN_NUMBER, TAG, 'Overlay_GetTargetOverlayModuleInfos_012 start');
let driver = Driver.create();
await sleep(1000);
let registerBtn = await driver.findComponent(ON.text('获取多条overlayModuleInfo信息'));
let registerBtn = await driver.findComponent(ON.text(
await resourceManager.getStringValue($r('app.string.ObtainMultipleOverlayModuleInfoInformationTest'))));
await sleep(1000);
await registerBtn.click();
await sleep(1000);

View File

@ -11,6 +11,58 @@
{
"name": "TestAbility_label",
"value": "test label"
},
{
"name": "GetBundleInfoTest",
"value": "获取BundleInfo"
},
{
"name": "GetBundleInfoSyncTest",
"value": "获取BundleInfo(sync)"
},
{
"name": "GetConfigurationJsonTest",
"value": "获取配置json"
},
{
"name": "GetConfigurationArrayTest",
"value": "获取配置数组"
},
{
"name": "GetConfigurationJsonSyncTest",
"value": "获取配置json(sync)"
},
{
"name": "VerifyFileTest",
"value": "校验.abc文件"
},
{
"name": "DeleteFileTest",
"value": "删除.abc文件"
},
{
"name": "VerifyLinkOpenedTest",
"value": "校验链接是否可打开"
},
{
"name": "DetermineDefaultApplicationTest",
"value": "判断默认应用"
},
{
"name": "DetermineDefaultApplicationSyncTest",
"value": "判断默认应用(sync)"
},
{
"name": "SetDisableEnableStatusTest",
"value": "设置禁用使能状态"
},
{
"name": "ObtainOverlayModuleInfoInformationTest",
"value": "获取overlayModuleInfo信息"
},
{
"name": "ObtainMultipleOverlayModuleInfoInformationTest",
"value": "获取多条overlayModuleInfo信息"
}
]
}

View File

@ -0,0 +1,68 @@
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test label"
},
{
"name": "GetBundleInfoTest",
"value": "GetBundleInfo"
},
{
"name": "GetBundleInfoSyncTest",
"value": "GetBundleInfoSync"
},
{
"name": "GetConfigurationJsonTest",
"value": "GetConfigurationJson"
},
{
"name": "GetConfigurationArrayTest",
"value": "GetConfigurationArray"
},
{
"name": "GetConfigurationJsonSyncTest",
"value": "GetConfigurationJsonSync"
},
{
"name": "VerifyFileTest",
"value": "VerifyFile"
},
{
"name": "DeleteFileTest",
"value": "DeleteFile"
},
{
"name": "VerifyLinkOpenedTest",
"value": "VerifyLinkOpened"
},
{
"name": "DetermineDefaultApplicationTest",
"value": "DetermineDefaultApplication"
},
{
"name": "DetermineDefaultApplicationSyncTest",
"value": "DetermineDefaultApplicationSync"
},
{
"name": "SetDisableEnableStatusTest",
"value": "SetDisableEnableStatus"
},
{
"name": "ObtainOverlayModuleInfoInformationTest",
"value": "ObtainOverlayModuleInfoInformation"
},
{
"name": "ObtainMultipleOverlayModuleInfoInformationTest",
"value": "ObtainMultipleOverlayModuleInfoInformation"
}
]
}

View File

@ -0,0 +1,68 @@
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test label"
},
{
"name": "GetBundleInfoTest",
"value": "获取BundleInfo"
},
{
"name": "GetBundleInfoSyncTest",
"value": "获取BundleInfo(sync)"
},
{
"name": "GetConfigurationJsonTest",
"value": "获取配置json"
},
{
"name": "GetConfigurationArrayTest",
"value": "获取配置数组"
},
{
"name": "GetConfigurationJsonSyncTest",
"value": "获取配置json(sync)"
},
{
"name": "VerifyFileTest",
"value": "校验.abc文件"
},
{
"name": "DeleteFileTest",
"value": "删除.abc文件"
},
{
"name": "VerifyLinkOpenedTest",
"value": "校验链接是否可打开"
},
{
"name": "DetermineDefaultApplicationTest",
"value": "判断默认应用"
},
{
"name": "DetermineDefaultApplicationSyncTest",
"value": "判断默认应用(sync)"
},
{
"name": "SetDisableEnableStatusTest",
"value": "设置禁用使能状态"
},
{
"name": "ObtainOverlayModuleInfoInformationTest",
"value": "获取overlayModuleInfo信息"
},
{
"name": "ObtainMultipleOverlayModuleInfoInformationTest",
"value": "获取多条overlayModuleInfo信息"
}
]
}