未验证 提交 64431646 编写于 作者: O openharmony_ci 提交者: Gitee

!2946 bms增加ndk接口测试用例

Merge pull request !2946 from wangtiantian/ndk
......@@ -27,6 +27,7 @@ group("bundlemanager") {
"actsbundlemanagertest:ActsBundleManagerTest",
"actsbundlemanageruninstall:ActsBundleManagerUninstallTest",
"actsbundlemgrmultipleinstalltest:ActsBundleMgrMultipleInstallTest",
"actsbundlenativetest:ActsBundleNativeTest",
"sceneProject/bmsaccesstokenone:bmsAccessTokenTest1",
"sceneProject/bmsaccesstokenthree:bmsAccessTokenTest3",
"sceneProject/bmsaccesstokentwo:bmsAccessTokenTest2",
......
/**
* Copyright (c) 2020-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.
*/
#include <chrono>
#include <fstream>
#include <gtest/gtest.h>
#include "native_interface_bundle.h"
using namespace testing::ext;
class ActsBundleNativeTest : public testing::Test {
protected:
ActsBundleNativeTest();
~ActsBundleNativeTest();
static void SetUpTestCase();
static void TearDownTestCase();
};
ActsBundleNativeTest::ActsBundleNativeTest()
{}
ActsBundleNativeTest::~ActsBundleNativeTest()
{}
void ActsBundleNativeTest::SetUpTestCase()
{}
void ActsBundleNativeTest::TearDownTestCase()
{}
/**
* @tc.number : ActsBundleNativeTest_0100
* @tc.name : Test GetAppIdByBundleName test, right bundleName
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(ActsBundleNativeTest, ActsBundleNativeTest_0100, Function | MediumTest | Level2)
{
char* appId = OH_NativeBundle_GetAppIdByBundleName("com.ohos.photos");
printf("AppID: %s\n", appId);
ASSERT_TRUE(appId != nullptr);
free(appId);
}
/**
* @tc.number : ActsBundleNativeTest_0200
* @tc.name : Test GetAppIdByBundleName test, wrong bundleName
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(ActsBundleNativeTest, ActsBundleNativeTest_0200, Function | MediumTest | Level2)
{
char* appId = OH_NativeBundle_GetAppIdByBundleName("wrong name");
ASSERT_TRUE(appId == nullptr);
}
/**
* @tc.number : ActsBundleNativeTest_0300
* @tc.name : Test GetAppIdByBundleName test, bundleName is empty
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(ActsBundleNativeTest, ActsBundleNativeTest_0300, Function | MediumTest | Level2)
{
char* appId = OH_NativeBundle_GetAppIdByBundleName("");
ASSERT_TRUE(appId == nullptr);
}
/**
* @tc.number : ActsBundleNativeTest_0400
* @tc.name : Test GetAppIdByBundleName test, bundleName is nullptr
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(ActsBundleNativeTest, ActsBundleNativeTest_0400, Function | MediumTest | Level2)
{
char* appId = OH_NativeBundle_GetAppIdByBundleName(nullptr);
ASSERT_TRUE(appId == nullptr);
}
# Copyright (c) 2020-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("//test/xts/tools/build/suite.gni")
module_output_path = "hits/ActsBundleNativeTest"
ohos_moduletest_suite("ActsBundleNativeTest") {
module_out_path = module_output_path
include_dirs =
[ "//foundation/appexecfwk/standard/kits/appkit/native/bundle/include" ]
sources = [ "ActsBundleNativeTest.cpp" ]
deps = [
"//foundation/appexecfwk/standard/kits/appkit/native/bundle:bundle_ndk",
]
}
{
"description": "Config for bundlenative test cases",
"driver": {
"module-name": "ActsBundleNativeTest",
"native-test-timeout": "120000",
"native-test-device-path": "/data/local/tmp",
"runtime-hint": "1s",
"type": "CppTest"
},
"kits": [
{
"post-push" : [
"chmod -R 777 /data/local/tmp/*"
],
"push": [
"ActsBundleNativeTest->/data/local/tmp/ActsBundleNativeTest"
],
"type": "PushKit"
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /data/test"
]
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册