1 /*
2 * Copyright (c) 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 "include/task_executor_mock.h"
17
18 namespace OHOS {
GetInstance()19 TaskExecutor &TaskExecutor::GetInstance()
20 {
21 static TaskExecutor instance;
22 return instance;
23 }
24
~TaskExecutor()25 TaskExecutor::~TaskExecutor()
26 {
27 pool_ = nullptr;
28 }
29
Schedule(Duration delay,const Task & task,Duration interval,uint64_t times)30 TaskExecutor::TaskId TaskExecutor::Schedule(Duration delay, const Task &task, Duration interval, uint64_t times)
31 {
32 if (BTaskExecutor::taskExecutor == nullptr) {
33 return INVALID_TASK_ID;
34 }
35 return BTaskExecutor::taskExecutor->Schedule(delay, task, interval, times);
36 }
37
Execute(const Task & task)38 TaskExecutor::TaskId TaskExecutor::Execute(const Task &task)
39 {
40 return INVALID_TASK_ID;
41 }
42
Remove(TaskExecutor::TaskId taskId,bool wait)43 bool TaskExecutor::Remove(TaskExecutor::TaskId taskId, bool wait)
44 {
45 return true;
46 }
47
Reset(TaskExecutor::TaskId taskId,Duration interval)48 TaskExecutor::TaskId TaskExecutor::Reset(TaskExecutor::TaskId taskId, Duration interval)
49 {
50 return INVALID_TASK_ID;
51 }
52
SetExecutors(std::shared_ptr<ExecutorPool> executors)53 void TaskExecutor::SetExecutors(std::shared_ptr<ExecutorPool> executors) { }
54
GenerateExecutors()55 void TaskExecutor::GenerateExecutors() { }
56 } // namespace OHOS