提交 75f5174b 编写于 作者: Z zhangyafei.echo

Description:Fix acts testcase of abilityinfo, hapmoduleinfo,...

Description:Fix acts testcase of abilityinfo, hapmoduleinfo, extensionabilityingo, applicationinfo since api9.
Sig:SIG_ApplicationFramework
Feature or BugFix: Feature
Binary Source: No
Signed-off-by: Nzhangyafei.echo <zhangyafei12@huawei.com>
Change-Id: I18566ad23a1f5bb61f13143129fbc072a33eab2a
上级 3204a6e3
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import bundleManager from '@ohos.bundle.bundleManager'
export default function abilityTest() {
describe('ActsglobalThis.abilityStageContextTest', function () {
......@@ -42,126 +42,163 @@ export default function abilityTest() {
})
function checkApplicationInfo(data) {
console.log("checkApplicationInfo start " + data);
console.log("checkApplicationInfo start " + JSON.stringify(data));
console.log("checkApplicationInfo name : " + data.name);
console.log("checkApplicationInfo description : " + data.description);
console.log("checkApplicationInfo descriptionId : " + data.descriptionId);
console.log("checkApplicationInfo systemApp : " + data.systemApp);
console.log("checkApplicationInfo enabled : " + data.enabled);
console.log("checkApplicationInfo label : " + data.label)
console.log("checkApplicationInfo labelId : " + data.labelId);
console.log("checkApplicationInfo icon : " + data.icon);
console.log("checkApplicationInfo iconId : " + data.iconId);
console.log("checkApplicationInfo process : " + data.process);
console.log("checkApplicationInfo supportedModes : " + data.supportedModes);
console.log("checkApplicationInfo moduleSourceDirs length : " + data.moduleSourceDirs.length);
for (var j = 0; j < data.moduleSourceDirs.length; j++) {
console.log("checkApplicationInfo data.moduleSourceDirs[" + j + "] : " + data.moduleSourceDirs[j]);
}
console.log("checkApplicationInfo permissions length : " + data.permissions.length);
for (var j = 0; j < data.permissions.length; j++) {
console.log("checkApplicationInfo data.permissions[" + j + "] : " + data.permissions[j]);
}
console.log("checkApplicationInfo moduleInfos length : " + data.moduleInfos.length);
for (var j = 0; j < data.moduleInfos.length; j++) {
console.log("checkApplicationInfo data.moduleInfos[" + j + "].moduleName : " +
data.moduleInfos[j].moduleName);
console.log("checkApplicationInfo data.moduleInfos[" + j + "].moduleSourceDir : " +
data.moduleInfos[j].moduleSourceDir);
}
console.log("checkApplicationInfo entryDir : " + data.entryDir);
console.log("checkApplicationInfo codePath : " + data.codePath);
console.log("checkApplicationInfo metadata size : " + data.metadata.size);
for (var j = 0; j < data.metadata.size; j++) {
console.log("checkApplicationInfo data.metadata[" + j + "] : " + data.metadata[j]);
}
console.log("checkApplicationInfo removable: " + data.removable);
console.log("checkApplicationInfo accessTokenId: " + data.accessTokenId);
console.log("checkApplicationInfo uid: " + data.uid);
console.log("checkApplicationInfo iconResource: " + JSON.stringify(data.iconResource));
console.log("checkApplicationInfo labelResource: " + JSON.stringify(data.labelResource));
console.log("checkApplicationInfo descriptionResource: " + JSON.stringify(data.descriptionResource));
console.log("checkApplicationInfo appDistributionType: " + data.appDistributionType);
console.log("checkApplicationInfo appProvisionType: " + data.appProvisionType);
console.log("checkApplicationInfo systemApp : " + data.systemApp);
console.log("checkApplicationInfo bundleType : " + data.bundleType);
console.log("checkApplicationInfo debug : " + data.debug);
expect(typeof (data)).assertEqual("object");
expect(typeof (data.name)).assertEqual("string");
expect(typeof (data.description)).assertEqual("string");
expect(typeof (data.descriptionId)).assertEqual("number");
expect(typeof (data.systemApp)).assertEqual("boolean");
expect(typeof (data.enabled)).assertEqual("boolean");
expect(typeof (data.label)).assertEqual("string");
expect(typeof (data.labelId)).assertEqual("string");
expect(typeof (data.labelId)).assertEqual("number");
expect(typeof (data.icon)).assertEqual("string");
expect(typeof (data.iconId)).assertEqual("string");
expect(typeof (data.iconId)).assertEqual("number");
expect(typeof (data.process)).assertEqual("string");
expect(typeof (data.supportedModes)).assertEqual("number");
expect(Array.isArray(data.permissions)).assertEqual(true);
expect(Array.isArray(data.moduleInfos)).assertEqual(true);
expect(typeof (data.codePath)).assertEqual("string");
expect(typeof (data.removable)).assertEqual("boolean");
expect(typeof (data.accessTokenId)).assertEqual("number");
expect(typeof (data.uid)).assertEqual("number");
expect(typeof (data.iconResource)).assertEqual("object");
expect(typeof (data.labelResource)).assertEqual("object");
expect(typeof (data.descriptionResource)).assertEqual("object");
expect(typeof (data.appDistributionType)).assertEqual("string");
expect(typeof (data.appProvisionType)).assertEqual("string");
expect(typeof (data.systemApp)).assertEqual("boolean");
expect(typeof (data.bundleType)).assertEqual("number");
expect(typeof (data.debug)).assertEqual("boolean");
console.log("checkApplicationInfo_expect_typeof_end")
expect(data.name).assertEqual("com.acts.stabilitystagecontext");
expect(data.description).assertEqual("$string:description_application");
expect(data.descriptionId).assertLarger(0);
expect(data.systemApp).assertEqual(true);
expect(data.enabled).assertEqual(true);
expect(data.label).assertEqual("$string:app_name");
expect(data.labelId.length).assertLarger(0);
expect(data.labelId).assertLarger(0);
expect(data.icon).assertEqual("$media:icon");
expect(data.iconId.length).assertLarger(0);
expect(data.iconId).assertLarger(0);
expect(data.process).assertEqual("com.acts.stabilitystagecontext");
expect(data.supportedModes).assertEqual(0);
expect(data.moduleInfos.length).assertEqual(1);
expect(data.moduleInfos[0].moduleName).assertEqual("com.acts.stabilitystagecontext");
expect(data.codePath).assertEqual("/data/app/el1/bundle/public/" +
"com.acts.stabilitystagecontext");
expect(data.permissions.length).assertEqual(0);
expect(data.codePath).assertEqual("/data/app/el1/bundle/public/com.acts.stabilitystagecontext");
expect(data.removable).assertEqual(true);
expect(data.accessTokenId).assertLarger(0);
expect(data.uid).assertLarger(0);
expect(data.iconResource.bundleName).assertEqual("com.acts.stabilitystagecontext");
expect(data.iconResource.moduleName).assertEqual("com.acts.stabilitystagecontext");
expect(data.iconResource.id).assertLarger(0);
expect(data.labelResource.bundleName).assertEqual("com.acts.stabilitystagecontext");
expect(data.labelResource.moduleName).assertEqual("com.acts.stabilitystagecontext");
expect(data.labelResource.id).assertLarger(0);
expect(data.descriptionResource.bundleName).assertEqual("com.acts.stabilitystagecontext");
expect(data.descriptionResource.moduleName).assertEqual("com.acts.stabilitystagecontext");
expect(data.descriptionResource.id).assertLarger(0);
expect(data.appDistributionType).assertEqual("os_integration");
expect(data.appProvisionType).assertEqual("release");
expect(data.systemApp).assertEqual(true);
expect(data.bundleType).assertEqual(0);
expect(data.debug).assertEqual(false);
console.log("checkApplicationInfo end " + data);
}
function checkHapModuleInfo(data) {
console.log("checkHapModuleInfo start " + JSON.stringify(data));
console.log("checkHapModuleInfo name : " + data.name);
console.log("checkHapModuleInfo description : " + data.description);
console.log("checkHapModuleInfo descriptionId : " + data.descriptionId);
console.log("checkHapModuleInfo icon : " + data.icon);
console.log("checkHapModuleInfo iconId : " + data.iconId);
console.log("checkHapModuleInfo label : " + data.label);
console.log("checkHapModuleInfo labelId : " + data.labelId);
console.log("checkHapModuleInfo iconId : " + data.iconId);
console.log("checkHapModuleInfo backgroundImg : " + data.backgroundImg);
console.log("checkHapModuleInfo supportedModes : " + data.supportedModes);
console.log("checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length);
for (var j = 0; j < data.reqCapabilities.length; j++) {
console.log("checkHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]);
}
console.log("checkHapModuleInfo description : " + data.description);
console.log("checkHapModuleInfo descriptionId : " + data.descriptionId);
console.log("checkHapModuleInfo mainElementName : " + data.mainElementName);
console.log("checkHapModuleInfo abilitiesInfo : " + JSON.stringify(data.abilitiesInfo));
console.log("checkHapModuleInfo extensionAbilitiesInfo : " + JSON.stringify(data.extensionAbilitiesInfo));
console.log("checkHapModuleInfo metadata : " + JSON.stringify(data.metadata));
console.log("checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length);
for (var j = 0; j < data.deviceTypes.length; j++) {
console.log("checkHapModuleInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]);
}
console.log("checkHapModuleInfo moduleName : " + data.moduleName);
console.log("checkHapModuleInfo mainAbilityName : " + data.mainAbilityName);
console.log("checkHapModuleInfo installationFree : " + data.installationFree);
console.log("checkHapModuleInfo hashValue : " + data.hashValue);
console.log("checkHapModuleInfo type : " + data.type);
console.log("checkHapModuleInfo dependencies length : " + data.dependencies.length);
for (var j = 0; j < data.dependencies.length; j++) {
console.log("checkHapModuleInfo data.dependencies[" + j + "] : " + data.dependencies[j]);
}
console.log("checkHapModuleInfo preloads length : " + data.preloads.length);
for (var j = 0; j < data.preloads.length; j++) {
console.log("checkHapModuleInfo data.preloads[" + j + "] : " + data.preloads[j]);
}
expect(typeof (data)).assertEqual("object");
expect(typeof (data.name)).assertEqual("string");
expect(typeof (data.description)).assertEqual("string");
expect(typeof (data.icon)).assertEqual("string");
expect(typeof (data.iconId)).assertEqual("number");
expect(typeof (data.label)).assertEqual("string");
expect(typeof (data.backgroundImg)).assertEqual("string");
expect(typeof (data.supportedModes)).assertEqual("number");
expect(Array.isArray(data.reqCapabilities)).assertEqual(true);
expect(typeof (data.labelId)).assertEqual("number");
expect(typeof (data.description)).assertEqual("string");
expect(typeof (data.descriptionId)).assertEqual("number");
expect(typeof (data.mainElementName)).assertEqual("string");
expect(Array.isArray(data.abilitiesInfo)).assertEqual(true);
expect(Array.isArray(data.extensionAbilitiesInfo)).assertEqual(true);
expect(Array.isArray(data.metadata)).assertEqual(true);
expect(Array.isArray(data.deviceTypes)).assertEqual(true);
expect(Array.isArray(data.abilityInfo)).assertEqual(true);
expect(typeof (data.moduleName)).assertEqual("string");
expect(typeof (data.mainAbilityName)).assertEqual("string");
expect(typeof (data.installationFree)).assertEqual("boolean");
expect(typeof (data.hashValue)).assertEqual("string");
expect(typeof (data.type)).assertEqual("number");
expect(Array.isArray(data.dependencies)).assertEqual(true);
expect(Array.isArray(data.preloads)).assertEqual(true);
console.log("checkHapModuleInfo_expect_typeof_end")
expect(data.name).assertEqual("com.acts.stabilitystagecontext");
expect(data.description).assertEqual("$string:phone_entry_dsc");
expect(data.descriptionId).assertEqual(16777221);
expect(data.icon).assertEqual("$media:icon");
expect(data.label).assertEqual("$string:entry_label");
expect(data.labelId).assertEqual(16777219);
expect(data.name).assertEqual('com.acts.stabilitystagecontext');
expect(data.icon).assertEqual('$media:icon');
expect(data.iconId).assertEqual(16777224);
expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0);
expect(data.reqCapabilities.length).assertEqual(0);
expect(data.deviceTypes.length).assertEqual(2);
expect(data.deviceTypes[0]).assertEqual("default");
expect(data.moduleName).assertEqual("com.acts.stabilitystagecontext")
expect(data.mainAbilityName).assertEqual("com.acts.stabilitystagecontext.MainAbility");
expect(data.installationFree).assertEqual(false);
expect(data.label).assertEqual('$string:entry_label');
expect(data.labelId).assertEqual(16777219);
expect(data.description).assertEqual('$string:phone_entry_dsc');
expect(data.descriptionId).assertEqual(16777221);
expect(data.mainElementName).assertEqual('com.acts.stabilitystagecontext.MainAbility');
expect(data.abilitiesInfo.length).assertEqual(1);
expect(data.abilitiesInfo[0].bundleName).assertEqual('com.acts.stabilitystagecontext');
expect(data.abilitiesInfo[0].moduleName).assertEqual('com.acts.stabilitystagecontext');
expect(data.extensionAbilitiesInfo.length).assertEqual(0);
expect(data.metadata.length).assertEqual(0);
expect(data.deviceTypes[0]).assertEqual('default');
expect(data.deviceTypes[1]).assertEqual('tablet');
expect(data.deviceTypes[2]).assertEqual('2in1');
expect(data.installationFree).assertEqual(false);
expect(data.hashValue).assertEqual('');
expect(data.type).assertEqual(bundleManager.ModuleType.ENTRY);
expect(data.dependencies.length).assertEqual(0);
expect(data.preloads.length).assertEqual(0);
console.log("checkHapModuleInfo end " + data);
}
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册