diff --git a/OAT.xml b/OAT.xml
index 89cdf49e8c16d8db27d4ccbb8499e38fed276a46..671a4af15f4ef170b7d994cbafa1774fafb9f645 100755
--- a/OAT.xml
+++ b/OAT.xml
@@ -64,6 +64,7 @@ Note:If the text contains special characters, please escape them according to th
+
diff --git a/aafwk_lite/ability_hal/src/ability_mgr_test.c b/aafwk_lite/ability_hal/src/ability_mgr_test.c
index 191f9d39c0e82652f82e26bbfaf623e4f22a65ae..6220a7b435d4066a1687e35ad1df70a4129c0509 100755
--- a/aafwk_lite/ability_hal/src/ability_mgr_test.c
+++ b/aafwk_lite/ability_hal/src/ability_mgr_test.c
@@ -15,14 +15,18 @@
#include
#include
+#include
+#include
+#include
+#include
#include "hctest.h"
#include "ohos_types.h"
-
#include "ability_manager.h"
+#include "ability_errors.h"
#include "want.h"
-static int32_t g_errorCode = -1;
+#define DATA_EXTERN (2 * 3)
/**
* @brief register a test suit named AbilityMgrTestSuite
@@ -46,50 +50,66 @@ static BOOL AbilityMgrTestSuiteTearDown(void)
/**
* @tc.number : SUB_AAFWK_ABILITY_0001
- * @tc.name : testClearElement parameter legal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.name : testClearElementLegal
+ * @tc.desc : testClearElement parameter legal test
*/
-LITE_TEST_CASE(AbilityMgrTestSuite, testClearElement, Function | MediumTest | Level0)
+LITE_TEST_CASE(AbilityMgrTestSuite, testClearElementLegal, Function | MediumTest | Level0)
{
- printf("------start testClearElement------\n");
+ printf("------start testClearElementLegal------\n");
ElementName element = { 0 };
+ SetElementDeviceID(&element, "0001000");
+ SetElementBundleName(&element, "com.openharmony.testnative");
bool ret = SetElementAbilityName(&element, "SecondAbility");
if (ret) {
char aName[] = "SecondAbility";
+ char bName[] = "com.openharmony.testnative";
+ char dID[] = "0001000";
TEST_ASSERT_EQUAL_STRING(element.abilityName, aName);
+ TEST_ASSERT_EQUAL_STRING(element.bundleName, bName);
+ TEST_ASSERT_EQUAL_STRING(element.deviceId, dID);
ClearElement(&element);
TEST_ASSERT_EQUAL_STRING(element.abilityName, NULL);
+ TEST_ASSERT_EQUAL_STRING(element.bundleName, NULL);
+ TEST_ASSERT_EQUAL_STRING(element.deviceId, NULL);
}
- printf("------end testClearElement------\n");
+ printf("------end testClearElementLegal------\n");
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0002
- * @tc.name : testClearElement parameter illegal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.name : testClearElementIllegal
+ * @tc.desc : testClearElement parameter illegal test
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testClearElementIllegal, Function | MediumTest | Level0)
{
printf("------start testClearElementIllegal------\n");
ElementName element = { 0 };
+ SetElementDeviceID(&element, "0001000");
+ SetElementBundleName(&element, "com.openharmony.testnative");
bool ret = SetElementAbilityName(&element, "SecondAbility");
if (ret) {
char aName[] = "SecondAbility";
+ char bName[] = "com.openharmony.testnative";
+ char dID[] = "0001000";
TEST_ASSERT_EQUAL_STRING(element.abilityName, aName);
+ TEST_ASSERT_EQUAL_STRING(element.bundleName, bName);
+ TEST_ASSERT_EQUAL_STRING(element.deviceId, dID);
ClearElement(NULL);
TEST_ASSERT_EQUAL_STRING(element.abilityName, aName);
+ TEST_ASSERT_EQUAL_STRING(element.bundleName, bName);
+ TEST_ASSERT_EQUAL_STRING(element.deviceId, dID);
}
printf("------end testClearElementIllegal------\n");
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0003
- * @tc.name : testSetWantElement parameter legal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.name : testSetWantElementLegal
+ * @tc.desc : testSetWantElement parameter legal test
*/
-LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElement, Function | MediumTest | Level0)
+LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElementLegal, Function | MediumTest | Level0)
{
- printf("------start testSetWantElement------\n");
+ printf("------start testSetWantElementLegal------\n");
Want want = { 0 };
ElementName element = { 0 };
SetElementDeviceID(&element, "0001000");
@@ -105,18 +125,19 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElement, Function | MediumTest |
}
ClearElement(&element);
ClearWant(&want);
- printf("------end testSetWantElement------\n");
+ TEST_ASSERT_EQUAL_STRING(want.element, NULL);
+ printf("------end testSetWantElementLegal------\n");
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0004
- * @tc.name : testSetWantElement parameter illegal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.name : testSetWantElementIllegal
+ * @tc.desc : testSetWantElement parameter illegal test
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElementIllegal, Function | MediumTest | Level2)
{
printf("------start testSetWantElementIllegal------\n");
- Want want= { 0 };
+ Want want = { 0 };
ElementName element = { 0 };
bool ret = SetWantElement(&want, element);
if (ret) {
@@ -133,22 +154,27 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElementIllegal, Function | Medium
/**
* @tc.number : SUB_AAFWK_ABILITY_0005
- * @tc.name : testClearWant parameter illegal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.name : testClearWantIllegal
+ * @tc.desc : testClearWant parameter illegal test
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testClearWantIllegal, Function | MediumTest | Level2)
{
printf("------start testClearWantIllegal------\n");
Want want = { 0 };
ElementName element = { 0 };
+ SetElementDeviceID(&element, "0001000");
+ SetElementBundleName(&element, "com.openharmony.testnative");
bool ret = SetElementAbilityName(&element, "SecondAbility");
if (ret) {
ret = SetWantElement(&want, element);
if (ret) {
- char aName[] = "SecondAbility";
- TEST_ASSERT_EQUAL_STRING(want.element->abilityName, aName);
+ TEST_ASSERT_EQUAL_STRING(want.element->deviceId, "0001000");
+ TEST_ASSERT_EQUAL_STRING(want.element->abilityName, "SecondAbility");
+ TEST_ASSERT_EQUAL_STRING(want.element->bundleName, "com.openharmony.testnative");
ClearWant(NULL);
- TEST_ASSERT_EQUAL_STRING(want.element->abilityName, aName);
+ TEST_ASSERT_EQUAL_STRING(want.element->deviceId, "0001000");
+ TEST_ASSERT_EQUAL_STRING(want.element->abilityName, "SecondAbility");
+ TEST_ASSERT_EQUAL_STRING(want.element->bundleName, "com.openharmony.testnative");
}
}
ClearElement(&element);
@@ -158,26 +184,29 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testClearWantIllegal, Function | MediumTest
/**
* @tc.number : SUB_AAFWK_ABILITY_0006
- * @tc.name : testSetWantDate parameter legal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.name : testSetWantDateLegal
+ * @tc.desc : testSetWantDate parameter legal test
*/
-LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantDate, Function | MediumTest | Level0)
+LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantDateLegal, Function | MediumTest | Level0)
{
- printf("------start testSetWantDate------\n");
+ printf("------start testSetWantDateLegal------\n");
Want want = { 0 };
- SetWantData(&want, "test", 5);
+ char *data = "test";
+ SetWantData(&want, (void *)data, strlen(data) + 1);
if (want.data != NULL) {
- TEST_ASSERT_EQUAL_STRING((char*)(want.data), "test");
- TEST_ASSERT_TRUE(want.dataLength == 5);
+ TEST_ASSERT_EQUAL_STRING((char*)(want.data), data);
+ TEST_ASSERT_TRUE(want.dataLength == strlen(data) + 1);
}
ClearWant(&want);
- printf("------end testSetWantDate------\n");
+ TEST_ASSERT_EQUAL_STRING(want.data, NULL);
+ TEST_ASSERT_TRUE(want.dataLength == strlen(data) + 1);
+ printf("------end testSetWantDateLegal------\n");
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0007
- * @tc.name : testSetWantDate parameter illegal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.name : testSetWantDateIllegal
+ * @tc.desc : testSetWantDate parameter illegal test
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantDateIllegal, Function | MediumTest | Level2)
{
@@ -194,47 +223,77 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantDateIllegal, Function | MediumTes
/**
* @tc.number : SUB_AAFWK_ABILITY_0008
- * @tc.name : testStartAbility parameter illegal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.name : testStartAbilityIllegal
+ * @tc.desc : testStartAbility parameter illegal test
*/
-LITE_TEST_CASE(AbilityMgrTestSuite, testStartAbilityIllegal, Function | MediumTest | Level2)
+LITE_TEST_CASE(AbilityMgrTestSuite, testStartAbilityIllegal, Function | MediumTest | Level0)
{
printf("------start testStartAbilityIllegal------\n");
- int result = StartAbility(NULL);
- printf("ret is %d \n", result);
- int expect = 8;
- TEST_ASSERT_TRUE(result == expect);
+ int ret = StartAbility(NULL);
+ TEST_ASSERT_TRUE(ret == PARAM_CHECK_ERROR);
printf("------end testStartAbilityIllegal------\n");
}
/**
- * @tc.number : SUB_AAFWK_ABILITY_0008
- * @tc.name : testSetIntParam parameter illegal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.number : SUB_AAFWK_ABILITY_0010
+ * @tc.name : testSetIntParamIllegal
+ * @tc.desc : testSetIntParam parameter illegal test
*/
-LITE_TEST_CASE(AbilityMgrTestSuite, testSetIntParamIllegal, Function | MediumTest | Level2)
+LITE_TEST_CASE(AbilityMgrTestSuite, testSetIntParamIllegal, Function | MediumTest | Level0)
{
printf("------start testSetIntParamIllegal------\n");
- int result = SetIntParam(NULL, NULL, 0, 0);
- printf("ret is %d \n", result);
- int expect = 0;
- TEST_ASSERT_TRUE(result == expect);
+ bool ret = SetIntParam(NULL, NULL, 0, 0);
+ TEST_ASSERT_FALSE(ret);
printf("------end testSetIntParamIllegal------\n");
}
/**
- * @tc.number : SUB_AAFWK_ABILITY_0009
- * @tc.name : testSetStrParam parameter illegal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.number : SUB_AAFWK_ABILITY_0011
+ * @tc.name : testSetIntParamLegal
+ * @tc.desc : testSetIntParam parameter legal test
+ */
+LITE_TEST_CASE(AbilityMgrTestSuite, testSetIntParamLegal, Function | MediumTest | Level0)
+{
+ printf("------start testSetIntParamLegal------\n");
+ Want want = { 0 };
+ int32_t value = 1;
+ char *key = "key";
+ bool ret = SetIntParam(&want, key, strlen(key), value);
+ TEST_ASSERT_TRUE(ret);
+ TEST_ASSERT_TRUE(want.dataLength == (strlen(key) + sizeof(int) + DATA_EXTERN));
+ TEST_ASSERT_TRUE(want.data != NULL);
+ printf("------end testSetIntParamLegal------\n");
+}
+
+/**
+ * @tc.number : SUB_AAFWK_ABILITY_0012
+ * @tc.name : testSetStrParamIllegal
+ * @tc.desc : testSetStrParam parameter illegal test
*/
-LITE_TEST_CASE(AbilityMgrTestSuite, testSetStrParamIllegal, Function | MediumTest | Level2)
+LITE_TEST_CASE(AbilityMgrTestSuite, testSetStrParamIllegal, Function | MediumTest | Level0)
{
printf("------start testSetStrParamIllegal------\n");
- int result = SetStrParam(NULL, NULL, 0, NULL, 0);
- printf("ret is %d \n", result);
- int expect = 0;
- TEST_ASSERT_TRUE(result == expect);
+ bool ret = SetStrParam(NULL, NULL, 0, NULL, 0);
+ TEST_ASSERT_FALSE(ret);
printf("------end testSetStrParamIllegal------\n");
}
-RUN_TEST_SUITE(AbilityMgrTestSuite);
+/**
+ * @tc.number : SUB_AAFWK_ABILITY_0013
+ * @tc.name : testSetStrParamLegal
+ * @tc.desc : testSetStrParam parameter legal test
+ */
+LITE_TEST_CASE(AbilityMgrTestSuite, testSetStrParamLegal, Function | MediumTest | Level2)
+{
+ printf("------start testSetStrParamLegal------\n");
+ Want want = { 0 };
+ char *key = "key";
+ char *value = "value";
+ bool ret = SetStrParam(&want, key, strlen(key), value, strlen(value));
+ TEST_ASSERT_TRUE(ret);
+ TEST_ASSERT_TRUE(want.dataLength == (strlen(value) + strlen(key) + DATA_EXTERN));
+ TEST_ASSERT_TRUE(want.data != NULL);
+ printf("------end testSetStrParamLegal------\n");
+}
+
+RUN_TEST_SUITE(AbilityMgrTestSuite);
\ No newline at end of file
diff --git a/appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c b/appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
index b31b90dcd08ee3817de78b1714ed6fb270494c5d..928d0d8b92b5e0373b9474a7e8b889589fdad84d 100755
--- a/appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
+++ b/appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
@@ -44,8 +44,25 @@ static BOOL BundleMgrTestSuiteTearDown(void)
/**
* @tc.number : SUB_APPEXECFWK_0001
- * @tc.name : testClearAbilityInfo parameter illegal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.name : testClearAbilityInfoLegal
+ * @tc.desc : testClearAbilityInfo parameter legal test with bundle name
+ */
+LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoLegal, Function | MediumTest | Level2)
+{
+ printf("------start testClearAbilityInfo------\n");
+ AbilityInfo abilityInfo;
+ memset_s(&abilityInfo, sizeof(abilityInfo), 0, sizeof(abilityInfo));
+ abilityInfo.bundleName = "com.openharmony.testjsdemo";
+ TEST_ASSERT_EQUAL_STRING(abilityInfo.bundleName, "com.openharmony.testjsdemo");
+ ClearAbilityInfo(&abilityInfo);
+ TEST_ASSERT_EQUAL_STRING(abilityInfo.bundleName, NULL);
+ printf("------end testClearAbilityInfo------\n");
+}
+
+/**
+ * @tc.number : SUB_APPEXECFWK_0002
+ * @tc.name : testClearAbilityInfoIllegal
+ * @tc.desc : testClearAbilityInfo parameter illegal test
*/
LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoIllegal, Function | MediumTest | Level2)
{
@@ -59,14 +76,31 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoIllegal, Function | Mediu
}
/**
- * @tc.number : SUB_APPEXECFWK_0002
- * @tc.name : testClearBundleInfo parameter legal test with bundle name
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.number : SUB_APPEXECFWK_0003
+ * @tc.name : testClearBundleInfoLegal
+ * @tc.desc : testClearBundleInfo parameter legal test with bundle name
+ */
+LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoLegal, Function | MediumTest | Level2)
+{
+ printf("------start testClearBundleInfo------\n");
+ BundleInfo bundleInfo = { 0 };
+ memset_s(&bundleInfo, sizeof(bundleInfo), 0, sizeof(bundleInfo));
+ bundleInfo.bundleName = "com.openharmony.testjsdemo";
+ TEST_ASSERT_EQUAL_STRING(bundleInfo.bundleName, "com.openharmony.testjsdemo");
+ ClearBundleInfo(&bundleInfo);
+ TEST_ASSERT_EQUAL_STRING(bundleInfo.bundleName, NULL);
+ printf("------end testClearBundleInfo------\n");
+}
+
+/**
+ * @tc.number : SUB_APPEXECFWK_0004
+ * @tc.name : testClearBundleInfoIllegal
+ * @tc.desc : testClearBundleInfo parameter illegal test
*/
LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoIllegal, Function | MediumTest | Level2)
{
printf("------start testClearBundleInfoIllegal------\n");
- BundleInfo bundleInfo = { 0 };
+ BundleInfo bundleInfo;
memset_s(&bundleInfo, sizeof(bundleInfo), 0, sizeof(bundleInfo));
bundleInfo.bundleName = "com.openharmony.testjsdemo";
ClearBundleInfo(NULL);
@@ -75,11 +109,44 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoIllegal, Function | Medium
}
/**
- * @tc.number : SUB_APPEXECFWK_0003
- * @tc.name : testSetElementAbilityName parameter legal test
- * @tc.desc : [C- SOFTWARE -0100]
+ * @tc.number : SUB_APPEXECFWK_0005
+ * @tc.name : testClearModuleInfoLegal
+ * @tc.desc : ClearAbilityInfo parameter legal test with module info
*/
-LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityName, Function | MediumTest | Level0)
+LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoLegal, Function | MediumTest | Level1)
+{
+ printf("------start testClearModuleInfo------\n");
+ ModuleInfo moduleInfo = { 0 };
+ memset_s(&moduleInfo, sizeof(moduleInfo), 0, sizeof(moduleInfo));
+ moduleInfo.moduleName = "test";
+ TEST_ASSERT_EQUAL_STRING(moduleInfo.moduleName, "test");
+ ClearModuleInfo(&moduleInfo);
+ TEST_ASSERT_EQUAL_STRING(moduleInfo.moduleName, NULL);
+ printf("------end testClearModuleInfo------\n");
+}
+
+/**
+ * @tc.number : SUB_APPEXECFWK_0006
+ * @tc.name : testClearModuleInfoIllegal
+ * @tc.desc : ClearAbilityInfo parameter illegal test
+ */
+LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoIllegal, Function | MediumTest | Level1)
+{
+ printf("------start testClearModuleInfoIllegal------\n");
+ ModuleInfo moduleInfo = { 0 };
+ memset_s(&moduleInfo, sizeof(moduleInfo), 0, sizeof(moduleInfo));
+ moduleInfo.moduleName = "test";
+ ClearModuleInfo(NULL);
+ TEST_ASSERT_EQUAL_STRING(moduleInfo.moduleName, "test");
+ printf("------end testClearModuleInfoIllegal------\n");
+}
+
+/**
+ * @tc.number : SUB_APPEXECFWK_0007
+ * @tc.name : testSetElementAbilityNameLegal
+ * @tc.desc : testSetElementAbilityName parameter legal test
+ */
+LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityNameLegal, Function | MediumTest | Level0)
{
printf("------start testSetElementAbilityName------\n");
Want want = { 0 };
@@ -94,9 +161,9 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityName, Function | MediumT
}
/**
- * @tc.number : SUB_APPEXECFWK_0004
- * @tc.name : testSetElementAbilityName parameter illegal test
- * @tc.desc : [C- SOFTWARE -0100]
+ * @tc.number : SUB_APPEXECFWK_0008
+ * @tc.name : testSetElementAbilityNameIllegal
+ * @tc.desc : testSetElementAbilityName parameter illegal test
*/
LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityNameIllegal, Function | MediumTest | Level2)
{
@@ -110,17 +177,19 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityNameIllegal, Function |
SetElementAbilityName(&element, NULL);
SetWantElement(&want, element);
TEST_ASSERT_EQUAL_STRING(want.element->abilityName, NULL);
+ int ret = SetElementAbilityName(NULL, aName);
+ TEST_ASSERT_FALSE(ret);
ClearElement(&element);
ClearWant(&want);
printf("------end testSetElementAbilityNameIllegal------\n");
}
/**
- * @tc.number : SUB_APPEXECFWK_0005
- * @tc.name : testSetElementBundleName parameter legal test
- * @tc.desc : [C- SOFTWARE -0100]
+ * @tc.number : SUB_APPEXECFWK_0009
+ * @tc.name : testSetElementBundleNameLegal
+ * @tc.desc : testSetElementBundleName parameter legal test
*/
-LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleName, Function | MediumTest | Level0)
+LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleNameLegal, Function | MediumTest | Level0)
{
printf("------start testSetElementBundleName------\n");
Want want = { 0 };
@@ -135,9 +204,9 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleName, Function | MediumTe
}
/**
- * @tc.number : SUB_APPEXECFWK_0006
- * @tc.name : testSetElementBundleName parameter illegal test
- * @tc.desc : [C- SOFTWARE -0100]
+ * @tc.number : SUB_APPEXECFWK_0010
+ * @tc.name : testSetElementBundleNameIllegal
+ * @tc.desc : testSetElementBundleName parameter illegal test
*/
LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleNameIllegal, Function | MediumTest | Level2)
{
@@ -151,16 +220,18 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleNameIllegal, Function | M
SetElementBundleName(&element, NULL);
SetWantElement(&want, element);
TEST_ASSERT_EQUAL_STRING(want.element->bundleName, NULL);
+ bool ret = SetElementBundleName(NULL, bName);
+ TEST_ASSERT_FALSE(ret);
ClearElement(&element);
ClearWant(&want);
printf("------end testSetElementBundleNameIllegal------\n");
}
/**
- * @tc.number : SUB_APPEXECFWK_0007
- * @tc.name : testSetElementDeviceID parameter legal test
- * @tc.desc : [C- SOFTWARE -0100]
+ * @tc.number : SUB_APPEXECFWK_0011
+ * @tc.name : testSetElementDeviceIDLegal
+ * @tc.desc : testSetElementDeviceID parameter legal test
*/
-LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceID, Function | MediumTest | Level0)
+LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceIDLegal, Function | MediumTest | Level0)
{
printf("------start testSetElementDeviceID------\n");
Want want = { 0 };
@@ -175,9 +246,9 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceID, Function | MediumTest
}
/**
- * @tc.number : SUB_APPEXECFWK_0008
- * @tc.name : testSetElementDeviceID parameter illegal test
- * @tc.desc : [C- SOFTWARE -0100]
+ * @tc.number : SUB_APPEXECFWK_0012
+ * @tc.name : testSetElementDeviceIDIllegal
+ * @tc.desc : testSetElementDeviceID parameter illegal test
*/
LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceIDIllegal, Function | MediumTest | Level2)
{
@@ -191,60 +262,17 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceIDIllegal, Function | Med
SetElementDeviceID(&element, NULL);
SetWantElement(&want, element);
TEST_ASSERT_EQUAL_STRING(want.element->deviceId, NULL);
+ int ret = SetElementDeviceID(NULL, "0001000");
+ TEST_ASSERT_FALSE(ret);
ClearElement(&element);
ClearWant(&want);
printf("------end testSetElementDeviceIDIllegal------\n");
}
/**
- * @tc.number : SUB_APPEXECFWK_0009
- * @tc.name : ClearAbilityInfo parameter legal test with module info
- * @tc.desc : [C- SOFTWARE -0200]
- */
-LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoIllegal, Function | MediumTest | Level1)
-{
- printf("------start testClearModuleInfoIllegal------\n");
- ModuleInfo moduleInfo = { 0 };
- memset_s(&moduleInfo, sizeof(moduleInfo), 0, sizeof(moduleInfo));
- moduleInfo.moduleName = "test";
- ClearModuleInfo(NULL);
- TEST_ASSERT_EQUAL_STRING(moduleInfo.moduleName, "test");
- printf("------end testClearModuleInfoIllegal------\n");
-}
-
-/**
- * @tc.number : SUB_APPEXECFWK_0010
- * @tc.name : GetBundleInfo parameter legal test.
- * @tc.desc : [C- SOFTWARE -0200]
- */
-LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfoRight, Function | MediumTest | Level1)
-{
- printf("------start testGetBundleInfoRight------\n");
- BundleInfo bundleInfo;
- memset_s(&bundleInfo, sizeof(bundleInfo), 0, sizeof(bundleInfo));
- const char *bundleName = "com.openharmony.testjsdemo";
- int32_t flags = 0;
- printf("bundleName is %s \n", bundleName);
- sleep(2);
- uint8_t ret = GetBundleInfo(bundleName, flags, &bundleInfo);
- printf("getBundleInfo ret is %d \n", ret);
- TEST_ASSERT_EQUAL_STRING(bundleInfo.bundleName, NULL);
- TEST_ASSERT_TRUE(ret == 2);
- flags = 1;
- printf("bundleName is %s \n", bundleName);
- ret = GetBundleInfo(bundleName, flags, &bundleInfo);
- sleep(2);
- printf("getBundleInfo ret is %d \n", ret);
- TEST_ASSERT_TRUE(ret == 2);
- TEST_ASSERT_EQUAL_STRING(bundleInfo.bundleName, NULL);
- ClearBundleInfo(&bundleInfo);
- printf("------end testGetBundleInfoRight------\n");
-}
-
-/**
- * @tc.number : SUB_APPEXECFWK_0011
- * @tc.name : GetBundleInfo parameter illegal test.
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.number : SUB_APPEXECFWK_0013
+ * @tc.name : testGetBundleInfoIllegal
+ * @tc.desc : GetBundleInfo parameter illegal test
*/
LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfoIllegal, Function | MediumTest | Level2)
{
@@ -262,38 +290,14 @@ LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfoIllegal, Function | MediumTe
TEST_ASSERT_TRUE(ret == 2);
ret = GetBundleInfo("com.openharmony.testjsdemo", 2, &bundleInfo);
sleep(2);
- TEST_ASSERT_TRUE(ret != 1);
- printf("------end testGetBundleInfoIllegal------\n");
-}
-
-/**
- * @tc.number : SUB_APPEXECFWK_0012
- * @tc.name : GetBundleInfos parameter legal test
- * @tc.desc : [C- SOFTWARE -0200]
- */
-LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfosRight, Function | MediumTest | Level1)
-{
- printf("------start testGetBundleInfosRight------\n");
- BundleInfo *bundleInfos = NULL;
- int32_t flags = 0;
- int32_t length = 0;
- uint8_t ret = GetBundleInfos(flags, &bundleInfos, &length);
- sleep(2);
- printf("getBundleInfo ret is %d \n", ret);
- TEST_ASSERT_TRUE(ret == 2);
- flags = 1;
- ret = GetBundleInfos(flags, &bundleInfos, &length);
- printf("getBundleInfo ret is %d \n", ret);
- sleep(2);
TEST_ASSERT_TRUE(ret == 2);
- free(bundleInfos);
- printf("------end testGetBundleInfosRight------\n");
+ printf("------end testGetBundleInfoIllegal------\n");
}
/**
- * @tc.number : SUB_APPEXECFWK_0013
- * @tc.name : GetBundleInfos parameter illegal test
- * @tc.desc : [C- SOFTWARE -0200]
+ * @tc.number : SUB_APPEXECFWK_0014
+ * @tc.name : testGetBundleInfosIllegal
+ * @tc.desc : GetBundleInfos parameter illegal test
*/
LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfosIllegal, Function | MediumTest | Level2)
{
@@ -302,7 +306,7 @@ LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfosIllegal, Function | MediumT
int32_t *length = NULL;
int32_t flags = 0;
uint8_t ret = GetBundleInfos(flags, NULL, length);
- TEST_ASSERT_TRUE(ret != 2);
+ TEST_ASSERT_TRUE(ret == 1);
ret = GetBundleInfos(flags, &bundleInfos, NULL);
printf("ret is %d \n", ret);
TEST_ASSERT_TRUE(ret == 2);