1 /*
2 * Copyright (c) 2021-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 "base/network/download_manager.h"
17
18 namespace OHOS::Ace {
19 class MockDownloadManager final : public DownloadManager {
20 public:
21 MockDownloadManager() = default;
22 ~MockDownloadManager() = default;
23
Download(const std::string &,std::vector<uint8_t> &)24 bool Download(const std::string& /* url */, std::vector<uint8_t>& /* dataOut */) override
25 {
26 return false;
27 }
28
Download(const std::string &,const std::shared_ptr<DownloadResult> &)29 bool Download(const std::string& /* url */, const std::shared_ptr<DownloadResult>& /* result */) override
30 {
31 return false;
32 }
33
DownloadAsync(DownloadCallback &&,const std::string &,int32_t,int32_t)34 bool DownloadAsync(DownloadCallback&& /* downloadCallback */, const std::string& /* url */,
35 int32_t /* instanceId */, int32_t /* nodeId */) override
36 {
37 return false;
38 }
DownloadSync(DownloadCallback &&,const std::string &,int32_t,int32_t)39 bool DownloadSync(DownloadCallback&& /* downloadCallback */, const std::string& /* url */, int32_t /* instanceId */,
40 int32_t /* nodeId */) override
41 {
42 return false;
43 }
RemoveDownloadTask(const std::string &,int32_t,bool)44 bool RemoveDownloadTask(const std::string& /* url */, int32_t /*nodeId*/, bool /*isCancel = true*/) override
45 {
46 return false;
47 }
48 };
49
GetInstance()50 DownloadManager* DownloadManager::GetInstance()
51 {
52 static MockDownloadManager manager;
53 return &manager;
54 }
55 } // namespace OHOS::Ace
56