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