提交 12a42860 编写于 作者: I inter515

修改编译问题

Signed-off-by: Ninter515 <ry.renyi@huawei.com>
上级 22214bca
......@@ -15,7 +15,7 @@
import router from '@system.router';
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index";
import testsuite from "../test/List.test.ets";
import featureAbility from "@ohos.ability.featureAbility";
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, it, expect } from 'deccjsunit/index.ets';
import { describe, it, expect } from 'deccjsunit/index';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import { describe, it, expect } from 'deccjsunit/index.ets';
import { describe, it, expect } from 'deccjsunit/index';
import Utils from './Utils';
import bundleManager from '@ohos.bundle';
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, it, expect } from 'deccjsunit/index.ets';
import { describe, it, expect } from 'deccjsunit/index';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
......@@ -20,14 +20,6 @@ const BUNDLE_NAME = 'com.open.harmony.packagemag';
const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error';
const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility';
const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility';
const ABILITY = {
bundleName: BUNDLE_NAME,
name: ABILITY_NAME
}
const ABILITY_ERROR = {
bundleName: BUNDLE_NAME_ERROR,
name: ABILITY_NAME_ERROR
}
export default function isAbilityEnabledETSUnit() {
......@@ -40,9 +32,10 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('isAbilityEnabled_test_0100', 0, async function (done) {
let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME,ABILITY_NAME);
let timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isAbilityEnabled(ABILITY).then((data) => {
await Bundle.isAbilityEnabled(abilityInfo).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
mData = data;
......@@ -62,9 +55,10 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('isAbilityEnabled_test_0200', 0, async function (done) {
let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME,ABILITY_NAME);
let timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isAbilityEnabled(ABILITY, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo, (error, data) => {
if (error) {
console.error('[isAbilityEnabled_test_0200]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
......@@ -86,9 +80,10 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('isAbilityEnabled_test_0300', 0, async function (done) {
let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME_ERROR,ABILITY_NAME_ERROR);
let timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.isAbilityEnabled(ABILITY_ERROR).then((data) => {
await Bundle.isAbilityEnabled(abilityInfo).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
mData = data;
......@@ -110,9 +105,10 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
*/
it('isAbilityEnabled_test_0400', 0, async function (done) {
let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME_ERROR,ABILITY_NAME_ERROR);
let timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.isAbilityEnabled(ABILITY_ERROR, (error, data) => {
Bundle.isAbilityEnabled(abilityInfo, (error, data) => {
if (error) {
console.error('[isAbilityEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
......@@ -144,6 +140,48 @@ export default function isAbilityEnabledETSUnit() {
expect(data).assertEqual(false);
}
function generateAbilityInfoForTest(bundleName, name) {
let map1 = new Map([
["", [{
"name": "", "value": "", "extra": ""
}]]
]);
let abilityInfo = {
bundleName: bundleName,
name: name,
label: "",
description: "",
icon: "",
labelId: 0,
descriptionId: 0,
iconId: 0,
moduleName: "",
process: "",
targetAbility: "",
backgroundModes: 0,
isVisible: true,
formEnabled: true,
type: 0,
subType: 0,
orientation: 0,
launchMode: 0,
permissions: [],
deviceTypes: [],
deviceCapabilities: [],
readPermission: "",
writePermission: "",
applicationInfo: {
name: "", description: "", descriptionId: 0, systemApp: true, enabled: true, label: "",
labelId: "", icon: "", iconId: "", process: "", supportedModes: 0, moduleSourceDirs: [],
permissions: [], moduleInfos: [], entryDir: "", codePath: "", metaData: map1,
removable: true, accessTokenId: 0, uid: 0, entityType: ""
},
uri: "", metaData: [], enabled: true
};
return abilityInfo;
}
})
}
\ No newline at end of file
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, it, expect } from 'deccjsunit/index.ets';
import { describe, it, expect } from 'deccjsunit/index';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll ,it, expect } from 'deccjsunit/index.ets';
import { describe, beforeAll ,it, expect } from 'deccjsunit/index';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
import account from '@ohos.account.osAccount';
......@@ -226,50 +226,6 @@ export default function applicationBundleJsunit() {
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0500_009
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it(TAG_TEST_0500_001, 0, async function (done) {
let errors;
let startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT').then((data) => {
console.info(TAG_TEST_0500_001 + 'noUserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
console.info(TAG_TEST_0500_001 + 'noUserId promise error is: ' + error);
errors = error;
expect(errors).assertEqual(1);
});
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_001, startTime, endTime);
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0500_0010
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it(TAG_TEST_0500_002, 0, async function (done) {
let errors;
let startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT', userId).then((data) => {
console.info(TAG_TEST_0500_002 + 'noUserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
console.info(TAG_TEST_0500_002 + 'UserId promise error is: ' + error);
errors = error;
expect(errors).assertEqual(1);
});
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
done();
});
function expectData(msg, data) {
console.info(msg + 'commonTest data length [' + data.length + ']');
for (let i = 0; i < data.length; i++) {
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, it, beforeAll, expect } from 'deccjsunit/index.ets';
import { describe, it, beforeAll, expect } from 'deccjsunit/index';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
import account from '@ohos.account.osAccount';
......@@ -254,26 +254,6 @@ export default function applicationBundleJsunit() {
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0500_002
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it(TAG_TEST_0500_002, 0, async function (done) {
let startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo('', 'Bundle.BundleFlag.GET_BUNDLE_DEFAULT', userId).then((data) => {
console.info(TAG_TEST_0500_002 + 'UserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
console.info(TAG_TEST_0500_002 + 'UserId promise error is: ' + error);
expect(error).assertEqual(1);
});
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
done();
});
/**
* @tc.number: bundle_getApplicationInfo_test_0600_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册