1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef AMS_KIT_SYSTEM_TEST_A_MAIN_ABILITY_H 17 #define AMS_KIT_SYSTEM_TEST_A_MAIN_ABILITY_H 18 #include "ability.h" 19 #include "ability_loader.h" 20 #include "common_event.h" 21 #include "common_event_manager.h" 22 #include "task_dispatcher_tools.h" 23 #include "task_dispatcher_test_info.h" 24 25 namespace OHOS { 26 namespace AppExecFwk { 27 using namespace OHOS::EventFwk; 28 class FirstEventSubscriber; 29 class MainAbility : public Ability { 30 public: MainAbility()31 MainAbility() 32 { 33 initGlobal(); 34 initParallel(); 35 initSerial(); 36 initSpec(); 37 initHybrid(); 38 initMultiApp(); 39 initPriority(); 40 initCancelTask(); 41 initExtra(); 42 } initGlobal()43 void initGlobal() 44 { 45 mapCase_[(int)TestFunc::GLOBAL] = { 46 [this](int code) { GlobalCase1(code); }, 47 [this](int code) { GlobalCase2(code); }, 48 [this](int code) { GlobalCase3(code); }, 49 [this](int code) { GlobalCase4(code); }, 50 [this](int code) { GlobalCase5(code); }, 51 [this](int code) { GlobalCase6(code); }, 52 [this](int code) { GlobalCase7(code); }, 53 [this](int code) { GlobalCase8(code); }, 54 [this](int code) { GlobalCase9(code); }, 55 [this](int code) { GlobalCase10(code); }, 56 [this](int code) { GlobalCase11(code); }, 57 [this](int code) { GlobalCase12(code); }, 58 [this](int code) { GlobalCase13(code); }, 59 [this](int code) { GlobalCase14(code); }, 60 [this](int code) { GlobalCase15(code); }, 61 [this](int code) { GlobalCase16(code); }, 62 [this](int code) { GlobalCase17(code); }, 63 [this](int code) { GlobalCase18(code); }, 64 [this](int code) { GlobalCase19(code); }, 65 [this](int code) { GlobalCase20(code); }, 66 [this](int code) { GlobalCase21(code); }, 67 [this](int code) { GlobalCase22(code); }, 68 [this](int code) { GlobalCase23(code); }, 69 [this](int code) { GlobalCase24(code); }, 70 [this](int code) { GlobalCase25(code); }, 71 [this](int code) { GlobalCase26(code); }, 72 [this](int code) { GlobalCase27(code); }, 73 [this](int code) { GlobalCase28(code); }, 74 [this](int code) { GlobalCase29(code); }, 75 [this](int code) { GlobalCase30(code); }, 76 [this](int code) { GlobalCase31(code); }, 77 [this](int code) { GlobalCase32(code); }, 78 [this](int code) { GlobalCase33(code); }, 79 [this](int code) { GlobalCase34(code); }, 80 [this](int code) { GlobalCase35(code); }, 81 [this](int code) { GlobalCase36(code); }, 82 [this](int code) { GlobalCase37(code); }, 83 [this](int code) { GlobalCase38(code); }, 84 [this](int code) { GlobalCase39(code); }, 85 [this](int code) { GlobalCase40(code); }, 86 [this](int code) { GlobalCase41(code); }, 87 [this](int code) { GlobalCase42(code); }, 88 [this](int code) { GlobalCase43(code); }, 89 [this](int code) { GlobalCase44(code); }, 90 [this](int code) { GlobalCase45(code); }, 91 [this](int code) { GlobalCase46(code); }, 92 [this](int code) { GlobalCase47(code); }, 93 [this](int code) { GlobalCase48(code); }, 94 [this](int code) { GlobalCase49(code); }, 95 [this](int code) { GlobalCase50(code); }, 96 [this](int code) { GlobalCase51(code); }, 97 [this](int code) { GlobalCase52(code); }, 98 [this](int code) { GlobalCase53(code); }, 99 [this](int code) { GlobalCase54(code); }, 100 [this](int code) { GlobalCase55(code); }, 101 [this](int code) { GlobalCase56(code); }, 102 [this](int code) { GlobalCase57(code); }, 103 [this](int code) { GlobalCase58(code); }, 104 [this](int code) { GlobalCase59(code); }, 105 [this](int code) { GlobalCase60(code); }, 106 [this](int code) { GlobalCase61(code); }, 107 [this](int code) { GlobalCase62(code); }, 108 [this](int code) { GlobalCase63(code); }, 109 [this](int code) { GlobalCase64(code); }, 110 [this](int code) { GlobalCase65(code); }, 111 [this](int code) { GlobalCase66(code); }, 112 [this](int code) { GlobalCase67(code); }, 113 [this](int code) { GlobalCase68(code); }, 114 [this](int code) { GlobalCase69(code); }, 115 [this](int code) { GlobalCase70(code); }, 116 [this](int code) { GlobalCase71(code); }, 117 [this](int code) { GlobalCase72(code); }, 118 [this](int code) { GlobalCase73(code); }, 119 [this](int code) { GlobalCase74(code); }, 120 [this](int code) { GlobalCase75(code); }, 121 [this](int code) { GlobalCase76(code); }, 122 [this](int code) { GlobalCase77(code); }, 123 [this](int code) { GlobalCase78(code); }, 124 [this](int code) { GlobalCase79(code); }, 125 [this](int code) { GlobalCase80(code); }, 126 [this](int code) { GlobalCase81(code); }, 127 [this](int code) { GlobalCase82(code); }, 128 [this](int code) { GlobalCase83(code); }, 129 [this](int code) { GlobalCase84(code); }, 130 [this](int code) { GlobalCase85(code); }, 131 [this](int code) { GlobalCase86(code); }, 132 [this](int code) { GlobalCase87(code); }, 133 [this](int code) { GlobalCase88(code); }, 134 [this](int code) { GlobalCase89(code); }, 135 [this](int code) { GlobalCase90(code); }, 136 [this](int code) { GlobalCase91(code); }, 137 }; 138 } 139 initParallel()140 void initParallel() 141 { 142 mapCase_[(int)TestFunc::PARALLEL] = { 143 [this](int code) { ParallelCase1(code); }, 144 [this](int code) { ParallelCase2(code); }, 145 [this](int code) { ParallelCase3(code); }, 146 [this](int code) { ParallelCase4(code); }, 147 [this](int code) { ParallelCase5(code); }, 148 [this](int code) { ParallelCase6(code); }, 149 [this](int code) { ParallelCase7(code); }, 150 [this](int code) { ParallelCase8(code); }, 151 [this](int code) { ParallelCase9(code); }, 152 [this](int code) { ParallelCase10(code); }, 153 [this](int code) { ParallelCase11(code); }, 154 [this](int code) { ParallelCase12(code); }, 155 [this](int code) { ParallelCase13(code); }, 156 [this](int code) { ParallelCase14(code); }, 157 [this](int code) { ParallelCase15(code); }, 158 [this](int code) { ParallelCase16(code); }, 159 [this](int code) { ParallelCase17(code); }, 160 [this](int code) { ParallelCase18(code); }, 161 [this](int code) { ParallelCase19(code); }, 162 [this](int code) { ParallelCase20(code); }, 163 [this](int code) { ParallelCase21(code); }, 164 [this](int code) { ParallelCase22(code); }, 165 [this](int code) { ParallelCase23(code); }, 166 [this](int code) { ParallelCase24(code); }, 167 [this](int code) { ParallelCase25(code); }, 168 [this](int code) { ParallelCase26(code); }, 169 [this](int code) { ParallelCase27(code); }, 170 [this](int code) { ParallelCase28(code); }, 171 [this](int code) { ParallelCase29(code); }, 172 [this](int code) { ParallelCase30(code); }, 173 [this](int code) { ParallelCase31(code); }, 174 [this](int code) { ParallelCase32(code); }, 175 [this](int code) { ParallelCase33(code); }, 176 [this](int code) { ParallelCase34(code); }, 177 [this](int code) { ParallelCase35(code); }, 178 [this](int code) { ParallelCase36(code); }, 179 [this](int code) { ParallelCase37(code); }, 180 [this](int code) { ParallelCase38(code); }, 181 [this](int code) { ParallelCase39(code); }, 182 [this](int code) { ParallelCase40(code); }, 183 [this](int code) { ParallelCase41(code); }, 184 [this](int code) { ParallelCase42(code); }, 185 [this](int code) { ParallelCase43(code); }, 186 [this](int code) { ParallelCase44(code); }, 187 [this](int code) { ParallelCase45(code); }, 188 [this](int code) { ParallelCase46(code); }, 189 [this](int code) { ParallelCase47(code); }, 190 [this](int code) { ParallelCase48(code); }, 191 [this](int code) { ParallelCase49(code); }, 192 [this](int code) { ParallelCase50(code); }, 193 [this](int code) { ParallelCase51(code); }, 194 [this](int code) { ParallelCase52(code); }, 195 [this](int code) { ParallelCase53(code); }, 196 [this](int code) { ParallelCase54(code); }, 197 [this](int code) { ParallelCase55(code); }, 198 [this](int code) { ParallelCase56(code); }, 199 [this](int code) { ParallelCase57(code); }, 200 [this](int code) { ParallelCase58(code); }, 201 [this](int code) { ParallelCase59(code); }, 202 [this](int code) { ParallelCase60(code); }, 203 [this](int code) { ParallelCase61(code); }, 204 [this](int code) { ParallelCase62(code); }, 205 [this](int code) { ParallelCase63(code); }, 206 [this](int code) { ParallelCase64(code); }, 207 [this](int code) { ParallelCase65(code); }, 208 [this](int code) { ParallelCase66(code); }, 209 [this](int code) { ParallelCase67(code); }, 210 [this](int code) { ParallelCase68(code); }, 211 [this](int code) { ParallelCase69(code); }, 212 [this](int code) { ParallelCase70(code); }, 213 [this](int code) { ParallelCase71(code); }, 214 [this](int code) { ParallelCase72(code); }, 215 [this](int code) { ParallelCase73(code); }, 216 [this](int code) { ParallelCase74(code); }, 217 [this](int code) { ParallelCase75(code); }, 218 [this](int code) { ParallelCase76(code); }, 219 [this](int code) { ParallelCase77(code); }, 220 [this](int code) { ParallelCase78(code); }, 221 [this](int code) { ParallelCase79(code); }, 222 [this](int code) { ParallelCase80(code); }, 223 [this](int code) { ParallelCase81(code); }, 224 [this](int code) { ParallelCase82(code); }, 225 [this](int code) { ParallelCase83(code); }, 226 [this](int code) { ParallelCase84(code); }, 227 [this](int code) { ParallelCase85(code); }, 228 [this](int code) { ParallelCase86(code); }, 229 [this](int code) { ParallelCase87(code); }, 230 [this](int code) { ParallelCase88(code); }, 231 [this](int code) { ParallelCase89(code); }, 232 [this](int code) { ParallelCase90(code); }, 233 [this](int code) { ParallelCase91(code); }, 234 [this](int code) { ParallelCase92(code); }, 235 [this](int code) { ParallelCase93(code); }, 236 [this](int code) { ParallelCase94(code); }, 237 [this](int code) { ParallelCase95(code); }, 238 [this](int code) { ParallelCase96(code); }, 239 [this](int code) { ParallelCase97(code); }, 240 [this](int code) { ParallelCase98(code); }, 241 [this](int code) { ParallelCase99(code); }, 242 [this](int code) { ParallelCase100(code); }, 243 [this](int code) { ParallelCase101(code); }, 244 [this](int code) { ParallelCase102(code); }, 245 [this](int code) { ParallelCase103(code); }, 246 [this](int code) { ParallelCase104(code); }, 247 [this](int code) { ParallelCase105(code); }, 248 [this](int code) { ParallelCase106(code); }, 249 [this](int code) { ParallelCase107(code); }, 250 [this](int code) { ParallelCase108(code); }, 251 [this](int code) { ParallelCase109(code); }, 252 [this](int code) { ParallelCase110(code); }, 253 [this](int code) { ParallelCase111(code); }, 254 [this](int code) { ParallelCase112(code); }, 255 [this](int code) { ParallelCase113(code); }, 256 [this](int code) { ParallelCase114(code); }, 257 [this](int code) { ParallelCase115(code); }, 258 [this](int code) { ParallelCase116(code); }, 259 [this](int code) { ParallelCase117(code); }, 260 }; 261 } initSerial()262 void initSerial() 263 { 264 mapCase_[(int)TestFunc::SERIAL] = { 265 [this](int code) { SerialCase1(code); }, 266 [this](int code) { SerialCase2(code); }, 267 [this](int code) { SerialCase3(code); }, 268 [this](int code) { SerialCase4(code); }, 269 [this](int code) { SerialCase5(code); }, 270 [this](int code) { SerialCase6(code); }, 271 [this](int code) { SerialCase7(code); }, 272 [this](int code) { SerialCase8(code); }, 273 [this](int code) { SerialCase9(code); }, 274 [this](int code) { SerialCase10(code); }, 275 [this](int code) { SerialCase11(code); }, 276 [this](int code) { SerialCase12(code); }, 277 [this](int code) { SerialCase13(code); }, 278 [this](int code) { SerialCase14(code); }, 279 [this](int code) { SerialCase15(code); }, 280 [this](int code) { SerialCase16(code); }, 281 [this](int code) { SerialCase17(code); }, 282 [this](int code) { SerialCase18(code); }, 283 [this](int code) { SerialCase19(code); }, 284 [this](int code) { SerialCase20(code); }, 285 [this](int code) { SerialCase21(code); }, 286 [this](int code) { SerialCase22(code); }, 287 [this](int code) { SerialCase23(code); }, 288 [this](int code) { SerialCase24(code); }, 289 [this](int code) { SerialCase25(code); }, 290 [this](int code) { SerialCase26(code); }, 291 [this](int code) { SerialCase27(code); }, 292 [this](int code) { SerialCase28(code); }, 293 [this](int code) { SerialCase29(code); }, 294 [this](int code) { SerialCase30(code); }, 295 [this](int code) { SerialCase31(code); }, 296 [this](int code) { SerialCase32(code); }, 297 [this](int code) { SerialCase33(code); }, 298 [this](int code) { SerialCase34(code); }, 299 [this](int code) { SerialCase35(code); }, 300 [this](int code) { SerialCase36(code); }, 301 [this](int code) { SerialCase37(code); }, 302 [this](int code) { SerialCase38(code); }, 303 [this](int code) { SerialCase39(code); }, 304 [this](int code) { SerialCase40(code); }, 305 [this](int code) { SerialCase41(code); }, 306 [this](int code) { SerialCase42(code); }, 307 [this](int code) { SerialCase43(code); }, 308 [this](int code) { SerialCase44(code); }, 309 [this](int code) { SerialCase45(code); }, 310 [this](int code) { SerialCase46(code); }, 311 [this](int code) { SerialCase47(code); }, 312 [this](int code) { SerialCase48(code); }, 313 [this](int code) { SerialCase49(code); }, 314 [this](int code) { SerialCase50(code); }, 315 [this](int code) { SerialCase51(code); }, 316 [this](int code) { SerialCase52(code); }, 317 }; 318 } initSpec()319 void initSpec() 320 { 321 mapCase_[(int)TestFunc::SPEC] = { 322 [this](int code) { SpecCase1(code); }, 323 [this](int code) { SpecCase2(code); }, 324 [this](int code) { SpecCase3(code); }, 325 [this](int code) { SpecCase4(code); }, 326 [this](int code) { SpecCase5(code); }, 327 [this](int code) { SpecCase6(code); }, 328 [this](int code) { SpecCase7(code); }, 329 [this](int code) { SpecCase8(code); }, 330 [this](int code) { SpecCase9(code); }, 331 [this](int code) { SpecCase10(code); }, 332 [this](int code) { SpecCase11(code); }, 333 [this](int code) { SpecCase12(code); }, 334 [this](int code) { SpecCase13(code); }, 335 [this](int code) { SpecCase14(code); }, 336 [this](int code) { SpecCase15(code); }, 337 [this](int code) { SpecCase16(code); }, 338 [this](int code) { SpecCase17(code); }, 339 [this](int code) { SpecCase18(code); }, 340 [this](int code) { SpecCase19(code); }, 341 [this](int code) { SpecCase20(code); }, 342 [this](int code) { SpecCase21(code); }, 343 [this](int code) { SpecCase22(code); }, 344 [this](int code) { SpecCase23(code); }, 345 [this](int code) { SpecCase24(code); }, 346 [this](int code) { SpecCase25(code); }, 347 [this](int code) { SpecCase26(code); }, 348 [this](int code) { SpecCase27(code); }, 349 [this](int code) { SpecCase28(code); }, 350 [this](int code) { SpecCase29(code); }, 351 [this](int code) { SpecCase30(code); }, 352 [this](int code) { SpecCase31(code); }, 353 [this](int code) { SpecCase32(code); }, 354 [this](int code) { SpecCase33(code); }, 355 [this](int code) { SpecCase34(code); }, 356 [this](int code) { SpecCase35(code); }, 357 [this](int code) { SpecCase36(code); }, 358 [this](int code) { SpecCase37(code); }, 359 [this](int code) { SpecCase38(code); }, 360 [this](int code) { SpecCase39(code); }, 361 [this](int code) { SpecCase40(code); }, 362 [this](int code) { SpecCase41(code); }, 363 [this](int code) { SpecCase42(code); }, 364 [this](int code) { SpecCase43(code); }, 365 [this](int code) { SpecCase44(code); }, 366 [this](int code) { SpecCase45(code); }, 367 [this](int code) { SpecCase46(code); }, 368 [this](int code) { SpecCase47(code); }, 369 [this](int code) { SpecCase48(code); }, 370 [this](int code) { SpecCase49(code); }, 371 [this](int code) { SpecCase50(code); }, 372 [this](int code) { SpecCase51(code); }, 373 [this](int code) { SpecCase52(code); }, 374 }; 375 } initHybrid()376 void initHybrid() 377 { 378 mapCase_[(int)TestFunc::HYBRID] = { 379 [this](int code) { HybridCase1(code); }, 380 [this](int code) { HybridCase2(code); }, 381 [this](int code) { HybridCase3(code); }, 382 [this](int code) { HybridCase4(code); }, 383 [this](int code) { HybridCase5(code); }, 384 [this](int code) { HybridCase6(code); }, 385 [this](int code) { HybridCase7(code); }, 386 [this](int code) { HybridCase8(code); }, 387 [this](int code) { HybridCase9(code); }, 388 [this](int code) { HybridCase10(code); }, 389 [this](int code) { HybridCase11(code); }, 390 [this](int code) { HybridCase12(code); }, 391 [this](int code) { HybridCase13(code); }, 392 [this](int code) { HybridCase14(code); }, 393 [this](int code) { HybridCase15(code); }, 394 [this](int code) { HybridCase16(code); }, 395 [this](int code) { HybridCase17(code); }, 396 [this](int code) { HybridCase18(code); }, 397 [this](int code) { HybridCase19(code); }, 398 [this](int code) { HybridCase20(code); }, 399 [this](int code) { HybridCase21(code); }, 400 [this](int code) { HybridCase22(code); }, 401 [this](int code) { HybridCase23(code); }, 402 [this](int code) { HybridCase24(code); }, 403 [this](int code) { HybridCase25(code); }, 404 [this](int code) { HybridCase26(code); }, 405 [this](int code) { HybridCase27(code); }, 406 }; 407 } initMultiApp()408 void initMultiApp() 409 { 410 mapCase_[(int)TestFunc::MULTI_APP] = { 411 [this](int code) { MultiAppCase1(code); }, 412 [this](int code) { MultiAppCase2(code); }, 413 [this](int code) { MultiAppCase3(code); }, 414 [this](int code) { MultiAppCase4(code); }, 415 }; 416 } initPriority()417 void initPriority() 418 { 419 mapCase_[(int)TestFunc::PRIORITY] = { 420 [this](int code) { PriorityCase1(code); }, 421 [this](int code) { PriorityCase2(code); }, 422 [this](int code) { PriorityCase3(code); }, 423 [this](int code) { PriorityCase4(code); }, 424 [this](int code) { PriorityCase5(code); }, 425 }; 426 } initCancelTask()427 void initCancelTask() 428 { 429 mapCase_[(int)TestFunc::CANCEL_TASK] = { 430 [this](int code) { RevokeCase1(code); }, 431 [this](int code) { RevokeCase2(code); }, 432 [this](int code) { RevokeCase3(code); }, 433 [this](int code) { RevokeCase4(code); }, 434 [this](int code) { RevokeCase5(code); }, 435 [this](int code) { RevokeCase6(code); }, 436 }; 437 } initExtra()438 void initExtra() 439 { 440 mapCase_[(int)TestFunc::EXTRA] = { 441 [this](int code) { ExtraCase1(code); }, 442 }; 443 } 444 445 void SubscribeEvent(); 446 void TestDispatcher(int apiIndex, int caseIndex, int code); 447 int Dispatch(STtools::TestSetting outer, STtools::TestSetting inner); 448 449 void GlobalCase1(int code); 450 void GlobalCase2(int code); 451 void GlobalCase3(int code); 452 void GlobalCase4(int code); 453 void GlobalCase5(int code); 454 void GlobalCase6(int code); 455 void GlobalCase7(int code); 456 void GlobalCase8(int code); 457 void GlobalCase9(int code); 458 void GlobalCase10(int code); 459 void GlobalCase11(int code); 460 void GlobalCase12(int code); 461 void GlobalCase13(int code); 462 void GlobalCase14(int code); 463 void GlobalCase15(int code); 464 void GlobalCase16(int code); 465 void GlobalCase17(int code); 466 void GlobalCase18(int code); 467 void GlobalCase19(int code); 468 void GlobalCase20(int code); 469 void GlobalCase21(int code); 470 void GlobalCase22(int code); 471 void GlobalCase23(int code); 472 void GlobalCase24(int code); 473 void GlobalCase25(int code); 474 void GlobalCase26(int code); 475 void GlobalCase27(int code); 476 void GlobalCase28(int code); 477 void GlobalCase29(int code); 478 void GlobalCase30(int code); 479 void GlobalCase31(int code); 480 void GlobalCase32(int code); 481 void GlobalCase33(int code); 482 void GlobalCase34(int code); 483 void GlobalCase35(int code); 484 void GlobalCase36(int code); 485 void GlobalCase37(int code); 486 void GlobalCase38(int code); 487 void GlobalCase39(int code); 488 void GlobalCase40(int code); 489 void GlobalCase41(int code); 490 void GlobalCase42(int code); 491 void GlobalCase43(int code); 492 void GlobalCase44(int code); 493 void GlobalCase45(int code); 494 void GlobalCase46(int code); 495 void GlobalCase47(int code); 496 void GlobalCase48(int code); 497 void GlobalCase49(int code); 498 void GlobalCase50(int code); 499 void GlobalCase51(int code); 500 void GlobalCase52(int code); 501 void GlobalCase53(int code); 502 void GlobalCase54(int code); 503 void GlobalCase55(int code); 504 void GlobalCase56(int code); 505 void GlobalCase57(int code); 506 void GlobalCase58(int code); 507 void GlobalCase59(int code); 508 void GlobalCase60(int code); 509 void GlobalCase61(int code); 510 void GlobalCase62(int code); 511 void GlobalCase63(int code); 512 void GlobalCase64(int code); 513 void GlobalCase65(int code); 514 void GlobalCase66(int code); 515 void GlobalCase67(int code); 516 void GlobalCase68(int code); 517 void GlobalCase69(int code); 518 void GlobalCase70(int code); 519 void GlobalCase71(int code); 520 void GlobalCase72(int code); 521 void GlobalCase73(int code); 522 void GlobalCase74(int code); 523 void GlobalCase75(int code); 524 void GlobalCase76(int code); 525 void GlobalCase77(int code); 526 void GlobalCase78(int code); 527 void GlobalCase79(int code); 528 void GlobalCase80(int code); 529 void GlobalCase81(int code); 530 void GlobalCase82(int code); 531 void GlobalCase83(int code); 532 void GlobalCase84(int code); 533 void GlobalCase85(int code); 534 void GlobalCase86(int code); 535 void GlobalCase87(int code); 536 void GlobalCase88(int code); 537 void GlobalCase89(int code); 538 void GlobalCase90(int code); 539 void GlobalCase91(int code); 540 void ParallelCase1(int code); 541 void ParallelCase2(int code); 542 void ParallelCase3(int code); 543 void ParallelCase4(int code); 544 void ParallelCase5(int code); 545 void ParallelCase6(int code); 546 void ParallelCase7(int code); 547 void ParallelCase8(int code); 548 void ParallelCase9(int code); 549 void ParallelCase10(int code); 550 void ParallelCase11(int code); 551 void ParallelCase12(int code); 552 void ParallelCase13(int code); 553 void ParallelCase14(int code); 554 void ParallelCase15(int code); 555 void ParallelCase16(int code); 556 void ParallelCase17(int code); 557 void ParallelCase18(int code); 558 void ParallelCase19(int code); 559 void ParallelCase20(int code); 560 void ParallelCase21(int code); 561 void ParallelCase22(int code); 562 void ParallelCase23(int code); 563 void ParallelCase24(int code); 564 void ParallelCase25(int code); 565 void ParallelCase26(int code); 566 void ParallelCase27(int code); 567 void ParallelCase28(int code); 568 void ParallelCase29(int code); 569 void ParallelCase30(int code); 570 void ParallelCase31(int code); 571 void ParallelCase32(int code); 572 void ParallelCase33(int code); 573 void ParallelCase34(int code); 574 void ParallelCase35(int code); 575 void ParallelCase36(int code); 576 void ParallelCase37(int code); 577 void ParallelCase38(int code); 578 void ParallelCase39(int code); 579 void ParallelCase40(int code); 580 void ParallelCase41(int code); 581 void ParallelCase42(int code); 582 void ParallelCase43(int code); 583 void ParallelCase44(int code); 584 void ParallelCase45(int code); 585 void ParallelCase46(int code); 586 void ParallelCase47(int code); 587 void ParallelCase48(int code); 588 void ParallelCase49(int code); 589 void ParallelCase50(int code); 590 void ParallelCase51(int code); 591 void ParallelCase52(int code); 592 void ParallelCase53(int code); 593 void ParallelCase54(int code); 594 void ParallelCase55(int code); 595 void ParallelCase56(int code); 596 void ParallelCase57(int code); 597 void ParallelCase58(int code); 598 void ParallelCase59(int code); 599 void ParallelCase60(int code); 600 void ParallelCase61(int code); 601 void ParallelCase62(int code); 602 void ParallelCase63(int code); 603 void ParallelCase64(int code); 604 void ParallelCase65(int code); 605 void ParallelCase66(int code); 606 void ParallelCase67(int code); 607 void ParallelCase68(int code); 608 void ParallelCase69(int code); 609 void ParallelCase70(int code); 610 void ParallelCase71(int code); 611 void ParallelCase72(int code); 612 void ParallelCase73(int code); 613 void ParallelCase74(int code); 614 void ParallelCase75(int code); 615 void ParallelCase76(int code); 616 void ParallelCase77(int code); 617 void ParallelCase78(int code); 618 void ParallelCase79(int code); 619 void ParallelCase80(int code); 620 void ParallelCase81(int code); 621 void ParallelCase82(int code); 622 void ParallelCase83(int code); 623 void ParallelCase84(int code); 624 void ParallelCase85(int code); 625 void ParallelCase86(int code); 626 void ParallelCase87(int code); 627 void ParallelCase88(int code); 628 void ParallelCase89(int code); 629 void ParallelCase90(int code); 630 void ParallelCase91(int code); 631 void ParallelCase92(int code); 632 void ParallelCase93(int code); 633 void ParallelCase94(int code); 634 void ParallelCase95(int code); 635 void ParallelCase96(int code); 636 void ParallelCase97(int code); 637 void ParallelCase98(int code); 638 void ParallelCase99(int code); 639 void ParallelCase100(int code); 640 void ParallelCase101(int code); 641 void ParallelCase102(int code); 642 void ParallelCase103(int code); 643 void ParallelCase104(int code); 644 void ParallelCase105(int code); 645 void ParallelCase106(int code); 646 void ParallelCase107(int code); 647 void ParallelCase108(int code); 648 void ParallelCase109(int code); 649 void ParallelCase110(int code); 650 void ParallelCase111(int code); 651 void ParallelCase112(int code); 652 void ParallelCase113(int code); 653 void ParallelCase114(int code); 654 void ParallelCase115(int code); 655 void ParallelCase116(int code); 656 void ParallelCase117(int code); 657 void SerialCase1(int code); 658 void SerialCase2(int code); 659 void SerialCase3(int code); 660 void SerialCase4(int code); 661 void SerialCase5(int code); 662 void SerialCase6(int code); 663 void SerialCase7(int code); 664 void SerialCase8(int code); 665 void SerialCase9(int code); 666 void SerialCase10(int code); 667 void SerialCase11(int code); 668 void SerialCase12(int code); 669 void SerialCase13(int code); 670 void SerialCase14(int code); 671 void SerialCase15(int code); 672 void SerialCase16(int code); 673 void SerialCase17(int code); 674 void SerialCase18(int code); 675 void SerialCase19(int code); 676 void SerialCase20(int code); 677 void SerialCase21(int code); 678 void SerialCase22(int code); 679 void SerialCase23(int code); 680 void SerialCase24(int code); 681 void SerialCase25(int code); 682 void SerialCase26(int code); 683 void SerialCase27(int code); 684 void SerialCase28(int code); 685 void SerialCase29(int code); 686 void SerialCase30(int code); 687 void SerialCase31(int code); 688 void SerialCase32(int code); 689 void SerialCase33(int code); 690 void SerialCase34(int code); 691 void SerialCase35(int code); 692 void SerialCase36(int code); 693 void SerialCase37(int code); 694 void SerialCase38(int code); 695 void SerialCase39(int code); 696 void SerialCase40(int code); 697 void SerialCase41(int code); 698 void SerialCase42(int code); 699 void SerialCase43(int code); 700 void SerialCase44(int code); 701 void SerialCase45(int code); 702 void SerialCase46(int code); 703 void SerialCase47(int code); 704 void SerialCase48(int code); 705 void SerialCase49(int code); 706 void SerialCase50(int code); 707 void SerialCase51(int code); 708 void SerialCase52(int code); 709 void SpecCase1(int code); 710 void SpecCase2(int code); 711 void SpecCase3(int code); 712 void SpecCase4(int code); 713 void SpecCase5(int code); 714 void SpecCase6(int code); 715 void SpecCase7(int code); 716 void SpecCase8(int code); 717 void SpecCase9(int code); 718 void SpecCase10(int code); 719 void SpecCase11(int code); 720 void SpecCase12(int code); 721 void SpecCase13(int code); 722 void SpecCase14(int code); 723 void SpecCase15(int code); 724 void SpecCase16(int code); 725 void SpecCase17(int code); 726 void SpecCase18(int code); 727 void SpecCase19(int code); 728 void SpecCase20(int code); 729 void SpecCase21(int code); 730 void SpecCase22(int code); 731 void SpecCase23(int code); 732 void SpecCase24(int code); 733 void SpecCase25(int code); 734 void SpecCase26(int code); 735 void SpecCase27(int code); 736 void SpecCase28(int code); 737 void SpecCase29(int code); 738 void SpecCase30(int code); 739 void SpecCase31(int code); 740 void SpecCase32(int code); 741 void SpecCase33(int code); 742 void SpecCase34(int code); 743 void SpecCase35(int code); 744 void SpecCase36(int code); 745 void SpecCase37(int code); 746 void SpecCase38(int code); 747 void SpecCase39(int code); 748 void SpecCase40(int code); 749 void SpecCase41(int code); 750 void SpecCase42(int code); 751 void SpecCase43(int code); 752 void SpecCase44(int code); 753 void SpecCase45(int code); 754 void SpecCase46(int code); 755 void SpecCase47(int code); 756 void SpecCase48(int code); 757 void SpecCase49(int code); 758 void SpecCase50(int code); 759 void SpecCase51(int code); 760 void SpecCase52(int code); 761 void HybridCase1(int code); 762 void HybridCase2(int code); 763 void HybridCase3(int code); 764 void HybridCase4(int code); 765 void HybridCase5(int code); 766 void HybridCase6(int code); 767 void HybridCase7(int code); 768 void HybridCase8(int code); 769 void HybridCase9(int code); 770 void HybridCase10(int code); 771 void HybridCase11(int code); 772 void HybridCase12(int code); 773 void HybridCase13(int code); 774 void HybridCase14(int code); 775 void HybridCase15(int code); 776 void HybridCase16(int code); 777 void HybridCase17(int code); 778 void HybridCase18(int code); 779 void HybridCase19(int code); 780 void HybridCase20(int code); 781 void HybridCase21(int code); 782 void HybridCase22(int code); 783 void HybridCase23(int code); 784 void HybridCase24(int code); 785 void HybridCase25(int code); 786 void HybridCase26(int code); 787 void HybridCase27(int code); 788 void MultiAppCase1(int code); 789 void MultiAppCase2(int code); 790 void MultiAppCase3(int code); 791 void MultiAppCase4(int code); 792 void ExtraCase1(int code); 793 void PriorityCase1(int code); 794 void PriorityCase2(int code); 795 void PriorityCase3(int code); 796 void PriorityCase4(int code); 797 void PriorityCase5(int code); 798 void RevokeCase1(int code); 799 void RevokeCase2(int code); 800 void RevokeCase3(int code); 801 void RevokeCase4(int code); 802 void RevokeCase5(int code); 803 void RevokeCase6(int code); 804 805 std::unordered_map<int, std::vector<std::function<void(int)>>> mapCase_; 806 ~MainAbility(); 807 808 protected: 809 void Init(const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<OHOSApplication> &application, 810 std::shared_ptr<AbilityHandler> &handler, const sptr<IRemoteObject> &token) override; 811 virtual void OnStart(const Want &want) override; 812 virtual void OnStop() override; 813 virtual void OnActive() override; 814 virtual void OnInactive() override; 815 virtual void OnBackground() override; 816 virtual void OnForeground(const Want &want) override; 817 818 void FillInDispathcer(); 819 std::shared_ptr<FirstEventSubscriber> subscriber_; 820 }; 821 class FirstEventSubscriber : public EventFwk::CommonEventSubscriber { 822 public: FirstEventSubscriber(const EventFwk::CommonEventSubscribeInfo & sp)823 explicit FirstEventSubscriber(const EventFwk::CommonEventSubscribeInfo &sp) : CommonEventSubscriber(sp) 824 { 825 mapTestFunc_ = { 826 {"Dispatcher", 827 [this](int apiIndex, int caseIndex, int code) { TestDispatcher(apiIndex, caseIndex, code); }}, 828 }; 829 mainAbility = nullptr; 830 } 831 TestDispatcher(int apiIndex,int caseIndex,int code)832 void TestDispatcher(int apiIndex, int caseIndex, int code) 833 { 834 mainAbility->TestDispatcher(apiIndex, caseIndex, code); 835 } 836 837 virtual void OnReceiveEvent(const EventFwk::CommonEventData &data); 838 839 MainAbility *mainAbility; 840 std::unordered_map<std::string, std::function<void(int, int, int)>> mapTestFunc_; 841 ~FirstEventSubscriber() = default; 842 }; 843 } // namespace AppExecFwk 844 } // namespace OHOS 845 #endif // AMS_KIT_SYSTEM_TEST_A_MAIN_ABILITY_H