1 /* 2 * Copyright (c) 2022-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 "utils_mock_global_variable.h" 17 18 namespace OHOS::FileManagement::Backup { 19 namespace { 20 static bool g_bMockGetInstance = true; 21 static bool g_bMockInitBackupOrRestoreSession = true; 22 static bool g_bMockLoadSystemAbility = true; 23 } // namespace 24 SetMockGetInstance(bool state)25void SetMockGetInstance(bool state) 26 { 27 g_bMockGetInstance = state; 28 } 29 SetMockInitBackupOrRestoreSession(bool state)30void SetMockInitBackupOrRestoreSession(bool state) 31 { 32 g_bMockInitBackupOrRestoreSession = state; 33 } 34 GetMockGetInstance()35bool GetMockGetInstance() 36 { 37 return g_bMockGetInstance; 38 } 39 GetMockInitBackupOrRestoreSession()40bool GetMockInitBackupOrRestoreSession() 41 { 42 return g_bMockInitBackupOrRestoreSession; 43 } 44 SetMockLoadSystemAbility(bool state)45void SetMockLoadSystemAbility(bool state) 46 { 47 g_bMockLoadSystemAbility = state; 48 } 49 GetMockLoadSystemAbility()50bool GetMockLoadSystemAbility() 51 { 52 return g_bMockLoadSystemAbility; 53 } 54 } // namespace OHOS::FileManagement::Backup