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 "mock_inner_os_account_manager.h"
17 #include "account_log_wrapper.h"
18 
19 namespace OHOS {
20 namespace AccountSA {
21 const std::string TEST_DOMAIN_ACCOUNT_NAME = "test_domain_account_name";
22 const std::string TEST_DOMAIN = "test_domain";
23 const std::int32_t MAIN_ACCOUNT_ID = 100;
GetOsAccountLocalIdFromDomain(const DomainAccountInfo & domainInfo,int & id)24 ErrCode IInnerOsAccountManager::GetOsAccountLocalIdFromDomain(const DomainAccountInfo &domainInfo, int &id)
25 {
26     ACCOUNT_LOGI("mock IInnerOsAccountManager GetOsAccountLocalIdFromDomain enter");
27     if (domainInfo.accountName_ == TEST_DOMAIN_ACCOUNT_NAME) {
28         id = MAIN_ACCOUNT_ID;
29     }
30     return ERR_OK;
31 }
32 
QueryOsAccountById(const int id,OsAccountInfo & osAccountInfo)33 ErrCode IInnerOsAccountManager::QueryOsAccountById(const int id, OsAccountInfo &osAccountInfo)
34 {
35     ACCOUNT_LOGI("mock IInnerOsAccountManager QueryOsAccountById enter");
36     if (id == MAIN_ACCOUNT_ID) {
37         DomainAccountInfo domainInfo;
38         domainInfo.accountName_ = TEST_DOMAIN_ACCOUNT_NAME;
39         domainInfo.domain_ = TEST_DOMAIN;
40         osAccountInfo.SetDomainInfo(domainInfo);
41     }
42     return ERR_OK;
43 }
44 
QueryActiveOsAccountIds(std::vector<int32_t> & ids)45 ErrCode IInnerOsAccountManager::QueryActiveOsAccountIds(std::vector<int32_t>& ids)
46 {
47     ACCOUNT_LOGI("mock IInnerOsAccountManager QueryActiveOsAccountIds enter");
48     ids.clear();
49     return ERR_OK;
50 }
51 }  // namespace AccountSA
52 }  // namespace OHOS
53 
54