MangerAbilityJsunit.test.js 23.2 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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

var abilityNameList = [
    "com.ohos.launcher.MainAbility",
    "com.example.SimulateFeatureAbilityFir",
    "com.example.VerifyActThirdAbility",
    "com.example.VerifyIoThirdAbility",
    "com.example.actsamstestfourthscene.MainAbility",
    "com.example.SimulateEntryAbilityFir"
]

var bundleNameList = [
    "com.ohos.launcher",
    "com.ohos.systemui",
    "com.ix.simulate.feature",
    "com.ix.verify.io",
    "com.ix.simulate.entry",
    "com.example.actsamstestfourthscene",
    "com.ix.verify.act"
]
C
chensi10 已提交
50 51
describe('ActsAmsTestFourthScene', function () {
    console.info('----ActsAmsTestFourthScene----');
Z
zhaoyuan 已提交
52
    beforeAll(async function (done) {
Z
zhaoyuan17 已提交
53
        await featureAbility.startAbility(
C
chensi10 已提交
54 55 56 57 58 59 60 61 62 63 64
            {
                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 已提交
65
                        {},
C
chensi10 已提交
66
                    parameters:
C
chensi10 已提交
67
                        {},
C
chensi10 已提交
68 69 70
                },
            },
        );
Z
zhaoyuan 已提交
71 72 73 74 75 76 77 78
        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 已提交
79
            }
Z
zhaoyuan 已提交
80
        };
Z
zhaoyuan17 已提交
81
        await featureAbility.startAbility(
C
chensi10 已提交
82 83 84 85 86 87 88 89 90 91 92
            {
                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 已提交
93
                        {},
C
chensi10 已提交
94
                    parameters:
C
chensi10 已提交
95
                        {},
C
chensi10 已提交
96 97 98
                },
            },
        );
Z
zhaoyuan17 已提交
99
        await featureAbility.startAbility(
C
chensi10 已提交
100 101 102 103 104 105 106 107 108 109 110
            {
                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 已提交
111
                        {},
C
chensi10 已提交
112
                    parameters:
C
chensi10 已提交
113
                        {},
C
chensi10 已提交
114 115 116
                },
            },
        );
Z
zhaoyuan17 已提交
117
        await featureAbility.startAbility(
C
chensi10 已提交
118 119 120 121 122 123 124 125 126 127 128
            {
                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 已提交
129
                        {},
C
chensi10 已提交
130
                    parameters:
C
chensi10 已提交
131
                        {},
C
chensi10 已提交
132 133 134
                },
            },
        );
Z
zhaoyuan17 已提交
135
        await featureAbility.startAbility(
C
chensi10 已提交
136 137 138 139 140 141 142 143 144 145 146
            {
                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 已提交
147
                        {},
C
chensi10 已提交
148
                    parameters:
C
chensi10 已提交
149
                        {},
C
chensi10 已提交
150 151 152
                },
            },
        );
Z
zhaoyuan17 已提交
153
        setTimeout(done(), 5000);
C
chensi10 已提交
154
    });
C
chensi10 已提交
155

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

C
chensi10 已提交
162 163 164 165 166
    /*
     * @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 已提交
167
    it('Acts_Ams_test_4900', 0, async function (done) {
Z
zhaoyuan17 已提交
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
        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);
        expect(info.length).assertEqual(6);
        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");
            expect(info[i].lastMemoryLevel).assertEqual(-1);

            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 已提交
198 199
    })

C
chensi10 已提交
200 201 202 203 204
    /*
     * @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 已提交
205
    it('Acts_Ams_test_5300', 0, async function (done) {
C
chensi10 已提交
206
        var maxnum = 100, flag = 1;
C
chensi10 已提交
207
        var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
C
chensi10 已提交
208
        console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']');
C
chensi10 已提交
209
        expect(Array.isArray(data)).assertEqual(true);
C
chensi10 已提交
210
        expect(data.length).assertEqual(4);
C
chensi10 已提交
211
        for (var i = 0; i < data.length; i++) {
C
chensi10 已提交
212 213 214 215 216 217 218 219 220 221
            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 已提交
222 223 224 225 226 227

            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 已提交
228
            expect(data[i].baseAbility.deviceId.length).assertEqual(0);
C
chensi10 已提交
229 230
            expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
            expect(data[i].baseAbility.bundleName.length).assertLarger(0);
C
chensi10 已提交
231
            expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
C
chensi10 已提交
232 233
            expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
            expect(data[i].baseAbility.abilityName.length).assertLarger(0);
C
chensi10 已提交
234
            expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
C
chensi10 已提交
235 236 237 238 239

            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 已提交
240
            expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
C
chensi10 已提交
241 242
            expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
            expect(data[i].topAbility.abilityName.length).assertLarger(0);
C
chensi10 已提交
243
            expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
C
chensi10 已提交
244 245 246 247 248 249

            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 已提交
250
        setTimeout(timeout, 5000);
C
chensi10 已提交
251 252
    })

C
chensi10 已提交
253 254 255 256 257
    /*
     * @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 已提交
258 259 260
    it('Acts_Ams_test_5100', 0, async function (done) {
        var maxnum = 30;
        var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
C
chensi10 已提交
261
        console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']');
C
chensi10 已提交
262
        expect(Array.isArray(data)).assertEqual(true);
C
chensi10 已提交
263
        expect(data.length).assertEqual(4);
C
chensi10 已提交
264
        for (var i = 0; i < data.length; i++) {
C
chensi10 已提交
265 266 267 268 269 270 271 272 273 274
            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 已提交
275 276 277 278 279 280

            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 已提交
281
            expect(data[i].baseAbility.deviceId.length).assertEqual(0);
C
chensi10 已提交
282 283
            expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
            expect(data[i].baseAbility.bundleName.length).assertLarger(0);
C
chensi10 已提交
284
            expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
C
chensi10 已提交
285 286
            expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
            expect(data[i].baseAbility.abilityName.length).assertLarger(0);
C
chensi10 已提交
287
            expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
C
chensi10 已提交
288 289 290 291 292

            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 已提交
293
            expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
C
chensi10 已提交
294 295
            expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
            expect(data[i].topAbility.abilityName.length).assertLarger(0);
C
chensi10 已提交
296
            expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
C
chensi10 已提交
297 298 299 300 301 302

            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 已提交
303
        setTimeout(timeout, 5000);
C
chensi10 已提交
304 305
    })

C
chensi10 已提交
306 307 308 309 310
    /*
     * @tc.number    : Acts_Ams_test_5500
     * @tc.name      : removeMission : Remove Mission
     * @tc.desc      : Remove Mission(by Promise)
     */
C
chensi10 已提交
311 312 313 314
    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);
C
chensi10 已提交
315 316
        console.info('Acts_Ams_test_5500 removeMission data  [' + info + ']');
        expect(typeof (info)).assertEqual("number");
Z
zhaoyuan17 已提交
317
        expect(info).assertEqual(0);
C
chensi10 已提交
318
        done();
Z
zhaoyuan17 已提交
319
        setTimeout(timeout, 5000);
C
chensi10 已提交
320 321
    })

C
chensi10 已提交
322 323 324 325 326
    /*
     * @tc.number    : Acts_Ams_test_5900
     * @tc.name      : moveMissionToTop : Move Mission To Top
     * @tc.desc      : Move Mission To Top(by Promise)
     */
C
chensi10 已提交
327 328 329 330
    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);
C
chensi10 已提交
331 332
        console.info('Acts_Ams_test_5900 moveMissionToTop data  [' + info + ']');
        expect(typeof (info)).assertEqual("number");
C
chensi10 已提交
333 334
        expect(info).assertEqual(0);
        done();
Z
zhaoyuan17 已提交
335
        setTimeout(timeout, 5000);
C
chensi10 已提交
336 337
    })

C
chensi10 已提交
338
    /*
Z
zhaoyuan17 已提交
339 340 341
     * @tc.number    : Acts_Ams_test_6100
     * @tc.name      : removeMissions: Remove Missions
     * @tc.desc      : Remove Missions(by Promise)
C
chensi10 已提交
342
     */
Z
zhaoyuan17 已提交
343 344 345 346 347
    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 + ']');
C
chensi10 已提交
348
        expect(typeof (info)).assertEqual("number");
Z
zhaoyuan17 已提交
349
        expect(info).assertEqual(0);
C
chensi10 已提交
350
        done();
Z
zhaoyuan17 已提交
351
        setTimeout(timeout, 5000);
C
chensi10 已提交
352 353
    })

C
chensi10 已提交
354 355 356 357 358
    /*
     * @tc.number    : Acts_Ams_test_6300
     * @tc.name      : killProcessesByBundleName : Kill Processes By BundleName
     * @tc.desc      : Kill Processes By BundleName(by Promise)
     */
C
chensi10 已提交
359 360
    it('Acts_Ams_test_6300', 0, async function (done) {
        var info = await abilitymanager.killProcessesByBundleName('xxxxxxxxxxxx');
C
chensi10 已提交
361 362
        console.info('Acts_Ams_test_6300 killProcessesByBundleName data  [' + info + ']');
        expect(typeof (info)).assertEqual("number");
C
chensi10 已提交
363 364
        expect(info).assertEqual(0);
        done();
Z
zhaoyuan17 已提交
365
        setTimeout(timeout, 5000);
C
chensi10 已提交
366 367
    })

C
chensi10 已提交
368
    /*
Z
zhaoyuan17 已提交
369 370 371
     * @tc.number    : Acts_Ams_test_8400
     * @tc.name      : getActiveProcessInfos : Get All Active Processes Info
     * @tc.desc      : Get All Active Processes Info(by Promise)
C
chensi10 已提交
372
     */
Z
zhaoyuan17 已提交
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
    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(3);
        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);
        }
C
chensi10 已提交
392
        done();
Z
zhaoyuan17 已提交
393
        setTimeout(timeout, 5000);
C
chensi10 已提交
394
    })
Z
zhaoyuan17 已提交
395 396 397 398 399 400 401 402 403 404 405 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 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

    /*
     * @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);
        expect(data.length).assertEqual(1);
        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);
        expect(data.length).assertEqual(1);
        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);
    })

C
chensi10 已提交
494
})