1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "dlp_bundle_adapter_test.h"
17
18 #include "bundle_manager_adapter.h"
19 #include "dlp_permission.h"
20 #include "dlp_permission_log.h"
21
22 namespace OHOS {
23 namespace Security {
24 namespace DlpPermission {
25 using namespace testing::ext;
26 using namespace OHOS;
27 using namespace OHOS::Security::DlpPermission;
28 using namespace OHOS::AppExecFwk;
29 namespace {
30 const std::string BUNDLE_NAME = "com.ohos.launcher";
31 const int32_t USER_ID = 1;
32 } // namespace
33
SetUpTestCase()34 void DlpBundleAdapterTest::SetUpTestCase() {}
35
TearDownTestCase()36 void DlpBundleAdapterTest::TearDownTestCase() {}
37
SetUp()38 void DlpBundleAdapterTest::SetUp() {}
39
TearDown()40 void DlpBundleAdapterTest::TearDown() {}
41
42 /**
43 * @tc.name: DlpBundleAdapterTest001
44 * @tc.desc: test GetBundleInfo failed with param is invalid
45 * @tc.type: FUNC
46 * @tc.require:
47 */
48 HWTEST_F(DlpBundleAdapterTest, DlpBundleAdapterTest001, TestSize.Level1)
49 {
50 BundleInfo bundleInfo;
51 bool result = BundleManagerAdapter::GetInstance().GetBundleInfo(
52 BUNDLE_NAME, BundleFlag::GET_BUNDLE_WITH_ABILITIES, bundleInfo, USER_ID);
53 ASSERT_EQ(result, false);
54 }
55
56 /**
57 * @tc.name: DlpBundleAdapterTest002
58 * @tc.desc: test GetBundleInfoV9 failed with param is invalid
59 * @tc.type: FUNC
60 * @tc.require:
61 */
62 HWTEST_F(DlpBundleAdapterTest, DlpBundleAdapterTest002, TestSize.Level1)
63 {
64 BundleInfo bundleInfo;
65 int32_t result = BundleManagerAdapter::GetInstance().GetBundleInfoV9(
66 BUNDLE_NAME, BundleFlag::GET_BUNDLE_WITH_ABILITIES, bundleInfo, USER_ID);
67 ASSERT_NE(result, DLP_OK);
68 }
69 } // namespace DlpPermission
70 } // namespace Security
71 } // namespace OHOS
72