1 /*
2  * Copyright (c) 2022-2024 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 "gtest/hwext/gtest-multithread.h"
18 #include <thread>
19 
20 #include <vector>
21 #include "accesstoken_kit.h"
22 #include "ipc_skeleton.h"
23 #include "nativetoken_kit.h"
24 #include "notifier_mgr.h"
25 #include "plugin_mgr.h"
26 #include "res_sched_ipc_interface_code.h"
27 #include "res_sched_common_death_recipient.h"
28 #include "res_sched_service.h"
29 #include "res_sched_service_ability.h"
30 #include "res_sched_systemload_notifier_proxy.h"
31 #include "res_sched_systemload_notifier_stub.h"
32 #include "res_type.h"
33 #include "token_setproc.h"
34 #include "sched_controller.h"
35 #include "supervisor.h"
36 
37 namespace OHOS {
38 namespace system {
39 int32_t g_mockEngMode = 1;
40 template<typename T>
GetIntParameter(const std::string & key,T def)41 T GetIntParameter(const std::string& key, T def)
42 {
43     return g_mockEngMode;
44 }
45 }
46 namespace Security::AccessToken {
47 int32_t g_mockDumpTokenKit = 1;
48 int32_t g_mockReportTokenKit = 1;
VerifyAccessToken(AccessTokenID tokenId,const std::string & permissionName)49 int AccessTokenKit::VerifyAccessToken(AccessTokenID tokenId, const std::string& permissionName)
50 {
51     if (permissionName == "ohos.permission.DUMP") {
52         return g_mockDumpTokenKit;
53     }
54     if (permissionName == "ohos.permission.REPORT_RESOURCE_SCHEDULE_EVENT") {
55         return g_mockReportTokenKit;
56     }
57     return PermissionState::PERMISSION_GRANTED;
58 }
59 
60 ATokenTypeEnum g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_INVALID;
GetTokenTypeFlag(AccessTokenID tokenId)61 ATokenTypeEnum AccessTokenKit::GetTokenTypeFlag(AccessTokenID tokenId)
62 {
63     return g_mockTokenFlag;
64 }
65 
66 bool g_mockHapTokenInfo = false;
GetHapTokenInfo(AccessTokenID tokenId,HapTokenInfo & hapTokenInfoRes)67 int AccessTokenKit::GetHapTokenInfo(AccessTokenID tokenId, HapTokenInfo& hapTokenInfoRes)
68 {
69     if (g_mockHapTokenInfo) {
70         hapTokenInfoRes.bundleName = "com.ohos.sceneboard";
71     }
72     return 1;
73 }
74 }
75 bool g_mockAddAbilityListener = true;
AddSystemAbilityListener(int32_t systemAbilityId)76 bool SystemAbility::AddSystemAbilityListener(int32_t systemAbilityId)
77 {
78     return g_mockAddAbilityListener;
79 }
80 int g_mockUid = 0;
GetCallingUid()81 int IPCSkeleton::GetCallingUid()
82 {
83     return g_mockUid;
84 }
85 namespace ResourceSchedule {
86 using namespace std;
87 using namespace testing::ext;
88 using namespace testing::mt;
89 using namespace Security::AccessToken;
90 
91 class TestMockResSchedServiceStub : public ResSchedServiceStub {
92 public:
TestMockResSchedServiceStub()93     TestMockResSchedServiceStub() : ResSchedServiceStub() {}
94 
ReportData(uint32_t restype,int64_t value,const nlohmann::json & payload)95     void ReportData(uint32_t restype, int64_t value, const nlohmann::json& payload) override
96     {
97     }
98 
ReportSyncEvent(const uint32_t resType,const int64_t value,const nlohmann::json & payload,nlohmann::json & reply)99     int32_t ReportSyncEvent(const uint32_t resType, const int64_t value, const nlohmann::json& payload,
100         nlohmann::json& reply) override
101     {
102         return 0;
103     }
104 
KillProcess(const nlohmann::json & payload)105     int32_t KillProcess(const nlohmann::json& payload) override
106     {
107         return 0;
108     }
109 
RegisterSystemloadNotifier(const sptr<IRemoteObject> & notifier)110     void RegisterSystemloadNotifier(const sptr<IRemoteObject>& notifier) override
111     {
112     }
113 
UnRegisterSystemloadNotifier()114     void UnRegisterSystemloadNotifier() override
115     {
116     }
117 
RegisterEventListener(const sptr<IRemoteObject> & listener,uint32_t eventType,uint32_t listenerGroup=ResType::EventListenerGroup::LISTENER_GROUP_COMMON)118     void RegisterEventListener(const sptr<IRemoteObject>& listener, uint32_t eventType,
119         uint32_t listenerGroup = ResType::EventListenerGroup::LISTENER_GROUP_COMMON) override
120     {
121     }
122 
UnRegisterEventListener(uint32_t eventType,uint32_t listenerGroup=ResType::EventListenerGroup::LISTENER_GROUP_COMMON)123     void UnRegisterEventListener(uint32_t eventType,
124         uint32_t listenerGroup = ResType::EventListenerGroup::LISTENER_GROUP_COMMON) override
125     {
126     }
127 
GetSystemloadLevel()128     int32_t GetSystemloadLevel() override
129     {
130         return 0;
131     }
132 
IsAllowedAppPreload(const std::string & bundleName,int32_t preloadMode)133     bool IsAllowedAppPreload(const std::string& bundleName, int32_t preloadMode) override
134     {
135         return true;
136     }
137 };
138 
139 class ResSchedServiceMockTest : public testing::Test {
140 public:
141     static void SetUpTestCase(void);
142     static void TearDownTestCase(void);
143     void SetUp();
144     void TearDown();
145 protected:
146     std::shared_ptr<ResSchedService> resSchedService_ = nullptr;
147     std::shared_ptr<ResSchedServiceAbility> resSchedServiceAbility_ = nullptr;
148     std::shared_ptr<TestMockResSchedServiceStub> resSchedServiceStub_ = nullptr;
149 };
150 
151 class TestMockResSchedSystemloadListener : public ResSchedSystemloadNotifierStub {
152 public:
153     TestMockResSchedSystemloadListener() = default;
154 
OnSystemloadLevel(int32_t level)155     void OnSystemloadLevel(int32_t level)
156     {
157         testSystemloadLevel = level;
158     }
159 
160     static int32_t testSystemloadLevel;
161 };
162 
163 int32_t TestMockResSchedSystemloadListener::testSystemloadLevel = 0;
164 
SetUpTestCase(void)165 void ResSchedServiceMockTest::SetUpTestCase(void)
166 {
167     static const char *perms[] = {
168         "ohos.permission.REPORT_RESOURCE_SCHEDULE_EVENT",
169         "ohos.permission.DUMP",
170     };
171     uint64_t tokenId;
172     NativeTokenInfoParams infoInstance = {
173         .dcapsNum = 0,
174         .permsNum = 2,
175         .aclsNum = 0,
176         .dcaps = nullptr,
177         .perms = perms,
178         .acls = nullptr,
179         .processName = "ResSchedServiceMockTest",
180         .aplStr = "system_core",
181     };
182     tokenId = GetAccessTokenId(&infoInstance);
183     SetSelfTokenID(tokenId);
184     AccessTokenKit::ReloadNativeTokenInfo();
185 }
186 
TearDownTestCase()187 void ResSchedServiceMockTest::TearDownTestCase()
188 {
189     int64_t sleepTime = 10;
190     std::this_thread::sleep_for(std::chrono::seconds(sleepTime));
191 }
192 
SetUp()193 void ResSchedServiceMockTest::SetUp()
194 {
195     /**
196      * @tc.setup: initialize the member variable resSchedServiceAbility_
197      */
198     resSchedService_ = make_shared<ResSchedService>();
199     resSchedServiceAbility_ = make_shared<ResSchedServiceAbility>();
200     resSchedServiceStub_ = make_shared<TestMockResSchedServiceStub>();
201 }
202 
TearDown()203 void ResSchedServiceMockTest::TearDown()
204 {
205     /**
206      * @tc.teardown: clear resSchedServiceAbility_
207      */
208     resSchedService_ = nullptr;
209     resSchedServiceAbility_ = nullptr;
210     resSchedServiceStub_ = nullptr;
211 }
212 
213 /**
214  * @tc.name: ressched service dump 001
215  * @tc.desc: Verify if ressched service dump commonds is success.
216  * @tc.type: FUNC
217  * @tc.require: issuesIAGHOC
218  * @tc.author: fengyang
219  */
220 HWTEST_F(ResSchedServiceMockTest, ServiceDump001, Function | MediumTest | Level0)
221 {
222     Security::AccessToken::g_mockDumpTokenKit = 0;
223     PluginMgr::GetInstance().Init();
224     std::string result;
225     resSchedService_->DumpAllInfo(result);
226     EXPECT_TRUE(!result.empty());
227 
228     result = "";
229     resSchedService_->DumpUsage(result);
230     EXPECT_TRUE(!result.empty());
231 
232     int32_t wrongFd = -1;
233     std::vector<std::u16string> argsNull;
234     int res = resSchedService_->Dump(wrongFd, argsNull);
235     EXPECT_EQ(res, ERR_OK);
236     resSchedServiceAbility_->OnStart();
237     int32_t correctFd = -1;
238     res = resSchedService_->Dump(correctFd, argsNull);
239 
240     std::vector<std::u16string> argsHelp = {to_utf16("-h")};
241     res = resSchedService_->Dump(correctFd, argsHelp);
242 
243     std::vector<std::u16string> argsAll = {to_utf16("-a")};
244     res = resSchedService_->Dump(correctFd, argsAll);
245 
246     std::vector<std::u16string> argsError = {to_utf16("-e")};
247     res = resSchedService_->Dump(correctFd, argsError);
248 
249     std::vector<std::u16string> argsPlugin = {to_utf16("-p")};
250     res = resSchedService_->Dump(correctFd, argsPlugin);
251 
252     std::vector<std::u16string> argsOnePlugin = {to_utf16("-p"), to_utf16("1")};
253     res = resSchedService_->Dump(correctFd, argsOnePlugin);
254 
255     std::vector<std::u16string> argsOnePlugin1 = {to_utf16("getRunningLockInfo")};
256     res = resSchedService_->Dump(correctFd, argsOnePlugin1);
257 
258     std::vector<std::u16string> argsOnePlugin2 = {to_utf16("getProcessEventInfo")};
259     res = resSchedService_->Dump(correctFd, argsOnePlugin2);
260 
261     std::vector<std::u16string> argsOnePlugin3 = {to_utf16("getProcessWindowInfo")};
262     res = resSchedService_->Dump(correctFd, argsOnePlugin3);
263 
264     std::vector<std::u16string> argsOnePlugin4 = {to_utf16("getSystemloadInfo")};
265     res = resSchedService_->Dump(correctFd, argsOnePlugin4);
266 
267     std::vector<std::u16string> argsOnePlugin5 = {to_utf16("sendDebugToExecutor")};
268     res = resSchedService_->Dump(correctFd, argsOnePlugin5);
269 }
270 
271 /**
272  * @tc.name: ressched service dump 002
273  * @tc.desc: Verify if ressched service dump commonds is success.
274  * @tc.type: FUNC
275  * @tc.require: issuesIAGHOC
276  * @tc.author: fengyang
277  */
278 HWTEST_F(ResSchedServiceMockTest, ServiceDump002, Function | MediumTest | Level0)
279 {
280     Security::AccessToken::g_mockDumpTokenKit = 0;
281     resSchedServiceAbility_->OnStart();
282     std::shared_ptr<ResSchedService> resSchedService = make_shared<ResSchedService>();
283     int32_t uid = 100;
284     int32_t pid = 10000;
285     auto app = SchedController::GetInstance().GetSupervisor()->GetAppRecordNonNull(uid);
286     auto processRecord = app->GetProcessRecordNonNull(pid);
287     processRecord->GetAbilityInfoNonNull(1000);
288     processRecord->GetWindowInfoNonNull(1000);
289     processRecord->runningLockState_[1000] = false;
290     int32_t wrongFd = -1;
291     int32_t correctFd = -1;
292     std::vector<std::u16string> argsNull;
293     std::vector<std::u16string> argsOnePlugin1 = {to_utf16("getRunningLockInfo")};
294     int res = resSchedService->Dump(correctFd, argsOnePlugin1);
295     EXPECT_EQ(res, ERR_OK);
296     std::vector<std::u16string> argsOnePlugin2 = {to_utf16("getProcessEventInfo")};
297     res = resSchedService->Dump(correctFd, argsOnePlugin2);
298     EXPECT_EQ(res, ERR_OK);
299     std::vector<std::u16string> argsOnePlugin3 = {to_utf16("getProcessWindowInfo")};
300     res = resSchedService->Dump(correctFd, argsOnePlugin3);
301     EXPECT_EQ(res, ERR_OK);
302 }
303 
304 /**
305  * @tc.name: ressched service dump 003
306  * @tc.desc: Verify if ressched service dump commonds is success.
307  * @tc.type: FUNC
308  * @tc.require: issuesIAGHOC
309  * @tc.author: fengyang
310  */
311 HWTEST_F(ResSchedServiceMockTest, ServiceDump003, Function | MediumTest | Level0)
312 {
313     Security::AccessToken::g_mockDumpTokenKit = 0;
314     PluginMgr::GetInstance().Init();
315     auto notifier = new (std::nothrow) TestMockResSchedSystemloadListener();
316     EXPECT_TRUE(notifier != nullptr);
317     resSchedService_->RegisterSystemloadNotifier(notifier);
318     int32_t correctFd = -1;
319     std::vector<std::u16string> argsOnePlugin = {to_utf16("getSystemloadInfo")};
320     int res = resSchedService_->Dump(correctFd, argsOnePlugin);
321     EXPECT_EQ(res, ERR_OK);
322     std::vector<std::u16string> argsOnePlugin2 = {to_utf16("sendDebugToExecutor"), to_utf16("1")};
323     res = resSchedService_->Dump(correctFd, argsOnePlugin2);
324     resSchedService_->UnRegisterSystemloadNotifier();
325     EXPECT_EQ(res, ERR_OK);
326 }
327 
328 /**
329  * @tc.name: ressched service dump 004
330  * @tc.desc: Verify if ressched service dump commonds is success.
331  * @tc.type: FUNC
332  * @tc.require: issuesIAGHOC
333  * @tc.author: fengyang
334  */
335 HWTEST_F(ResSchedServiceMockTest, ServiceDump004, Function | MediumTest | Level0)
336 {
337     Security::AccessToken::g_mockDumpTokenKit = 1;
338     int32_t correctFd = -1;
339     std::vector<std::u16string> argsOnePlugin = {to_utf16("-h")};
340     int res = resSchedService_->Dump(correctFd, argsOnePlugin);
341     EXPECT_NE(res, ERR_OK);
342     system::g_mockEngMode = 0;
343     res = resSchedService_->Dump(correctFd, argsOnePlugin);
344     EXPECT_NE(res, ERR_OK);
345 }
346 
347 /**
348  * @tc.name: ressched service dump 005
349  * @tc.desc: Verify if ressched service dump commonds is success.
350  * @tc.type: FUNC
351  * @tc.require: issuesIAGHOC
352  * @tc.author: fengyang
353  */
354 HWTEST_F(ResSchedServiceMockTest, ServiceDump005, Function | MediumTest | Level0)
355 {
356     std::vector<std::string> args;
357     std::string result;
358     resSchedService_->DumpProcessRunningLock(result);
359     EXPECT_NE(result, "");
360     resSchedService_->DumpProcessWindowInfo(result);
361     EXPECT_NE(result, "");
362     resSchedService_->DumpProcessEventState(result);
363     EXPECT_NE(result, "");
364     resSchedService_->DumpSystemLoadInfo(result);
365     EXPECT_NE(result, "");
366     resSchedService_->DumpExecutorDebugCommand(args, result);
367     EXPECT_NE(result, "");
368     resSchedService_->DumpAllPluginConfig(result);
369     EXPECT_NE(result, "");
370 }
371 
372 /**
373  * @tc.name: Start ResSchedServiceAbility 001
374  * @tc.desc: Verify if ResSchedServiceAbility OnStart is success.
375  * @tc.type: FUNC
376  * @tc.require: issuesIAGHOC
377  * @tc.author: fengyang
378  */
379 HWTEST_F(ResSchedServiceMockTest, OnStart001, Function | MediumTest | Level0)
380 {
381     g_mockAddAbilityListener = false;
382     resSchedServiceAbility_->OnStart();
383     EXPECT_TRUE(resSchedServiceAbility_->service_ != nullptr);
384     std::string action = "test";
385     resSchedServiceAbility_->OnDeviceLevelChanged(0, 2, action);
386     g_mockAddAbilityListener = true;
387 }
388 
389 /**
390  * @tc.name: ResSchedServicesStub ReportDataInner 001
391  * @tc.desc: Verify if resschedstub reportdatainner is success.
392  * @tc.type: FUNC
393  * @tc.require: issuesIAGHOC
394  * @tc.author: fengyang
395  */
396 HWTEST_F(ResSchedServiceMockTest, ReportDataInner001, Function | MediumTest | Level0)
397 {
398     Security::AccessToken::g_mockReportTokenKit = 0;
399     Security::AccessToken::g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_NATIVE;
400     Security::AccessToken::g_mockHapTokenInfo = true;
401     resSchedServiceStub_->Init();
402     MessageParcel reply;
403     MessageParcel emptyData;
404     EXPECT_NE(resSchedServiceStub_->ReportDataInner(emptyData, reply), ERR_OK);
405     MessageParcel reportData;
406     reportData.WriteInterfaceToken(resSchedServiceStub_->GetDescriptor());
407     reportData.WriteUint32(1);
408     reportData.WriteInt64(1);
409     reportData.WriteString("{ { \" uid \" : \" 1 \" } }");
410     EXPECT_EQ(resSchedServiceStub_->ReportDataInner(reportData, reply), ERR_OK);
411     MessageParcel reportData2;
412     reportData2.WriteInterfaceToken(resSchedServiceStub_->GetDescriptor());
413     reportData2.WriteUint32(-1);
414     reportData2.WriteInt64(1);
415     reportData2.WriteString("{ { \" uid \" : \" 1 \" } }");
416     EXPECT_NE(resSchedServiceStub_->ReportDataInner(reportData2, reply), ERR_OK);
417 }
418 
419 /**
420  * @tc.name: ResSchedServicesStub ReportDataInner002
421  * @tc.desc: ReportDataInner002 IsSBDResType
422  * @tc.type: FUNC
423  * @tc.require: issuesIAGHOC
424  * @tc.author: fengyang
425  */
426 HWTEST_F(ResSchedServiceMockTest, ReportDataInner002, Function | MediumTest | Level0)
427 {
428     Security::AccessToken::g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_HAP;
429     Security::AccessToken::g_mockHapTokenInfo = true;
430     MessageParcel reportData;
431     MessageParcel reply;
432     reportData.WriteInterfaceToken(resSchedServiceStub_->GetDescriptor());
433     reportData.WriteUint32(38);
434     reportData.WriteInt64(1);
435     reportData.WriteString("{ { \" uid \" : \" 1 \" } }");
436     EXPECT_EQ(resSchedServiceStub_->ReportDataInner(reportData, reply), ERR_OK);
437     Security::AccessToken::g_mockHapTokenInfo = false;
438     EXPECT_NE(resSchedServiceStub_->ReportDataInner(reportData, reply), ERR_OK);
439     Security::AccessToken::g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_INVALID;
440     EXPECT_NE(resSchedServiceStub_->ReportDataInner(reportData, reply), ERR_OK);
441 }
442 
443 /**
444  * @tc.name: ResSchedServicesStub ReportDataInner 003
445  * @tc.desc: ReportDataInner003 IsThirdPartType
446  * @tc.type: FUNC
447  * @tc.require: issuesIAGHOC
448  * @tc.author: fengyang
449  */
450 HWTEST_F(ResSchedServiceMockTest, ReportDataInner003, Function | MediumTest | Level0)
451 {
452     Security::AccessToken::g_mockReportTokenKit = 0;
453     Security::AccessToken::g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_HAP;
454     MessageParcel reportData;
455     MessageParcel reply;
456     reportData.WriteInterfaceToken(resSchedServiceStub_->GetDescriptor());
457     reportData.WriteUint32(9);
458     reportData.WriteInt64(1);
459     reportData.WriteString("{ { \" uid \" : \" 1 \" } }");
460     EXPECT_EQ(resSchedServiceStub_->ReportDataInner(reportData, reply), ERR_OK);
461     Security::AccessToken::g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_INVALID;
462     EXPECT_NE(resSchedServiceStub_->ReportDataInner(reportData, reply), ERR_OK);
463 }
464 
465 /**
466  * @tc.name: ResSchedServicesStub ReportDataInner004
467  * @tc.desc: ReportDataInner IsHasPermission
468  * @tc.type: FUNC
469  * @tc.require: issuesIAGHOC
470  * @tc.author: fengyang
471  */
472 HWTEST_F(ResSchedServiceMockTest, ReportDataInner004, Function | MediumTest | Level0)
473 {
474     Security::AccessToken::g_mockReportTokenKit = 0;
475     Security::AccessToken::g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_NATIVE;
476     MessageParcel reportData;
477     MessageParcel reply;
478     reportData.WriteInterfaceToken(resSchedServiceStub_->GetDescriptor());
479     reportData.WriteUint32(0);
480     reportData.WriteInt64(1);
481     reportData.WriteString("{ { \" uid \" : \" 1 \" } }");
482     EXPECT_EQ(resSchedServiceStub_->ReportDataInner(reportData, reply), ERR_OK);
483     Security::AccessToken::g_mockDumpTokenKit = 1;
484     EXPECT_NE(resSchedServiceStub_->ReportDataInner(reportData, reply), ERR_OK);
485     Security::AccessToken::g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_INVALID;
486     EXPECT_NE(resSchedServiceStub_->ReportDataInner(reportData, reply), ERR_OK);
487 }
488 
489 /**
490  * @tc.name: ResSchedServicesStub ReportSyncEventInner001
491  * @tc.desc: ReportSyncEventInner
492  * @tc.type: FUNC
493  * @tc.require: issuesIAGHOC
494  * @tc.author: fengyang
495  */
496 HWTEST_F(ResSchedServiceMockTest, ReportSyncEventInner001, Function | MediumTest | Level0)
497 {
498     Security::AccessToken::g_mockReportTokenKit = 0;
499     Security::AccessToken::g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_NATIVE;
500     MessageParcel reportData;
501     MessageParcel reply;
502     reportData.WriteInterfaceToken(resSchedServiceStub_->GetDescriptor());
503     reportData.WriteUint32(0);
504     reportData.WriteInt64(1);
505     reportData.WriteString("{ { \" uid \" : \" 1 \" } }");
506     EXPECT_EQ(resSchedServiceStub_->ReportSyncEventInner(reportData, reply), ERR_OK);
507 }
508 
509 /**
510  * @tc.name: ResSchedServicesStub KillProcessInner001
511  * @tc.desc: KillProcessInner
512  * @tc.type: FUNC
513  * @tc.require: issuesIAGHOC
514  * @tc.author: fengyang
515  */
516 HWTEST_F(ResSchedServiceMockTest, KillProcessInner001, Function | MediumTest | Level0)
517 {
518     Security::AccessToken::g_mockReportTokenKit = 0;
519     Security::AccessToken::g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_NATIVE;
520     g_mockUid = 1111;
521     MessageParcel reportData;
522     MessageParcel reply;
523     reportData.WriteInterfaceToken(resSchedServiceStub_->GetDescriptor());
524     reportData.WriteString("{ { \" uid \" : \" 1 \" } }");
525     EXPECT_EQ(resSchedServiceStub_->KillProcessInner(reportData, reply), ERR_OK);
526     Security::AccessToken::g_mockTokenFlag = TypeATokenTypeEnum::TOKEN_INVALID;
527     EXPECT_NE(resSchedServiceStub_->KillProcessInner(reportData, reply), ERR_OK);
528     g_mockUid = 0;
529     EXPECT_NE(resSchedServiceStub_->KillProcessInner(reportData, reply), ERR_OK);
530 }
531 
532 } // namespace ResourceSchedule
533 } // namespace OHOS
534