• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 <gtest/gtest.h>
17 #include <string>
18 
19 #include "appspawn_utils.h"
20 #include "dec_api.h"
21 
22 using namespace testing;
23 using namespace testing::ext;
24 
25 namespace OHOS {
26 class DecUtilTest : public testing::Test {
27 public:
SetUpTestCase()28     static void SetUpTestCase() {}
TearDownTestCase()29     static void TearDownTestCase() {}
SetUp()30     void SetUp()
31     {
32         const TestInfo *info = UnitTest::GetInstance()->current_test_info();
33         GTEST_LOG_(INFO) << info->test_suite_name() << "." << info->name() << " start";
34         APPSPAWN_LOGI("%{public}s.%{public}s start", info->test_suite_name(), info->name());
35     }
TearDown()36     void TearDown()
37     {
38         const TestInfo *info = UnitTest::GetInstance()->current_test_info();
39         GTEST_LOG_(INFO) << info->test_suite_name() << "." << info->name() << " end";
40         APPSPAWN_LOGI("%{public}s.%{public}s end", info->test_suite_name(), info->name());
41     }
42 };
43 
44 /**
45 * @tc.name: App_Spawn_DecUtil_GetDecPathMap_Success
46 * @tc.desc: Verify get decPaths map succeed
47 *
48 */
49 HWTEST_F(DecUtilTest, App_Spawn_DecUtil_GetDecPathMap_Success, TestSize.Level0)
50 {
51     std::map<std::string, std::vector<std::string>> decMap = GetDecPathMap();
52 
53     for (const auto& pair : decMap) {
54         const std::string& key = pair.first;
55         const std::vector<std::string>& values = pair.second;
56         APPSPAWN_LOGI("permission %{public}s", key.c_str());
57         for (const std::string& value : values) {
58             APPSPAWN_LOGI("decPath %{public}s", value.c_str());
59         }
60     }
61 
62     EXPECT_GT(decMap.size(), 0);
63 }
64 }
65