1 /*
2 * Copyright (c) 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 "core/common/ace_application_info.h"
17
18 namespace OHOS::Ace {
19 class MockAceApplicationInfo : public AceApplicationInfo {
SetLocale(const std::string & language,const std::string & countryOrRegion,const std::string & script,const std::string & keywordsAndValues)20 void SetLocale(const std::string& language, const std::string& countryOrRegion, const std::string& script,
21 const std::string& keywordsAndValues) override
22 {}
ChangeLocale(const std::string & language,const std::string & countryOrRegion)23 void ChangeLocale(const std::string& language, const std::string& countryOrRegion) override {}
24
SetDebug(bool isDebugVersion,bool needDebugBreakpoint)25 void SetDebug(bool isDebugVersion, bool needDebugBreakpoint) override {}
26
GetBundleInfo(const std::string & packageName,AceBundleInfo & bundleInfo)27 bool GetBundleInfo(const std::string& packageName, AceBundleInfo& bundleInfo) override
28 {
29 return false;
30 }
31
GetLifeTime() const32 double GetLifeTime() const override
33 {
34 return 0;
35 }
36
GetJsEngineParam(const std::string & key) const37 std::string GetJsEngineParam(const std::string& key) const override
38 {
39 return "";
40 }
41
IsRightToLeft() const42 bool IsRightToLeft() const
43 {
44 return true;
45 }
46
47 public:
GetInstance()48 static MockAceApplicationInfo& GetInstance()
49 {
50 static MockAceApplicationInfo instance;
51 return instance;
52 }
53
54 private:
55 std::string packageName_;
56 };
57
GetInstance()58 AceApplicationInfo& AceApplicationInfo::GetInstance()
59 {
60 return MockAceApplicationInfo::GetInstance();
61 }
62 } // namespace OHOS::Ace
63