1 /* 2 * Copyright (c) 2022 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 #include <vector> 19 #include "cmd_utils.h" 20 #include "func_code.h" 21 #include "iplugin_mock.h" 22 #include "policy_info.h" 23 24 using namespace testing::ext; 25 using namespace testing; 26 27 namespace OHOS { 28 namespace EDM { 29 namespace TEST { 30 class IPluginTest : public testing::Test { 31 protected: SetUp()32 void SetUp() override {} 33 TearDown()34 void TearDown() override {} 35 }; 36 37 /** 38 * @tc.name: TestIsGlobalPolicy 39 * @tc.desc: Test IsGlobalPolicy func. 40 * @tc.type: FUNC 41 */ 42 HWTEST_F(IPluginTest, TestIsGlobalPolicy, TestSize.Level1) 43 { 44 IPluginMock iplugin1; 45 EXPECT_TRUE(iplugin1.IsGlobalPolicy()); 46 iplugin1.MockSetPolicyName("test"); 47 std::string mergeJsonData; 48 ErrCode err = iplugin1.MergePolicyData("com.edm.test.demo", mergeJsonData); 49 EXPECT_TRUE(err == ERR_OK); 50 MessageParcel reply; 51 err = iplugin1.WritePolicyToParcel("name:test", reply); 52 EXPECT_TRUE(err == ERR_OK); 53 } 54 } // namespace TEST 55 } // namespace EDM 56 } // namespace OHOS