1 /* 2 * Copyright (c) 2021 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_BASE_TEST_MOCK_MOCK_ASSET_MANAGER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_BASE_TEST_MOCK_MOCK_ASSET_MANAGER_H 18 19 #include "base/resource/asset_manager.h" 20 21 namespace OHOS::Ace { 22 class MockAsset final : public Asset { 23 public: 24 ~MockAsset() override = default; 25 GetSize()26 size_t GetSize() const override 27 { 28 return 0; 29 } 30 GetData()31 const uint8_t* GetData() const override 32 { 33 return nullptr; 34 } 35 }; 36 37 class MockAssetManager final : public AssetManager { 38 public: 39 ~MockAssetManager() override = default; 40 PushFront(RefPtr<AssetProvider> provider)41 void PushFront(RefPtr<AssetProvider> provider) override {} 42 PushBack(RefPtr<AssetProvider> provider)43 void PushBack(RefPtr<AssetProvider> provider) override {} 44 GetAsset(const std::string & assetName)45 RefPtr<Asset> GetAsset(const std::string& assetName) override 46 { 47 return nullptr; 48 } 49 GetAssetPath(const std::string & assetName)50 std::string GetAssetPath(const std::string& assetName) override 51 { 52 return ""; 53 } 54 SetLibPath(const std::string & appLibPathKey,const std::vector<std::string> & packagePath)55 void SetLibPath(const std::string& appLibPathKey, const std::vector<std::string>& packagePath) override {} 56 GetAppLibPathKey()57 std::string GetAppLibPathKey() const override 58 { 59 return ""; 60 } 61 GetLibPath()62 std::vector<std::string> GetLibPath() const override 63 { 64 return std::vector<std::string>(); 65 } 66 GetAssetList(const std::string & path,std::vector<std::string> & assetList)67 void GetAssetList(const std::string& path, std::vector<std::string>& assetList) const override {} 68 }; 69 } // namespace OHOS::Ace 70 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_TEST_MOCK_MOCK_ASSET_MANAGER_H 71