From c33c59d0e7b6272b255b2f5d0ad7e355ceddb9e6 Mon Sep 17 00:00:00 2001 From: jiyong_sd Date: Tue, 12 Jul 2022 17:28:17 +0800 Subject: [PATCH] modified FA-JS Signed-off-by: jiyong_sd Change-Id: Icee888565f760cd1a270f3a849f12c46076996a2 --- .../actsamscallbackfifthscene/BUILD.gn | 11 +- .../actsamscallbackfifthscene/Test.json | 5 +- .../js/resources/base/element/string.json | 12 -- .../main/js/test/MangerAbilityJsunit.test.js | 144 ---------------- .../{entry => }/src/main/config.json | 66 ++++++-- .../main/js/MainAbility}/app.js | 0 .../main/js/MainAbility}/i18n/en-US.json | 0 .../main/js/MainAbility}/i18n/zh-CN.json | 0 .../js/MainAbility}/pages/index/index.css | 1 + .../js/MainAbility}/pages/index/index.hml | 0 .../main/js/MainAbility}/pages/index/index.js | 16 -- .../src/main/js/TestAbility/app.js | 31 ++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 45 +++++ .../main/js/TestAbility/pages/index/index.hml | 21 +++ .../main/js/TestAbility/pages/index/index.js | 26 +++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 +++++++ .../src/main/js/test/List.test.js | 19 +++ .../main/js/test/MangerAbilityJsunit.test.js | 145 ++++++++++++++++ .../main/resources/base/element/string.json | 28 ++++ .../main}/resources/base/media/icon.png | Bin .../actsamscallbackfirstscene/BUILD.gn | 10 +- .../actsamscallbackfirstscene/Test.json | 5 +- .../src/main/js/default/pages/index/index.js | 53 ------ .../js/resources/base/element/string.json | 12 -- .../main/js/test/MangerAbilityJsunit.test.js | 87 ---------- .../{entry => }/src/main/config.json | 66 ++++++-- .../main/js/MainAbility}/app.js | 0 .../main/js/MainAbility}/i18n/en-US.json | 0 .../main/js/MainAbility}/i18n/zh-CN.json | 0 .../js/MainAbility/pages/index/index.css} | 11 +- .../js/MainAbility}/pages/index/index.hml | 0 .../main/js/MainAbility}/pages/index/index.js | 17 +- .../src/main/js/TestAbility/app.js | 31 ++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../js/TestAbility}/pages/index/index.css | 88 +++++----- .../main/js/TestAbility/pages/index/index.hml | 21 +++ .../main/js/TestAbility/pages/index/index.js | 26 +++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 +++++++ .../src/main/js/test/List.test.js | 19 +++ .../main/js/test/MangerAbilityJsunit.test.js | 88 ++++++++++ .../main/resources/base/element/string.json | 28 ++++ .../main}/resources/base/media/icon.png | Bin .../actsamscallbackfourthscene/BUILD.gn | 11 +- .../actsamscallbackfourthscene/Test.json | 5 +- .../js/resources/base/element/string.json | 12 -- .../main/js/test/MangerAbilityJsunit.test.js | 138 ---------------- .../{entry => }/src/main/config.json | 66 ++++++-- .../main/js/MainAbility}/app.js | 0 .../main/js/MainAbility}/i18n/en-US.json | 0 .../main/js/MainAbility}/i18n/zh-CN.json | 0 .../js/MainAbility/pages/index/index.css} | 11 +- .../js/MainAbility}/pages/index/index.hml | 0 .../main/js/MainAbility}/pages/index/index.js | 16 -- .../src/main/js/TestAbility/app.js | 31 ++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../js/TestAbility}/pages/index/index.css | 88 +++++----- .../main/js/TestAbility/pages/index/index.hml | 21 +++ .../main/js/TestAbility/pages/index/index.js | 26 +++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 +++++++ .../src/main/js/test/List.test.js | 19 +++ .../main/js/test/MangerAbilityJsunit.test.js | 139 ++++++++++++++++ .../main/resources/base/element/string.json | 28 ++++ .../main}/resources/base/media/icon.png | Bin .../actsamscallbacksecondscene/BUILD.gn | 11 +- .../actsamscallbacksecondscene/Test.json | 5 +- .../js/resources/base/element/string.json | 12 -- .../main/js/test/MangerAbilityJsunit.test.js | 104 ------------ .../{entry => }/src/main/config.json | 66 ++++++-- .../main/js/MainAbility}/app.js | 0 .../main/js/MainAbility}/i18n/en-US.json | 0 .../main/js/MainAbility}/i18n/zh-CN.json | 0 .../js/MainAbility/pages/index/index.css} | 11 +- .../js/MainAbility}/pages/index/index.hml | 0 .../main/js/MainAbility}/pages/index/index.js | 16 -- .../src/main/js/TestAbility/app.js | 31 ++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../js/TestAbility}/pages/index/index.css | 88 +++++----- .../main/js/TestAbility/pages/index/index.hml | 21 +++ .../main/js/TestAbility/pages/index/index.js | 26 +++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 +++++++ .../src/main/js/test/List.test.js | 19 +++ .../main/js/test/MangerAbilityJsunit.test.js | 105 ++++++++++++ .../main/resources/base/element/string.json | 28 ++++ .../main}/resources/base/media/icon.png | Bin .../actsamscallbackthirdscene/BUILD.gn | 11 +- .../actsamscallbackthirdscene/Test.json | 5 +- .../src/main/js/default/pages/index/index.css | 38 ----- .../src/main/js/default/pages/index/index.js | 52 ------ .../js/resources/base/element/string.json | 12 -- .../entry/src/main/js/test/List.test.js | 15 -- .../main/js/test/MangerAbilityJsunit.test.js | 98 ----------- .../{entry => }/src/main/config.json | 66 ++++++-- .../main/js/MainAbility}/app.js | 0 .../main/js/MainAbility}/i18n/en-US.json | 0 .../main/js/MainAbility}/i18n/zh-CN.json | 0 .../main/js/MainAbility/pages/index/index.css | 24 +++ .../js/MainAbility}/pages/index/index.hml | 0 .../main/js/MainAbility/pages/index/index.js | 36 ++++ .../src/main/js/TestAbility/app.js | 31 ++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 50 ++++++ .../main/js/TestAbility/pages/index/index.hml | 21 +++ .../main/js/TestAbility/pages/index/index.js | 26 +++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 +++++++ .../src/main/js/test/List.test.js | 19 +++ .../main/js/test/MangerAbilityJsunit.test.js | 99 +++++++++++ .../main/resources/base/element/string.json | 28 ++++ .../main}/resources/base/media/icon.png | Bin .../actsamstestfifthscene/BUILD.gn | 11 +- .../actsamstestfifthscene/Test.json | 5 +- .../src/main/js/default/pages/index/index.css | 38 ----- .../js/resources/base/element/string.json | 12 -- .../entry/src/main/js/test/List.test.js | 15 -- .../main/js/test/MangerAbilityJsunit.test.js | 154 ----------------- .../{entry => }/src/main/config.json | 66 ++++++-- .../main/js/MainAbility}/app.js | 0 .../main/js/MainAbility}/i18n/en-US.json | 0 .../main/js/MainAbility}/i18n/zh-CN.json | 0 .../main/js/MainAbility/pages/index/index.css | 24 +++ .../js/MainAbility}/pages/index/index.hml | 0 .../main/js/MainAbility/pages/index/index.js | 36 ++++ .../src/main/js/TestAbility/app.js | 31 ++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 50 ++++++ .../main/js/TestAbility/pages/index/index.hml | 21 +++ .../main/js/TestAbility/pages/index/index.js | 26 +++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 +++++++ .../src/main/js/test/List.test.js | 19 +++ .../main/js/test/MangerAbilityJsunit.test.js | 155 ++++++++++++++++++ .../main/resources/base/element/string.json | 28 ++++ .../main}/resources/base/media/icon.png | Bin .../actsamstestfirstscene/BUILD.gn | 10 +- .../actsamstestfirstscene/Test.json | 5 +- .../src/main/js/default/pages/index/index.css | 38 ----- .../src/main/js/default/pages/index/index.js | 52 ------ .../js/resources/base/element/string.json | 12 -- .../entry/src/main/js/test/List.test.js | 15 -- .../main/js/test/MangerAbilityJsunit.test.js | 88 ---------- .../{entry => }/src/main/config.json | 74 ++++++--- .../main/js/MainAbility}/app.js | 0 .../main/js/MainAbility}/i18n/en-US.json | 0 .../main/js/MainAbility}/i18n/zh-CN.json | 0 .../js/MainAbility/pages/index/index.css} | 11 +- .../js/MainAbility}/pages/index/index.hml | 0 .../main/js/MainAbility/pages/index/index.js | 36 ++++ .../src/main/js/TestAbility/app.js | 31 ++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 50 ++++++ .../main/js/TestAbility/pages/index/index.hml | 21 +++ .../main/js/TestAbility/pages/index/index.js | 26 +++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 +++++++ .../src/main/js/test/List.test.js | 19 +++ .../main/js/test/MangerAbilityJsunit.test.js | 89 ++++++++++ .../main/resources/base/element/string.json | 28 ++++ .../main}/resources/base/media/icon.png | Bin .../actsamstestfourthscene/BUILD.gn | 12 +- .../actsamstestfourthscene/Test.json | 7 +- .../src/main/js/default/pages/index/index.css | 38 ----- .../src/main/js/default/pages/index/index.js | 52 ------ .../js/resources/base/element/string.json | 12 -- .../entry/src/main/js/test/List.test.js | 15 -- .../main/js/test/MangerAbilityJsunit.test.js | 154 ----------------- .../{entry => }/src/main/config.json | 66 ++++++-- .../main/js/MainAbility}/app.js | 0 .../main/js/MainAbility}/i18n/en-US.json | 0 .../main/js/MainAbility}/i18n/zh-CN.json | 0 .../main/js/MainAbility/pages/index/index.css | 24 +++ .../js/MainAbility}/pages/index/index.hml | 0 .../main/js/MainAbility/pages/index/index.js | 36 ++++ .../src/main/js/TestAbility/app.js | 31 ++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 50 ++++++ .../main/js/TestAbility/pages/index/index.hml | 21 +++ .../main/js/TestAbility/pages/index/index.js | 26 +++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 +++++++ .../src/main/js/test/List.test.js | 19 +++ .../main/js/test/MangerAbilityJsunit.test.js | 155 ++++++++++++++++++ .../main/resources/base/element/string.json | 28 ++++ .../main}/resources/base/media/icon.png | Bin .../actsamstestsecondscene/BUILD.gn | 11 +- .../actsamstestsecondscene/Test.json | 5 +- .../src/main/js/default/pages/index/index.css | 38 ----- .../src/main/js/default/pages/index/index.js | 52 ------ .../js/resources/base/element/string.json | 12 -- .../entry/src/main/js/test/List.test.js | 15 -- .../main/js/test/MangerAbilityJsunit.test.js | 110 ------------- .../{entry => }/src/main/config.json | 64 ++++++-- .../main/js/MainAbility}/app.js | 0 .../main/js/MainAbility}/i18n/en-US.json | 0 .../main/js/MainAbility}/i18n/zh-CN.json | 0 .../main/js/MainAbility/pages/index/index.css | 24 +++ .../js/MainAbility}/pages/index/index.hml | 0 .../main/js/MainAbility/pages/index/index.js | 36 ++++ .../src/main/js/TestAbility/app.js | 31 ++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 37 +++++ .../main/js/TestAbility/pages/index/index.hml | 21 +++ .../main/js/TestAbility/pages/index/index.js | 26 +++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 +++++++ .../src/main/js/test/List.test.js | 19 +++ .../main/js/test/MangerAbilityJsunit.test.js | 111 +++++++++++++ .../main/resources/base/element/string.json | 28 ++++ .../main}/resources/base/media/icon.png | Bin .../actsamstestthirdscene/BUILD.gn | 11 +- .../actsamstestthirdscene/Test.json | 3 +- .../src/main/js/default/pages/index/index.css | 38 ----- .../src/main/js/default/pages/index/index.js | 52 ------ .../js/resources/base/element/string.json | 12 -- .../entry/src/main/js/test/List.test.js | 15 -- .../main/js/test/MangerAbilityJsunit.test.js | 112 ------------- .../{entry => }/src/main/config.json | 66 ++++++-- .../main/js/MainAbility}/app.js | 0 .../main/js/MainAbility}/i18n/en-US.json | 0 .../main/js/MainAbility}/i18n/zh-CN.json | 0 .../main/js/MainAbility/pages/index/index.css | 24 +++ .../js/MainAbility}/pages/index/index.hml | 0 .../main/js/MainAbility/pages/index/index.js | 36 ++++ .../src/main/js/TestAbility/app.js | 31 ++++ .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 50 ++++++ .../main/js/TestAbility/pages/index/index.hml | 21 +++ .../main/js/TestAbility/pages/index/index.js | 26 +++ .../js/TestRunner/OpenHarmonyTestRunner.js | 59 +++++++ .../src/main/js/test/List.test.js | 19 +++ .../main/js/test/MangerAbilityJsunit.test.js | 113 +++++++++++++ .../main/resources/base/element/string.json | 28 ++++ .../main}/resources/base/media/icon.png | Bin 238 files changed, 4696 insertions(+), 2310 deletions(-) delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js rename ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/{entry => }/src/main/config.json (53%) rename ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (100%) rename ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/zh-CN.json (100%) rename ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.css (99%) rename ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (100%) rename ability/ability_runtime/abilitymanager/{actsamscallbackfourthscene/entry/src/main/js/default => actsamscallbackfifthscene/src/main/js/MainAbility}/pages/index/index.js (68%) create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.css create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/List.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/element/string.json rename ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js rename ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/{entry => }/src/main/config.json (55%) rename ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (100%) rename ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/zh-CN.json (100%) rename ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/{entry/src/main/js/test/List.test.js => src/main/js/MainAbility/pages/index/index.css} (82%) rename ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (100%) rename ability/ability_runtime/abilitymanager/{actsamstestfifthscene/entry/src/main/js/default => actsamscallbackfirstscene/src/main/js/MainAbility}/pages/index/index.js (68%) create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/zh-CN.json rename ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/{entry/src/main/js/default => src/main/js/TestAbility}/pages/index/index.css (77%) create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/List.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/element/string.json rename ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js rename ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/{entry => }/src/main/config.json (55%) rename ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (100%) rename ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/zh-CN.json (100%) rename ability/ability_runtime/abilitymanager/{actsamscallbacksecondscene/entry/src/main/js/test/List.test.js => actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.css} (82%) rename ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (100%) rename ability/ability_runtime/abilitymanager/{actsamscallbackfifthscene/entry/src/main/js/default => actsamscallbackfourthscene/src/main/js/MainAbility}/pages/index/index.js (67%) create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/zh-CN.json rename ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/{entry/src/main/js/default => src/main/js/TestAbility}/pages/index/index.css (77%) create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/List.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/element/string.json rename ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js rename ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/{entry => }/src/main/config.json (55%) rename ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (100%) rename ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/zh-CN.json (100%) rename ability/ability_runtime/abilitymanager/{actsamscallbackfifthscene/entry/src/main/js/test/List.test.js => actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.css} (82%) rename ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (100%) rename ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.js (67%) create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/zh-CN.json rename ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/{entry/src/main/js/default => src/main/js/TestAbility}/pages/index/index.css (77%) create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/List.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/element/string.json rename ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js rename ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/{entry => }/src/main/config.json (55%) rename ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (100%) rename ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/zh-CN.json (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.css rename ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.css create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/List.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/element/string.json rename ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js rename ability/ability_runtime/abilitymanager/actsamstestfifthscene/{entry => }/src/main/config.json (55%) rename ability/ability_runtime/abilitymanager/actsamstestfifthscene/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (100%) rename ability/ability_runtime/abilitymanager/actsamstestfifthscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/abilitymanager/actsamstestfifthscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/zh-CN.json (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.css rename ability/ability_runtime/abilitymanager/actsamstestfifthscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.css create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/List.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/element/string.json rename ability/ability_runtime/abilitymanager/actsamstestfifthscene/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js rename ability/ability_runtime/abilitymanager/actsamstestfirstscene/{entry => }/src/main/config.json (55%) rename ability/ability_runtime/abilitymanager/actsamstestfirstscene/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (100%) rename ability/ability_runtime/abilitymanager/actsamstestfirstscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/abilitymanager/actsamstestfirstscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/zh-CN.json (100%) rename ability/ability_runtime/abilitymanager/{actsamscallbackfourthscene/entry/src/main/js/test/List.test.js => actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.css} (82%) rename ability/ability_runtime/abilitymanager/actsamstestfirstscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.css create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/List.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/element/string.json rename ability/ability_runtime/abilitymanager/actsamstestfirstscene/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js rename ability/ability_runtime/abilitymanager/actsamstestfourthscene/{entry => }/src/main/config.json (55%) rename ability/ability_runtime/abilitymanager/actsamstestfourthscene/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (100%) rename ability/ability_runtime/abilitymanager/actsamstestfourthscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/abilitymanager/actsamstestfourthscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/zh-CN.json (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.css rename ability/ability_runtime/abilitymanager/actsamstestfourthscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.css create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/List.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/element/string.json rename ability/ability_runtime/abilitymanager/actsamstestfourthscene/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js rename ability/ability_runtime/abilitymanager/actsamstestsecondscene/{entry => }/src/main/config.json (56%) rename ability/ability_runtime/abilitymanager/actsamstestsecondscene/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (100%) rename ability/ability_runtime/abilitymanager/actsamstestsecondscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/abilitymanager/actsamstestsecondscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/zh-CN.json (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.css rename ability/ability_runtime/abilitymanager/actsamstestsecondscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.css create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/List.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/element/string.json rename ability/ability_runtime/abilitymanager/actsamstestsecondscene/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js delete mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js rename ability/ability_runtime/abilitymanager/actsamstestthirdscene/{entry => }/src/main/config.json (55%) rename ability/ability_runtime/abilitymanager/actsamstestthirdscene/{entry/src/main/js/default => src/main/js/MainAbility}/app.js (100%) rename ability/ability_runtime/abilitymanager/actsamstestthirdscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/en-US.json (100%) rename ability/ability_runtime/abilitymanager/actsamstestthirdscene/{entry/src/main/js/default => src/main/js/MainAbility}/i18n/zh-CN.json (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.css rename ability/ability_runtime/abilitymanager/actsamstestthirdscene/{entry/src/main/js/default => src/main/js/MainAbility}/pages/index/index.hml (100%) create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/app.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/en-US.json create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.css create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.hml create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/List.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js create mode 100644 ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/element/string.json rename ability/ability_runtime/abilitymanager/actsamstestthirdscene/{entry/src/main/js => src/main}/resources/base/media/icon.png (100%) diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/BUILD.gn index ecfc3c910..391e1a958 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/BUILD.gn +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/BUILD.gn @@ -14,7 +14,7 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsCallBackFifthSceneTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsAmsCallBackFifthSceneTest") { hap_name = "ActsAmsCallBackFifthSceneTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } + ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/Test.json index a6acecded..c61389c6e 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/Test.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/Test.json @@ -1,9 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.example.actsamscallbackfifthscene", + "bundle-name": "com.example.actsamscallbackfifthscene", + "package-name": "com.example.actsamscallbackfifthscene", "shell-timeout": "600000" }, "kits": [ diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 76e501f21..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 27b7481c8..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2022 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. - */ -import featureAbility from '@ohos.ability.featureAbility' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -let abilityNameList = [ - "com.ohos.launcher.MainAbility", - "com.ohos.callui.ServiceAbility", - "com.example.SimulateFeatureAbilityFir", - "com.example.VerifyIoThirdAbility", - "com.example.SimulateFeatureAbilitySed", - "com.example.actsamscallbackfifthscene.MainAbility" -] - -let bundleNameList = [ - "com.ohos.launcher", - "com.ohos.systemui", - "com.ohos.callui", - "com.ohos.contacts", - "com.ohos.mms", - "com.ohos.telephonydataability", - "com.ohos.contactsdataability", - "com.ix.simulate.feature", - "com.ix.verify.io", - "com.example.actsamscallbackfifthscene" -] - -describe('ActsAmsCallBackFifthScene', function () { - console.info('----ActsAmsCallBackFifthScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFifthScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilitySed", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilitySed start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - setTimeout(done, 5000); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - let start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_6600 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by CallBack) - */ - it('Acts_Ams_test_6600', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - appManager.getProcessRunningInfos( - (error, info) => { - console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code \ - ' + error.code + ', data length [' + info.length + ']'); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (let i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_6600 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); - } - ); - }) -}) \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/config.json similarity index 53% rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/config.json index 7df3196c8..92e6a35a3 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/config.json @@ -15,7 +15,9 @@ "deviceConfig": {}, "module": { "package": "com.example.actsamscallbackfifthscene", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", "deviceType": [ "phone" ], @@ -26,16 +28,42 @@ "installationFree": true }, "abilities": [ - { - "visible": true, - "name": "com.example.actsamscallbackfifthscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + } ], "reqPermissions": [ { @@ -77,7 +105,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.css similarity index 99% rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.css index a6053c61f..8b5cce53e 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.css @@ -31,6 +31,7 @@ height: 40%; margin: 10px; } + .btn { width: 50%; height: 100px; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.js similarity index 68% rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.js index 952dcd80e..08b387efa 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.js @@ -13,8 +13,6 @@ * limitations under the License. */ -import {Core, ExpectExtend} from 'deccjsunit/index' - const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') let once = true @@ -29,20 +27,6 @@ export default { if (once) { once = false console.info('onShow finish') - - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - this.timeout = 10000 - - require('../../../test/List.test') - core.execute() } }, onReady() { diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..ab4eb6cdb --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,45 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/List.test.js new file mode 100644 index 000000000..0c19f9ef0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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. + */ +import ActsAmsCallBackFifthScene from './MangerAbilityJsunit.test.js' + +export default function testsuite() { + ActsAmsCallBackFifthScene() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 000000000..cdbfb07bf --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2022 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. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +let abilityNameList = [ + "com.ohos.launcher.MainAbility", + "com.ohos.callui.ServiceAbility", + "com.example.SimulateFeatureAbilityFir", + "com.example.VerifyIoThirdAbility", + "com.example.SimulateFeatureAbilitySed", + "com.example.actsamscallbackfifthscene.MainAbility" +] + +let bundleNameList = [ + "com.ohos.launcher", + "com.ohos.systemui", + "com.ohos.callui", + "com.ohos.contacts", + "com.ohos.mms", + "com.ohos.telephonydataability", + "com.ohos.contactsdataability", + "com.ix.simulate.feature", + "com.ix.verify.io", + "com.example.actsamscallbackfifthscene" +] +export default function ActsAmsCallBackFifthScene() { + describe('ActsAmsCallBackFifthScene', function () { + console.info('----ActsAmsCallBackFifthScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFifthScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilitySed", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilitySed start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + setTimeout(done, 5000); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_6600 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by CallBack) + */ + it('Acts_Ams_test_6600', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + appManager.getProcessRunningInfos( + (error, info) => { + console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_6600 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); + } + ); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/element/string.json new file mode 100644 index 000000000..a4311fdbd --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/BUILD.gn index 2d1e9fecc..ecd15d7bf 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/BUILD.gn +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/BUILD.gn @@ -14,7 +14,7 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsCallBackFirstSceneTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsAmsCallBackFirstSceneTest") { hap_name = "ActsAmsCallBackFirstSceneTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/Test.json index 2b8fd0fed..b8119e4f4 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/Test.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/Test.json @@ -1,9 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.example.actsamscallbackfirstscene", + "bundle-name": "com.example.actsamscallbackfirstscene", + "package-name": "com.example.actsamscallbackfirstscene", "shell-timeout": "600000" }, "kits": [ diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 90fad1b64..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -let once = true -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - if (once) { - once = false - console.info('onShow finish') - - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - this.timeout = 10000 - - require('../../../test/List.test') - core.execute() - } - }, - onReady() { - console.info('onReady'); - }, -} - diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 76e501f21..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index bfc3c92aa..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2022 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. - */ -import featureAbility from '@ohos.ability.featureAbility' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit' - -describe('ActsAmsCallBackFirstScene', function () { - console.info('----ActsAmsCallBackFirstScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFirstScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_0200 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by CallBack) - */ - it('Acts_Ams_test_0200', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - appManager.getProcessRunningInfos( - (error, info) => { - console.info('Acts_Ams_test_0200 getProcessRunningInfos error.code \ - ' + error.code + ', data length [' + info.length + ']'); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (var i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_0200 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); - }); - }) -}) \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/config.json similarity index 55% rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/config.json index 7cf34a5c9..086264389 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/config.json @@ -15,7 +15,9 @@ "deviceConfig": {}, "module": { "package": "com.example.actsamscallbackfirstscene", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", "deviceType": [ "phone" ], @@ -26,16 +28,42 @@ "installationFree": true }, "abilities": [ - { - "visible": true, - "name": "com.example.actsamscallbackfirstscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + } ], "reqPermissions": [ { @@ -81,7 +109,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.css similarity index 82% rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.css index c282338f4..8638acd36 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/List.test.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.css @@ -12,4 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('./MangerAbilityJsunit.test.js') \ No newline at end of file + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.js similarity index 68% rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.js index 952dcd80e..178dbc0cf 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.js @@ -13,10 +13,9 @@ * limitations under the License. */ -import {Core, ExpectExtend} from 'deccjsunit/index' - const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + let once = true export default { data: { @@ -29,20 +28,6 @@ export default { if (once) { once = false console.info('onShow finish') - - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - this.timeout = 10000 - - require('../../../test/List.test') - core.execute() } }, onReady() { diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.css similarity index 77% rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.css index a6053c61f..2b45eb97c 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.css @@ -1,38 +1,50 @@ -/* - * 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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/List.test.js new file mode 100644 index 000000000..a9226a146 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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. + */ +import ActsAmsCallBackFirstScene from './MangerAbilityJsunit.test.js' + +export default function testsuite() { + ActsAmsCallBackFirstScene() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 000000000..97e42e908 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2022 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. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function ActsAmsCallBackFirstScene() { + describe('ActsAmsCallBackFirstScene', function () { + console.info('----ActsAmsCallBackFirstScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFirstScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_0200 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by CallBack) + */ + it('Acts_Ams_test_0200', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + appManager.getProcessRunningInfos( + (error, info) => { + console.info('Acts_Ams_test_0200 getProcessRunningInfos error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (var i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_0200 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); + }); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/element/string.json new file mode 100644 index 000000000..a4311fdbd --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/BUILD.gn index a1c7de3eb..4c5403204 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/BUILD.gn +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/BUILD.gn @@ -14,7 +14,7 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsCallBackFourthSceneTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsAmsCallBackFourthSceneTest") { hap_name = "ActsAmsCallBackFourthSceneTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } + ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/Test.json index 9e0e972fa..28d13d6bb 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/Test.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/Test.json @@ -1,9 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.example.actsamscallbackfourthscene", + "bundle-name": "com.example.actsamscallbackfourthscene", + "package-name": "com.example.actsamscallbackfourthscene", "shell-timeout": "600000" }, "kits": [ diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 76e501f21..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 0adfdff8c..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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. - */ -import featureAbility from '@ohos.ability.featureAbility' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsCallBackFourthScene', function () { - console.info('----ActsAmsCallBackFourthScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFourthScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFourthScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.act", - abilityName: "com.example.VerifyActThirdAbility", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFourthScene VerifyActThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.entry", - abilityName: "com.example.SimulateEntryAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackFourthScene SimulateEntryAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - let start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_5000 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by CallBack) - */ - it('Acts_Ams_test_5000', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - appManager.getProcessRunningInfos( - (error, info) => { - console.info('Acts_Ams_test_5000 getProcessRunningInfos error.code \ - ' + error.code + ', data length [' + info.length + ']'); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (let i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_5000 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); - }); - }) -}) \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/config.json similarity index 55% rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/config.json index b9d712493..4d0fbdc89 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/config.json @@ -15,7 +15,9 @@ "deviceConfig": {}, "module": { "package": "com.example.actsamscallbackfourthscene", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", "deviceType": [ "phone" ], @@ -26,16 +28,42 @@ "installationFree": true }, "abilities": [ - { - "visible": true, - "name": "com.example.actsamscallbackfourthscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + } ], "reqPermissions": [ { @@ -81,7 +109,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.css similarity index 82% rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.css index c282338f4..2334ecfa2 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/List.test.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.css @@ -12,4 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('./MangerAbilityJsunit.test.js') \ No newline at end of file + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.js similarity index 67% rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.js index 43f7611f8..08b387efa 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.js @@ -13,8 +13,6 @@ * limitations under the License. */ -import {Core, ExpectExtend} from 'deccjsunit/index' - const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') let once = true @@ -29,20 +27,6 @@ export default { if (once) { once = false console.info('onShow finish') - - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - id: 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - this.timeout = 10000 - - require('../../../test/List.test') - core.execute() } }, onReady() { diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.css similarity index 77% rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.css index a6053c61f..2b45eb97c 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.css @@ -1,38 +1,50 @@ -/* - * 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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/List.test.js new file mode 100644 index 000000000..2a77e1027 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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. + */ +import ActsAmsCallBackFourthScene from './MangerAbilityJsunit.test.js' + +export default function testsuite() { + ActsAmsCallBackFourthScene() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 000000000..0019c3985 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,139 @@ +/* + * 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. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function ActsAmsCallBackFourthScene() { + describe('ActsAmsCallBackFourthScene', function () { + console.info('----ActsAmsCallBackFourthScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFourthScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFourthScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.act", + abilityName: "com.example.VerifyActThirdAbility", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFourthScene VerifyActThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.entry", + abilityName: "com.example.SimulateEntryAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackFourthScene SimulateEntryAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_5000 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by CallBack) + */ + it('Acts_Ams_test_5000', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + appManager.getProcessRunningInfos( + (error, info) => { + console.info('Acts_Ams_test_5000 getProcessRunningInfos error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_5000 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); + }); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/element/string.json new file mode 100644 index 000000000..a4311fdbd --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/BUILD.gn index 88501a06a..fc0823c56 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/BUILD.gn +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/BUILD.gn @@ -14,7 +14,7 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsCallBackSecondSceneTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsAmsCallBackSecondSceneTest") { hap_name = "ActsAmsCallBackSecondSceneTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } + ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/Test.json index 28073d293..445182eea 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/Test.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/Test.json @@ -1,9 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.example.actsamscallbacksecondscene", + "bundle-name": "com.example.actsamscallbacksecondscene", + "package-name": "com.example.actsamscallbacksecondscene", "shell-timeout": "600000" }, "kits": [ diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 76e501f21..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 97db2e348..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ -import featureAbility from '@ohos.ability.featureAbility' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit' - -describe('ActsAmsCallBackSecondScene', function () { - console.info('----ActsAmsCallBackSecondScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackSecondScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackSecondScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - let start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_1800 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by CallBack) - */ - it('Acts_Ams_test_1800', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - appManager.getProcessRunningInfos( - (error, info) => { - console.info('Acts_Ams_test_1800 getProcessRunningInfos error.code \ - ' + error.code + ', data length [' + info.length + ']'); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (let i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_1800 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); - }); - }) -}) \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/config.json similarity index 55% rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/config.json index ffd0db98f..42a625c57 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/config.json @@ -15,7 +15,9 @@ "deviceConfig": {}, "module": { "package": "com.example.actsamscallbacksecondscene", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", "deviceType": [ "phone" ], @@ -26,16 +28,42 @@ "installationFree": true }, "abilities": [ - { - "visible": true, - "name": "com.example.actsamscallbacksecondscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + } ], "reqPermissions": [ { @@ -81,7 +109,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.css similarity index 82% rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.css index c282338f4..2334ecfa2 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/List.test.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.css @@ -12,4 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('./MangerAbilityJsunit.test.js') \ No newline at end of file + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.js similarity index 67% rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.js index f470b9c0a..08b387efa 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.js @@ -13,8 +13,6 @@ * limitations under the License. */ -import {Core, ExpectExtend} from 'deccjsunit/index' - const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') let once = true @@ -29,20 +27,6 @@ export default { if (once) { once = false console.info('onShow finish') - - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - this.timeout = 10000 - - require('../../../test/List.test') - core.execute() } }, onReady() { diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.css similarity index 77% rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.css index a6053c61f..2b45eb97c 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.css @@ -1,38 +1,50 @@ -/* - * 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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/List.test.js new file mode 100644 index 000000000..d595f671e --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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. + */ +import ActsAmsCallBackSecondScene from './MangerAbilityJsunit.test.js' + +export default function testsuite() { + ActsAmsCallBackSecondScene() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 000000000..ec967a4a9 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,105 @@ +/* + * 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. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function ActsAmsCallBackSecondScene() { + describe('ActsAmsCallBackSecondScene', function () { + console.info('----ActsAmsCallBackSecondScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackSecondScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackSecondScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_1800 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by CallBack) + */ + it('Acts_Ams_test_1800', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + appManager.getProcessRunningInfos( + (error, info) => { + console.info('Acts_Ams_test_1800 getProcessRunningInfos error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_1800 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); + }); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/element/string.json new file mode 100644 index 000000000..054c46cf8 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/BUILD.gn index fc71bc14a..79b9a0d70 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/BUILD.gn +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/BUILD.gn @@ -14,7 +14,7 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsCallBackThirdSceneTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsAmsCallBackThirdSceneTest") { hap_name = "ActsAmsCallBackThirdSceneTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } + ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/Test.json index 51f3d22e8..688e85f56 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/Test.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/Test.json @@ -1,9 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.example.actsamscallbackthirdscene", + "bundle-name": "com.example.actsamscallbackthirdscene", + "package-name": "com.example.actsamscallbackthirdscene", "shell-timeout": "600000" }, "kits": [ diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index a6053c61f..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index f470b9c0a..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') -let once = true -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - if (once) { - once = false - console.info('onShow finish') - - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - this.timeout = 10000 - - require('../../../test/List.test') - core.execute() - } - }, - onReady() { - console.info('onReady'); - }, -} - diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 76e501f21..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js deleted file mode 100644 index c282338f4..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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. - */ -require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index fe25d2e6d..000000000 --- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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. - */ -import featureAbility from '@ohos.ability.featureAbility' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsCallBackThirdScene', function () { - console.info('----ActsAmsCallBackThirdScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackThirdScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsCallBackThirdScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function sleep(delay) { - let start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_3400 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by CallBack) - */ - it('Acts_Ams_test_3400', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - appManager.getProcessRunningInfos( - (error, info) => { - console.info('Acts_Ams_test_3400 getProcessRunningInfos error.code \ - ' + error.code + ', data length [' + info.length + ']'); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (let i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_3400 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); - }); - }) -}) \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/config.json similarity index 55% rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/config.json index e1ae6f5d9..98f7d882b 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/config.json @@ -15,7 +15,9 @@ "deviceConfig": {}, "module": { "package": "com.example.actsamscallbackthirdscene", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", "deviceType": [ "phone" ], @@ -26,16 +28,42 @@ "installationFree": true }, "abilities": [ - { - "visible": true, - "name": "com.example.actsamscallbackthirdscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + } ], "reqPermissions": [ { @@ -81,7 +109,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..2334ecfa2 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * 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. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..08b387efa --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +let once = true +export default { + data: { + title: '' + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + if (once) { + once = false + console.info('onShow finish') + } + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..2b45eb97c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,50 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/List.test.js new file mode 100644 index 000000000..6f30824ff --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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. + */ +import ActsAmsCallBackThirdScene from './MangerAbilityJsunit.test.js' + +export default function testsuite() { + ActsAmsCallBackThirdScene() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 000000000..2f01f033a --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,99 @@ +/* + * 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. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function ActsAmsCallBackThirdScene() { + describe('ActsAmsCallBackThirdScene', function () { + console.info('----ActsAmsCallBackThirdScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackThirdScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsCallBackThirdScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_3400 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by CallBack) + */ + it('Acts_Ams_test_3400', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + appManager.getProcessRunningInfos( + (error, info) => { + console.info('Acts_Ams_test_3400 getProcessRunningInfos error.code \ + ' + error.code + ', data length [' + info.length + ']'); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_3400 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); + }); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/element/string.json new file mode 100644 index 000000000..0a0eff2e8 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] + } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/BUILD.gn index 58f7a2113..bb404efea 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/BUILD.gn +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsTestFifthSceneTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -22,9 +22,12 @@ ohos_js_hap_suite("ActsAmsTestFifthSceneTest") { hap_name = "ActsAmsTestFifthSceneTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } + ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/Test.json index f02cf70ee..3d52382e7 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/Test.json +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/Test.json @@ -1,9 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.example.actsamstestfifthscene", + "bundle-name": "com.example.actsamstestfifthscene", + "package-name": "com.example.actsamstestfifthscene", "shell-timeout": "600000" }, "kits": [ diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index a6053c61f..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 76e501f21..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js deleted file mode 100644 index c282338f4..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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. - */ -require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index fd889cd01..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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. - */ -import featureAbility from '@ohos.ability.featureAbility' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -let abilityNameList = [ - "com.ohos.launcher.MainAbility", - "com.ohos.callui.ServiceAbility", - "com.example.SimulateFeatureAbilityFir", - "com.example.SimulateFeatureAbilitySed", - "com.example.VerifyIoThirdAbility", - "com.example.actsamstestfifthscene.MainAbility" -] - -let bundleNameList = [ - "com.ohos.launcher", - "com.ohos.systemui", - "com.ohos.callui", - "com.ohos.contacts", - "com.ohos.mms", - "com.ohos.telephonydataability", - "com.ohos.contactsdataability", - "com.ix.simulate.feature", - "com.ix.verify.io", - "com.example.actsamstestfifthscene" -] - -describe('ActsAmsTestFifthScene', function () { - console.info('----ActsAmsTestFifthScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFifthScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFifthScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilitySed", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFifthScene SimulateFeatureAbilitySed start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - let start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_0100 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by Promise) - */ - it('Acts_Ams_test_0100', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - let info = await appManager.getProcessRunningInfos(); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (let i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); - }) -}) \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/config.json similarity index 55% rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/config.json index cba2279ac..84a1ef480 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/config.json @@ -15,7 +15,9 @@ "deviceConfig": {}, "module": { "package": "com.example.actsamstestfifthscene", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", "deviceType": [ "phone" ], @@ -26,16 +28,42 @@ "installationFree": true }, "abilities": [ - { - "visible": true, - "name": "com.example.actsamstestfifthscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + } ], "reqPermissions": [ { @@ -81,7 +109,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..2334ecfa2 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * 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. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..08b387efa --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +let once = true +export default { + data: { + title: '' + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + if (once) { + once = false + console.info('onShow finish') + } + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..2b45eb97c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,50 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/List.test.js new file mode 100644 index 000000000..1c4621831 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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. + */ +import ActsAmsTestFifthScene from './MangerAbilityJsunit.test.js' + +export default function testsuite() { + ActsAmsTestFifthScene() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 000000000..f45e6131a --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,155 @@ +/* + * 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. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +let abilityNameList = [ + "com.ohos.launcher.MainAbility", + "com.ohos.callui.ServiceAbility", + "com.example.SimulateFeatureAbilityFir", + "com.example.SimulateFeatureAbilitySed", + "com.example.VerifyIoThirdAbility", + "com.example.actsamstestfifthscene.MainAbility" +] + +let bundleNameList = [ + "com.ohos.launcher", + "com.ohos.systemui", + "com.ohos.callui", + "com.ohos.contacts", + "com.ohos.mms", + "com.ohos.telephonydataability", + "com.ohos.contactsdataability", + "com.ix.simulate.feature", + "com.ix.verify.io", + "com.example.actsamstestfifthscene" +] +export default function ActsAmsTestFifthScene() { + describe('ActsAmsTestFifthScene', function () { + console.info('----ActsAmsTestFifthScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFifthScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFifthScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilitySed", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFifthScene SimulateFeatureAbilitySed start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_0100 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by Promise) + */ + it('Acts_Ams_test_0100', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + let info = await appManager.getProcessRunningInfos(); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (let i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/element/string.json new file mode 100644 index 000000000..dd84c367c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/BUILD.gn index 41b9102aa..140c37d53 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/BUILD.gn +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsTestFirstSceneTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -22,9 +22,11 @@ ohos_js_hap_suite("ActsAmsTestFirstSceneTest") { hap_name = "ActsAmsTestFirstSceneTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/Test.json index 4bd37e87f..a841c8d6f 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/Test.json +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/Test.json @@ -1,9 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.example.actsamstestfirstscene", + "bundle-name": "com.example.actsamstestfirstscene", + "package-name": "com.example.actsamstestfirstscene", "shell-timeout": "600000" }, "kits": [ diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index a6053c61f..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index f470b9c0a..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') -let once = true -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - if (once) { - once = false - console.info('onShow finish') - - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - this.timeout = 10000 - - require('../../../test/List.test') - core.execute() - } - }, - onReady() { - console.info('onReady'); - }, -} - diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 76e501f21..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js deleted file mode 100644 index c282338f4..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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. - */ -require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 5df9e464e..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ -import featureAbility from '@ohos.ability.featureAbility' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsTestFirstScene', function () { - console.info('----ActsAmsTestFirstScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFirstScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_0100 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by Promise) - */ - it('Acts_Ams_test_0100', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - var info = await appManager.getProcessRunningInfos(); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (var i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); - }) -}) \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/config.json similarity index 55% rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/config.json index 0aa9487ed..89355be85 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/config.json @@ -15,7 +15,9 @@ "deviceConfig": {}, "module": { "package": "com.example.actsamstestfirstscene", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", "deviceType": [ "phone" ], @@ -25,26 +27,42 @@ "moduleType": "entry" }, "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": "com.example.actsamstestfirstscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + } ], "reqPermissions": [ { @@ -90,7 +108,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.css similarity index 82% rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/List.test.js rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.css index c282338f4..8638acd36 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/List.test.js +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.css @@ -12,4 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('./MangerAbilityJsunit.test.js') \ No newline at end of file + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..08b387efa --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +let once = true +export default { + data: { + title: '' + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + if (once) { + once = false + console.info('onShow finish') + } + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..2b45eb97c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,50 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/List.test.js new file mode 100644 index 000000000..d926d8da9 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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. + */ +import ActsAmsTestFirstScene from './MangerAbilityJsunit.test.js' + +export default function testsuite() { + ActsAmsTestFirstScene() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 000000000..f7a92b900 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,89 @@ +/* + * 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. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function ActsAmsTestFirstScene() { + describe('ActsAmsTestFirstScene', function () { + console.info('----ActsAmsTestFirstScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFirstScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_0100 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by Promise) + */ + it('Acts_Ams_test_0100', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + var info = await appManager.getProcessRunningInfos(); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (var i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/element/string.json new file mode 100644 index 000000000..dd84c367c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/BUILD.gn index 20b13d3ae..bb9ffa777 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/BUILD.gn +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/BUILD.gn @@ -10,10 +10,11 @@ # 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. + import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsTestFourthSceneTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -22,9 +23,12 @@ ohos_js_hap_suite("ActsAmsTestFourthSceneTest") { hap_name = "ActsAmsTestFourthSceneTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } + ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/Test.json index cf3b5c6e2..bac0cbf90 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/Test.json +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/Test.json @@ -1,10 +1,11 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.example.actsamstestfourthscene", - "shell-timeout": "60000" + "bundle-name": "com.example.actsamstestfourthscene", + "package-name": "com.example.actsamstestfourthscene", + "shell-timeout": "600000" }, "kits": [ { diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index a6053c61f..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index f470b9c0a..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') -let once = true -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - if (once) { - once = false - console.info('onShow finish') - - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - this.timeout = 10000 - - require('../../../test/List.test') - core.execute() - } - }, - onReady() { - console.info('onReady'); - }, -} - diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 76e501f21..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js deleted file mode 100644 index c282338f4..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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. - */ -require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 009209ae9..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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. - */ -import featureAbility from '@ohos.ability.featureAbility' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsTestFourthScene', function () { - console.info('----ActsAmsTestFourthScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFourthScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFourthScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.act", - abilityName: "com.example.VerifyActThirdAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFourthScene VerifyActThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.entry", - abilityName: "com.example.SimulateEntryAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestFourthScene SimulateEntryAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_1700 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by Promise) - */ - it('Acts_Ams_test_1700', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - var info = await appManager.getProcessRunningInfos(); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (var i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); - }) -}) \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/config.json similarity index 55% rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/config.json index b0f032e0f..76e63afa3 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/config.json @@ -15,7 +15,9 @@ "deviceConfig": {}, "module": { "package": "com.example.actsamstestfourthscene", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", "deviceType": [ "phone" ], @@ -26,16 +28,42 @@ "installationFree": true }, "abilities": [ - { - "visible": true, - "name": "com.example.actsamstestfourthscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + } ], "reqPermissions": [ { @@ -81,7 +109,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..2334ecfa2 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * 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. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..08b387efa --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +let once = true +export default { + data: { + title: '' + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + if (once) { + once = false + console.info('onShow finish') + } + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..2b45eb97c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,50 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/List.test.js new file mode 100644 index 000000000..975abcb5f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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. + */ +import ActsAmsTestFourthScene from './MangerAbilityJsunit.test.js' + +export default function testsuite() { + ActsAmsTestFourthScene() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 000000000..85272fd59 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,155 @@ +/* + * 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. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function ActsAmsTestFourthScene() { + describe('ActsAmsTestFourthScene', function () { + console.info('----ActsAmsTestFourthScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFourthScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFourthScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.act", + abilityName: "com.example.VerifyActThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFourthScene VerifyActThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.entry", + abilityName: "com.example.SimulateEntryAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestFourthScene SimulateEntryAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_1700 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by Promise) + */ + it('Acts_Ams_test_1700', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + var info = await appManager.getProcessRunningInfos(); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (var i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/element/string.json new file mode 100644 index 000000000..dd84c367c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/BUILD.gn index cf56c295b..c4e09388f 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/BUILD.gn +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsTestSecondSceneTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -22,9 +22,12 @@ ohos_js_hap_suite("ActsAmsTestSecondSceneTest") { hap_name = "ActsAmsTestSecondSceneTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } + ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/Test.json index 2a9a90561..cb5016a78 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/Test.json +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/Test.json @@ -1,9 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.example.actsamstestsecondscene", + "bundle-name": "com.example.actsamstestsecondscene", + "package-name": "com.example.actsamstestsecondscene", "shell-timeout": "600000" }, "kits": [ diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index a6053c61f..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index f470b9c0a..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') -let once = true -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - if (once) { - once = false - console.info('onShow finish') - - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - this.timeout = 10000 - - require('../../../test/List.test') - core.execute() - } - }, - onReady() { - console.info('onReady'); - }, -} - diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 76e501f21..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js deleted file mode 100644 index c282338f4..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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. - */ -require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index e90d26e44..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ -import featureAbility from '@ohos.ability.featureAbility' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsTestSecondScene', function () { - console.info('----ActsAmsTestSecondScene----'); - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestSecondScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestSecondScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_1700 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by Promise) - */ - it('Acts_Ams_test_1700', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - var info = await appManager.getProcessRunningInfos(); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (var i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); - }) -}) \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/config.json similarity index 56% rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/config.json index 70128f8ab..c28a0df5f 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/config.json @@ -15,7 +15,9 @@ "deviceConfig": {}, "module": { "package": "com.example.actsamstestsecondscene", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", "deviceType": [ "phone" ], @@ -27,16 +29,42 @@ }, "abilities": [ { - "visible": true, - "name": "com.example.actsamstestsecondscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" } - ], + ], "reqPermissions": [ { "name": "ohos.permission.INSTALL_BUNDLE", @@ -81,7 +109,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..2334ecfa2 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * 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. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..08b387efa --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +let once = true +export default { + data: { + title: '' + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + if (once) { + once = false + console.info('onShow finish') + } + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..1ba8e4e82 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,37 @@ +/* + * 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. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} + + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/List.test.js new file mode 100644 index 000000000..fb011db8f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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. + */ +import ActsAmsTestSecondScene from './MangerAbilityJsunit.test.js' + +export default function testsuite() { + ActsAmsTestSecondScene() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 000000000..a8075e657 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,111 @@ +/* + * 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. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function ActsAmsTestSecondScene() { + describe('ActsAmsTestSecondScene', function () { + console.info('----ActsAmsTestSecondScene----'); + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestSecondScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestSecondScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_1700 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by Promise) + */ + it('Acts_Ams_test_1700', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + var info = await appManager.getProcessRunningInfos(); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (var i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/element/string.json new file mode 100644 index 000000000..a4311fdbd --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/BUILD.gn index 1e9d4da0b..f982b0ac2 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/BUILD.gn +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsTestThirdSceneTest") { - hap_profile = "./entry/src/main/config.json" + hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", @@ -22,9 +22,12 @@ ohos_js_hap_suite("ActsAmsTestThirdSceneTest") { hap_name = "ActsAmsTestThirdSceneTest" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } + ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/Test.json index 629d26991..6928b68ca 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/Test.json +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/Test.json @@ -3,7 +3,8 @@ "driver": { "type": "JSUnitTest", "test-timeout": "300000", - "package": "com.example.actsamstestthirdscene", + "bundle-name": "com.example.actsamstestthirdscene", + "package-name": "com.example.actsamstestthirdscene", "shell-timeout": "600000" }, "kits": [ diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index a6053c61f..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -.container { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - left: 0px; - top: 0px; - width: 100%; - height: 100%; -} - -.title { - font-size: 60px; - text-align: center; - width: 100%; - height: 40%; - margin: 10px; -} -.btn { - width: 50%; - height: 100px; - font-size: 40px; -} diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index f470b9c0a..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') -let once = true -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - if (once) { - once = false - console.info('onShow finish') - - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - this.timeout = 10000 - - require('../../../test/List.test') - core.execute() - } - }, - onReady() { - console.info('onReady'); - }, -} - diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 76e501f21..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JsHelloWorld" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js deleted file mode 100644 index c282338f4..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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. - */ -require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js deleted file mode 100644 index 570a85fe0..000000000 --- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ -import featureAbility from '@ohos.ability.featureAbility' -import appManager from "@ohos.application.appManager" -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' - -describe('ActsAmsTestThirdScene', function () { - console.info('----ActsAmsTestThirdScene----'); - - beforeAll(async function (done) { - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.simulate.feature", - abilityName: "com.example.SimulateFeatureAbilityFir", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestThirdScene SimulateFeatureAbilityFir start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - - await featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.ix.verify.io", - abilityName: "com.example.VerifyIoThirdAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - options: - {}, - parameters: - {}, - }, - }, (error, data) => { - console.info('ActsAmsTestThirdScene VerifyIoThirdAbility start, error.code \ - ' + error.code + ', data length [' + data.length + ']'); - } - ); - done(); - }); - - function timeout(done) { - expect().assertFail(); - console.debug('Acts_Ams_test=========timeout========'); - done(); - } - - function sleep(delay) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > delay) { - break; - } - } - } - - /* - * @tc.number : Acts_Ams_test_3300 - * @tc.name : getProcessRunningInfos : Get All Running Processes Info - * @tc.desc : Get All Running Processes Info(by Promise) - */ - it('Acts_Ams_test_3300', 0, async function (done) { - console.info("sleep begin"); - sleep(5000); - console.info("sleep end"); - var info = await appManager.getProcessRunningInfos(); - console.info('Acts_Ams_test_3300 getProcessRunningInfos JSON String: ' + JSON.stringify(info)); - expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertLarger(0); - for (var i = 0; i < info.length; i++) { - console.info('Acts_Ams_test_3300 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); - }) -}) \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/config.json similarity index 55% rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/config.json rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/config.json index 404bffd0f..4885d8a23 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/config.json @@ -15,7 +15,9 @@ "deviceConfig": {}, "module": { "package": "com.example.actsamstestthirdscene", - "name": ".MyApplication", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", "deviceType": [ "phone" ], @@ -26,16 +28,42 @@ "installationFree": true }, "abilities": [ - { - "visible": true, - "name": "com.example.actsamstestthirdscene.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "singleton" - } + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "singleton" + } ], "reqPermissions": [ { @@ -81,7 +109,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/app.js similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/app.js rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/app.js diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/i18n/en-US.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..322e0a4d4 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * 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. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.hml rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.hml diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..08b387efa --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +let once = true +export default { + data: { + title: '' + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + if (once) { + once = false + console.info('onShow finish') + } + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..2b45eb97c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,50 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/List.test.js new file mode 100644 index 000000000..13fd8bd00 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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. + */ +import ActsAmsTestThirdScene from './MangerAbilityJsunit.test.js' + +export default function testsuite() { + ActsAmsTestThirdScene() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 000000000..19bfe0959 --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,113 @@ +/* + * 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. + */ +import featureAbility from '@ohos.ability.featureAbility' +import appManager from "@ohos.application.appManager" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +export default function ActsAmsTestThirdScene() { + describe('ActsAmsTestThirdScene', function () { + console.info('----ActsAmsTestThirdScene----'); + + beforeAll(async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestThirdScene SimulateFeatureAbilityFir start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, (error, data) => { + console.info('ActsAmsTestThirdScene VerifyIoThirdAbility start, error.code \ + ' + error.code + ', data length [' + data.length + ']'); + } + ); + done(); + }); + + function timeout(done) { + expect().assertFail(); + console.debug('Acts_Ams_test=========timeout========'); + done(); + } + + function sleep(delay) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + /* + * @tc.number : Acts_Ams_test_3300 + * @tc.name : getProcessRunningInfos : Get All Running Processes Info + * @tc.desc : Get All Running Processes Info(by Promise) + */ + it('Acts_Ams_test_3300', 0, async function (done) { + console.info("sleep begin"); + sleep(5000); + console.info("sleep end"); + var info = await appManager.getProcessRunningInfos(); + console.info('Acts_Ams_test_3300 getProcessRunningInfos JSON String: ' + JSON.stringify(info)); + expect(Array.isArray(info)).assertEqual(true); + expect(info.length).assertLarger(0); + for (var i = 0; i < info.length; i++) { + console.info('Acts_Ams_test_3300 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[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(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(); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/element/string.json new file mode 100644 index 000000000..a4311fdbd --- /dev/null +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/media/icon.png similarity index 100% rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/media/icon.png -- GitLab