MangerAbilityJsunit.test.js 23.5 KB
Newer Older
C
chensi10 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * 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.
 */
C
chensi10 已提交
15 16
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
C
chensi10 已提交
17
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
C
chensi10 已提交
18

C
chensi10 已提交
19 20 21 22 23 24 25 26 27 28 29
var WeightReasonCode = {
    REASON_UNKNOWN: 0,
    WEIGHT_FOREGROUND: 100,
    WEIGHT_FOREGROUND_SERVICE: 125,
    WEIGHT_VISIBLE: 200,
    WEIGHT_PERCEPTIBLE: 230,
    WEIGHT_SERVICE: 300,
    WEIGHT_TOP_SLEEPING: 325,
    WEIGHT_CANT_SAVE_STATE: 350,
    WEIGHT_CACHED: 400,
    WEIGHT_GONE: 1000
C
chensi10 已提交
30
}
C
chensi10 已提交
31 32 33

var abilityNameList = [
    "com.ohos.launcher.MainAbility",
Z
zhaoyuan17 已提交
34
    "com.ohos.callui.ServiceAbility",
C
chensi10 已提交
35 36 37 38 39 40 41 42 43 44
    "com.example.SimulateFeatureAbilityFir",
    "com.example.VerifyActThirdAbility",
    "com.example.VerifyIoThirdAbility",
    "com.example.actsamstestfourthscene.MainAbility",
    "com.example.SimulateEntryAbilityFir"
]

var bundleNameList = [
    "com.ohos.launcher",
    "com.ohos.systemui",
Z
zhaoyuan17 已提交
45
    "com.ohos.callui",
C
chensi10 已提交
46 47 48 49 50 51
    "com.ix.simulate.feature",
    "com.ix.verify.io",
    "com.ix.simulate.entry",
    "com.example.actsamstestfourthscene",
    "com.ix.verify.act"
]
C
chensi10 已提交
52 53
describe('ActsAmsTestFourthScene', function () {
    console.info('----ActsAmsTestFourthScene----');
Z
zhaoyuan 已提交
54
    beforeAll(async function (done) {
Z
zhaoyuan17 已提交
55
        await featureAbility.startAbility(
C
chensi10 已提交
56 57 58 59 60 61 62 63 64 65 66
            {
                want:
                {
                    deviceId: "",
                    bundleName: "com.ohos.launcher",
                    abilityName: "com.ohos.launcher.MainAbility",
                    action: "action1",
                    entities: ["entity1"],
                    type: "MIMETYPE",
                    uri: "key={true,true,false}",
                    options:
C
chensi10 已提交
67
                        {},
C
chensi10 已提交
68
                    parameters:
C
chensi10 已提交
69
                        {},
C
chensi10 已提交
70 71 72
                },
            },
        );
Z
zhaoyuan 已提交
73 74 75 76 77 78 79 80
        var maxnum = 10, flag = 1;
        var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
        console.log('queryRecentAbilityMissionInfos data  ' + JSON.stringify(data));
        for (var i = 0; i < data.length; i++) {
            if (data[i].baseAbility.bundleName != 'com.example.actsamstestfourthscene' &&
                data[i].topAbility.bundleName != 'com.example.actsamstestfourthscene') {
                var info = abilitymanager.removeMission(data[i].id);
                console.log(' removeMission data  [' + info + ']');
C
chensi10 已提交
81
            }
Z
zhaoyuan 已提交
82
        };
Z
zhaoyuan17 已提交
83
        await featureAbility.startAbility(
C
chensi10 已提交
84 85 86 87 88 89 90 91 92 93 94
            {
                want:
                {
                    deviceId: "",
                    bundleName: "com.ix.verify.io",
                    abilityName: "com.example.VerifyIoThirdAbility",
                    action: "action1",
                    entities: ["entity1"],
                    type: "MIMETYPE",
                    uri: "key={true,true,false}",
                    options:
C
chensi10 已提交
95
                        {},
C
chensi10 已提交
96
                    parameters:
C
chensi10 已提交
97
                        {},
C
chensi10 已提交
98 99 100
                },
            },
        );
Z
zhaoyuan17 已提交
101
        await featureAbility.startAbility(
C
chensi10 已提交
102 103 104 105 106 107 108 109 110 111 112
            {
                want:
                {
                    deviceId: "",
                    bundleName: "com.ix.simulate.feature",
                    abilityName: "com.example.SimulateFeatureAbilityFir",
                    action: "action1",
                    entities: ["entity1"],
                    type: "MIMETYPE",
                    uri: "key={true,true,false}",
                    options:
C
chensi10 已提交
113
                        {},
C
chensi10 已提交
114
                    parameters:
C
chensi10 已提交
115
                        {},
C
chensi10 已提交
116 117 118
                },
            },
        );
Z
zhaoyuan17 已提交
119
        await featureAbility.startAbility(
C
chensi10 已提交
120 121 122 123 124 125 126 127 128 129 130
            {
                want:
                {
                    deviceId: "",
                    bundleName: "com.ix.verify.act",
                    abilityName: "com.example.VerifyActThirdAbility",
                    action: "action1",
                    entities: ["entity1"],
                    type: "MIMETYPE",
                    uri: "key={true,true,false}",
                    options:
C
chensi10 已提交
131
                        {},
C
chensi10 已提交
132
                    parameters:
C
chensi10 已提交
133
                        {},
C
chensi10 已提交
134 135 136
                },
            },
        );
Z
zhaoyuan17 已提交
137
        await featureAbility.startAbility(
C
chensi10 已提交
138 139 140 141 142 143 144 145 146 147 148
            {
                want:
                {
                    deviceId: "",
                    bundleName: "com.ix.simulate.entry",
                    abilityName: "com.example.SimulateEntryAbilityFir",
                    action: "action1",
                    entities: ["entity1"],
                    type: "MIMETYPE",
                    uri: "key={true,true,false}",
                    options:
C
chensi10 已提交
149
                        {},
C
chensi10 已提交
150
                    parameters:
C
chensi10 已提交
151
                        {},
C
chensi10 已提交
152 153 154
                },
            },
        );
Z
zhaoyuan17 已提交
155
        setTimeout(done(), 5000);
C
chensi10 已提交
156
    });
C
chensi10 已提交
157

Z
zhaoyuan17 已提交
158 159 160 161 162 163
    function timeout(done) {
        expect().assertFail();
        console.debug('Acts_Ams_test=========timeout========');
        done();
    }

Z
zhaoyuan17 已提交
164 165
    function sleep(delay) {
        var start = (new Date()).getTime();
Z
zhaoyuan17 已提交
166
        while ((new Date()).getTime() - start < delay) {
Z
zhaoyuan17 已提交
167 168 169 170
            continue;
        }
    }

C
chensi10 已提交
171 172 173 174 175
    /*
     * @tc.number    : Acts_Ams_test_4900
     * @tc.name      : getAllRunningProcesses : Get All Running Processes Info
     * @tc.desc      : Get All Running Processes Info(by Promise)
     */
C
chensi10 已提交
176
    it('Acts_Ams_test_4900', 0, async function (done) {
Z
zhaoyuan17 已提交
177 178 179
        console.info("sleep begin");
        sleep(5000);
        console.info("sleep end");
Z
zhaoyuan17 已提交
180 181 182 183
        var info = await abilitymanager.getAllRunningProcesses();
        console.info('getAllRunningProcesses data length [' + info.length + ']');
        console.info('Acts_Ams_test_4900 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
        expect(Array.isArray(info)).assertEqual(true);
Z
zhaoyuan17 已提交
184
        expect(info.length).assertEqual(7);
Z
zhaoyuan17 已提交
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
        for (var i = 0; i < info.length; i++) {
            expect(typeof (info[i].pid)).assertEqual("number");
            expect(info[i].pid).assertLarger(0);

            expect(typeof (info[i].processName)).assertEqual("string");
            expect(info[i].processName.length).assertLarger(0);
            expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);

            expect(Array.isArray(info[i].pkgList)).assertEqual(true);
            expect(info[i].pkgList.length).assertEqual(0);

            expect(typeof (info[i].uid)).assertEqual("number");
            expect(info[i].uid).assertLarger(0);

            expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
Z
zhaoyuan17 已提交
200
            expect(info[i].lastMemoryLevel).assertEqual(1);
Z
zhaoyuan17 已提交
201 202 203 204 205 206 207 208 209

            expect(typeof (info[i].weight)).assertEqual("number");
            expect(info[i].weight).assertEqual(-1);

            expect(typeof (info[i].weightReasonCode)).assertEqual("number");
            expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
        }
        done();
        setTimeout(timeout, 5000);
C
chensi10 已提交
210 211
    })

Z
zhaoyuan17 已提交
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
    /*
 * @tc.number    : Acts_Ams_test_8400
 * @tc.name      : getActiveProcessInfos : Get All Active Processes Info
 * @tc.desc      : Get All Active Processes Info(by Promise)
 */
    it('Acts_Ams_test_8400', 0, async function (done) {
        var info = await abilitymanager.getActiveProcessInfos();
        console.info('Acts_Ams_test_8400 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
        expect(Array.isArray(info)).assertEqual(true);
        expect(info.length).assertEqual(7);
        for (var i = 0; i < info.length; i++) {
            expect(typeof (info[i].pid)).assertEqual("number");
            expect(info[i].pid).assertLarger(0);

            expect(typeof (info[i].processName)).assertEqual("string");
            expect(info[i].processName.length).assertLarger(0);
            expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);

            expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
            expect(info[i].bundleNames.length).assertEqual(0);

            expect(typeof (info[i].uid)).assertEqual("number");
            expect(info[i].uid).assertLarger(0);
        }
        done();
        setTimeout(timeout, 5000);
    })

C
chensi10 已提交
240 241 242 243 244
    /*
     * @tc.number    : Acts_Ams_test_5300
     * @tc.name      : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
     * @tc.desc      : Query Recent Ability Mission Infos(by Promise)
     */
C
chensi10 已提交
245
    it('Acts_Ams_test_5300', 0, async function (done) {
C
chensi10 已提交
246
        var maxnum = 100, flag = 1;
C
chensi10 已提交
247
        var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
C
chensi10 已提交
248
        console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']');
C
chensi10 已提交
249
        expect(Array.isArray(data)).assertEqual(true);
C
chensi10 已提交
250
        expect(data.length).assertEqual(4);
C
chensi10 已提交
251
        for (var i = 0; i < data.length; i++) {
C
chensi10 已提交
252 253 254 255 256 257 258 259 260 261
            console.info('Acts_Ams_test_5300 queryRecentAbilityMissionInfos  id: \
                ' + data[i].id + ' baseAbility.deviceId: \
                ' + data[i].baseAbility.deviceId + ' baseAbility.bundleName: \
                ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: \
                ' + data[i].baseAbility.abilityName + ' topAbility.deviceId: \
                ' + data[i].topAbility.deviceId + ' topAbility.bundleName: \
                ' + data[i].topAbility.bundleName + ' topAbility.abilityName: \
                ' + data[i].topAbility.abilityName + ' missionDescription.label: \
                ' + data[i].missionDescription.label + ' missionDescription.iconPath: \
                ' + data[i].missionDescription.iconPath);
C
chensi10 已提交
262 263 264 265 266 267

            expect(typeof (data[i].id)).assertEqual("number");
            expect(data[i].id).assertLarger(0);

            expect(typeof (data[i].baseAbility)).assertEqual("object");
            expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
C
chensi10 已提交
268
            expect(data[i].baseAbility.deviceId.length).assertEqual(0);
C
chensi10 已提交
269 270
            expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
            expect(data[i].baseAbility.bundleName.length).assertLarger(0);
C
chensi10 已提交
271
            expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
C
chensi10 已提交
272 273
            expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
            expect(data[i].baseAbility.abilityName.length).assertLarger(0);
C
chensi10 已提交
274
            expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
C
chensi10 已提交
275 276 277 278 279

            expect(typeof (data[i].topAbility)).assertEqual("object");
            expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
            expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
            expect(data[i].topAbility.bundleName.length).assertLarger(0);
C
chensi10 已提交
280
            expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
C
chensi10 已提交
281 282
            expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
            expect(data[i].topAbility.abilityName.length).assertLarger(0);
C
chensi10 已提交
283
            expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
C
chensi10 已提交
284 285 286 287 288 289

            expect(typeof (data[i].missionDescription)).assertEqual("object");
            expect(typeof (data[i].missionDescription.label)).assertEqual("string");
            expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
        }
        done();
Z
zhaoyuan17 已提交
290
        setTimeout(timeout, 5000);
C
chensi10 已提交
291 292
    })

C
chensi10 已提交
293 294 295 296 297
    /*
     * @tc.number    : Acts_Ams_test_5100
     * @tc.name      : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
     * @tc.desc      : Query Running Ability Mission Infos(by Promise)
     */
C
chensi10 已提交
298 299 300
    it('Acts_Ams_test_5100', 0, async function (done) {
        var maxnum = 30;
        var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
C
chensi10 已提交
301
        console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']');
C
chensi10 已提交
302
        expect(Array.isArray(data)).assertEqual(true);
C
chensi10 已提交
303
        expect(data.length).assertEqual(4);
C
chensi10 已提交
304
        for (var i = 0; i < data.length; i++) {
C
chensi10 已提交
305 306 307 308 309 310 311 312 313 314
            console.info('Acts_Ams_test_5100 queryRunningAbilityMissionInfos  id: \
                ' + data[i].id + ' baseAbility.deviceId: \
                ' + data[i].baseAbility.deviceId + ' baseAbility.bundleName: \
                ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: \
                ' + data[i].baseAbility.abilityName + ' topAbility.deviceId: \
                ' + data[i].topAbility.deviceId + ' topAbility.bundleName: \
                ' + data[i].topAbility.bundleName + ' topAbility.abilityName: \
                ' + data[i].topAbility.abilityName + ' missionDescription.label: \
                ' + data[i].missionDescription.label + ' missionDescription.iconPath: \
                ' + data[i].missionDescription.iconPath);
C
chensi10 已提交
315 316 317 318 319 320

            expect(typeof (data[i].id)).assertEqual("number");
            expect(data[i].id).assertLarger(0);

            expect(typeof (data[i].baseAbility)).assertEqual("object");
            expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
C
chensi10 已提交
321
            expect(data[i].baseAbility.deviceId.length).assertEqual(0);
C
chensi10 已提交
322 323
            expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
            expect(data[i].baseAbility.bundleName.length).assertLarger(0);
C
chensi10 已提交
324
            expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
C
chensi10 已提交
325 326
            expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
            expect(data[i].baseAbility.abilityName.length).assertLarger(0);
C
chensi10 已提交
327
            expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
C
chensi10 已提交
328 329 330 331 332

            expect(typeof (data[i].topAbility)).assertEqual("object");
            expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
            expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
            expect(data[i].topAbility.bundleName.length).assertLarger(0);
C
chensi10 已提交
333
            expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
C
chensi10 已提交
334 335
            expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
            expect(data[i].topAbility.abilityName.length).assertLarger(0);
C
chensi10 已提交
336
            expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
C
chensi10 已提交
337 338 339 340 341 342

            expect(typeof (data[i].missionDescription)).assertEqual("object");
            expect(typeof (data[i].missionDescription.label)).assertEqual("string");
            expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
        }
        done();
Z
zhaoyuan17 已提交
343
        setTimeout(timeout, 5000);
C
chensi10 已提交
344 345
    })

Z
zhaoyuan17 已提交
346 347 348 349 350 351 352 353 354 355
    /*
     * @tc.number    : Acts_Ams_test_9400
     * @tc.name      : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
     * @tc.desc      : Get Active Ability Mission Infos(by Promise)
     */
    it('Acts_Ams_test_9400', 0, async function (done) {
        var upperLimit = 20;
        var data = await abilitymanager.getActiveAbilityMissionInfos(upperLimit);
        console.info('Acts_Ams_test_9400 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
        expect(Array.isArray(data)).assertEqual(true);
Z
zhaoyuan17 已提交
356
        expect(data.length).assertEqual(4);
Z
zhaoyuan17 已提交
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
        for (var i = 0; i < data.length; i++) {
            expect(typeof (data[i].missionId)).assertEqual("number");
            expect(data[i].missionId).assertLarger(0);

            expect(typeof (data[i].bottomAbility)).assertEqual("object");
            expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
            expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
            expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
            expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
            expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
            expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
            expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
            expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
            expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
            expect(data[i].bottomAbility.uri.length).assertEqual(0);
            expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
            expect(data[i].bottomAbility.shortName.length).assertEqual(0);

            expect(typeof (data[i].topAbility)).assertEqual("object");
            expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
            expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
            expect(data[i].topAbility.bundleName.length).assertLarger(0);
            expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
            expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
            expect(data[i].topAbility.abilityName.length).assertLarger(0);
            expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
            expect(typeof (data[i].topAbility.uri)).assertEqual("string");
            expect(data[i].topAbility.uri.length).assertEqual(0);
            expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
            expect(data[i].topAbility.shortName.length).assertEqual(0);

            expect(typeof (data[i].windowMode)).assertEqual("number");
            expect(data[i].windowMode).assertEqual(0);
        }
        done();
        setTimeout(timeout, 5000);
    })

    /*
     * @tc.number    : Acts_Ams_test_10400
     * @tc.name      : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
     * @tc.desc      : Get Previous Ability Mission Infos(by Promise)
     */
    it('Acts_Ams_test_10400', 0, async function (done) {
        var upperLimit = 20;
        var data = await abilitymanager.getPreviousAbilityMissionInfos(upperLimit);
        console.info('Acts_Ams_test_10400 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
        expect(Array.isArray(data)).assertEqual(true);
Z
zhaoyuan17 已提交
405
        expect(data.length).assertEqual(4);
Z
zhaoyuan17 已提交
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
        for (var i = 0; i < data.length; i++) {
            expect(typeof (data[i].missionId)).assertEqual("number");
            expect(data[i].missionId).assertLarger(0);

            expect(typeof (data[i].bottomAbility)).assertEqual("object");
            expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
            expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
            expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
            expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
            expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
            expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
            expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
            expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
            expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
            expect(data[i].bottomAbility.uri.length).assertEqual(0);
            expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
            expect(data[i].bottomAbility.shortName.length).assertEqual(0);

            expect(typeof (data[i].topAbility)).assertEqual("object");
            expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
            expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
            expect(data[i].topAbility.bundleName.length).assertLarger(0);
            expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
            expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
            expect(data[i].topAbility.abilityName.length).assertLarger(0);
            expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
            expect(typeof (data[i].topAbility.uri)).assertEqual("string");
            expect(data[i].topAbility.uri.length).assertEqual(0);
            expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
            expect(data[i].topAbility.shortName.length).assertEqual(0);

            expect(typeof (data[i].windowMode)).assertEqual("number");
            expect(data[i].windowMode).assertEqual(0);
        }
        done();
        setTimeout(timeout, 5000);
    })

Z
zhaoyuan17 已提交
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
    /*
     * @tc.number    : Acts_Ams_test_5500
     * @tc.name      : removeMission : Remove Mission
     * @tc.desc      : Remove Mission(by Promise)
     */
    it('Acts_Ams_test_5500', 0, async function (done) {
        var maxnum = 30;
        var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
        var info = await abilitymanager.removeMission(result[0].id);
        console.info('Acts_Ams_test_5500 removeMission data  [' + info + ']');
        expect(typeof (info)).assertEqual("number");
        expect(info).assertEqual(0);
        done();
        setTimeout(timeout, 5000);
    })

    /*
     * @tc.number    : Acts_Ams_test_5900
     * @tc.name      : moveMissionToTop : Move Mission To Top
     * @tc.desc      : Move Mission To Top(by Promise)
     */
    it('Acts_Ams_test_5900', 0, async function (done) {
        var maxnum = 30;
        var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
        var info = await abilitymanager.moveMissionToTop(result[0].id);
        console.info('Acts_Ams_test_5900 moveMissionToTop data  [' + info + ']');
        expect(typeof (info)).assertEqual("number");
        expect(info).assertEqual(0);
        done();
        setTimeout(timeout, 5000);
    })

    /*
     * @tc.number    : Acts_Ams_test_6100
     * @tc.name      : removeMissions: Remove Missions
     * @tc.desc      : Remove Missions(by Promise)
     */
    it('Acts_Ams_test_6100', 0, async function (done) {
        var maxnum = 30;
        var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
        var info = await abilitymanager.removeMissions([result[0].id, result[1].id]);
        console.info('Acts_Ams_test_6100 removeMissions data  [' + info + ']');
        expect(typeof (info)).assertEqual("number");
        expect(info).assertEqual(0);
        done();
        setTimeout(timeout, 5000);
    })

    /*
     * @tc.number    : Acts_Ams_test_6300
     * @tc.name      : killProcessesByBundleName : Kill Processes By BundleName
     * @tc.desc      : Kill Processes By BundleName(by Promise)
     */
    it('Acts_Ams_test_6300', 0, async function (done) {
        var info = await abilitymanager.killProcessesByBundleName('xxxxxxxxxxxx');
        console.info('Acts_Ams_test_6300 killProcessesByBundleName data  [' + info + ']');
        expect(typeof (info)).assertEqual("number");
        expect(info).assertEqual(0);
        done();
        setTimeout(timeout, 5000);
    })
C
chensi10 已提交
505
})