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 "uninstall_plugin_test.h"
17 #include "utils.h"
18
19 using namespace testing::ext;
20
21 namespace OHOS {
22 namespace EDM {
23 namespace TEST {
SetUpTestSuite(void)24 void UninstallPluginTest::SetUpTestSuite(void)
25 {
26 Utils::SetEdmInitialEnv();
27 }
28
TearDownTestSuite(void)29 void UninstallPluginTest::TearDownTestSuite(void)
30 {
31 Utils::ResetTokenTypeAndUid();
32 ASSERT_TRUE(Utils::IsOriginalUTEnv());
33 std::cout << "now ut process is orignal ut env : " << Utils::IsOriginalUTEnv() << std::endl;
34 }
35
36 /**
37 * @tc.name: TestOnSetPolicySuc
38 * @tc.desc: Test UninstallPlugin::OnSetPolicy when data is empty.
39 * @tc.type: FUNC
40 */
41 HWTEST_F(UninstallPluginTest, TestOnSetPolicySuc, TestSize.Level1)
42 {
43 UninstallPlugin plugin;
44 UninstallParam param = { "testBundle", DEFAULT_USER_ID, false};
45 MessageParcel reply;
46 ErrCode ret = plugin.OnSetPolicy(param, reply);
47 ASSERT_TRUE(ret == ERR_OK);
48 ASSERT_TRUE(reply.ReadInt32() == EdmReturnErrCode::PARAM_ERROR);
49 }
50 } // namespace TEST
51 } // namespace EDM
52 } // namespace OHOS