• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef EDM_UNIT_TEST_PLUGIN_MANAGER_TEST_H
17 #define EDM_UNIT_TEST_PLUGIN_MANAGER_TEST_H
18 
19 #include <gtest/gtest.h>
20 #include <iremote_object.h>
21 #include "edm_log.h"
22 #include "iplugin.h"
23 
24 namespace OHOS {
25 namespace EDM {
26 namespace TEST {
27 class TestPlugin : public IPlugin {
28 public:
TestPlugin()29     TestPlugin()
30     {
31         policyCode_ = 0;
32         policyName_ = "TestPlugin";
33         permission_ = "ohos.permission.EDM_TEST_PERMISSION";
34         EDMLOGD("TestPlugin constructor");
35     }
36 
OnHandlePolicy(std::uint32_t funcCode,MessageParcel & data,std::string & policyData,bool & isChanged)37     ErrCode OnHandlePolicy(std::uint32_t funcCode, MessageParcel &data, std::string &policyData,
38         bool &isChanged) override
39     {
40         return ERR_OK;
41     }
42 
MergePolicyData(const std::string & adminName,std::string & policyData)43     ErrCode MergePolicyData(const std::string &adminName, std::string &policyData) override
44     {
45         return IPlugin::MergePolicyData(adminName, policyData);
46     }
47 
OnHandlePolicyDone(std::uint32_t funcCode,const std::string & adminName,bool isGlobalChanged)48     void OnHandlePolicyDone(std::uint32_t funcCode, const std::string &adminName, bool isGlobalChanged) override {}
49 
OnAdminRemove(const std::string & adminName,const std::string & policyData)50     ErrCode OnAdminRemove(const std::string &adminName, const std::string &policyData) override
51     {
52         return ERR_OK;
53     }
54 
OnAdminRemoveDone(const std::string & adminName,const std::string & policyData)55     void OnAdminRemoveDone(const std::string &adminName, const std::string &policyData) override {}
56 
WritePolicyToParcel(const std::string & policyData,MessageParcel & reply)57     ErrCode WritePolicyToParcel(const std::string &policyData, MessageParcel &reply) override
58     {
59         return IPlugin::WritePolicyToParcel(policyData, reply);
60     }
61 
62     ~TestPlugin() override = default;
63 };
64 
65 class PluginManagerTest : public testing::Test {
66 protected:
67     virtual void SetUp() override;
68 
69     virtual void TearDown() override;
70 };
71 } // namespace TEST
72 } // namespace EDM
73 } // namespace OHOS
74 #endif // EDM_UNIT_TEST_PLUGIN_MANAGER_TEST_H
75