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 }
DownloadAsync(DownloadCallback &&,const std::string &,int32_t)28 bool DownloadAsync(
29 DownloadCallback&& /* downloadCallback */, const std::string& /* url */, int32_t /* instanceId */) override
30 {
31 return false;
32 }
DownloadSync(DownloadCallback &&,const std::string &,int32_t)33 bool DownloadSync(
34 DownloadCallback&& /* downloadCallback */, const std::string& /* url */, int32_t /* instanceId */) override
35 {
36 return false;
37 }
38 };
39
GetInstance()40 DownloadManager* DownloadManager::GetInstance()
41 {
42 static MockDownloadManager manager;
43 return &manager;
44 }
45 } // namespace OHOS::Ace
46