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 #ifndef OS_ACCOUNT_FRAMEWORKS_DOMAIN_ACCOUNT_TEST_INCLUDE_MOCK_DOMAIN_PLUGIN_H 17 #define OS_ACCOUNT_FRAMEWORKS_DOMAIN_ACCOUNT_TEST_INCLUDE_MOCK_DOMAIN_PLUGIN_H 18 19 #include "domain_account_plugin.h" 20 21 namespace OHOS { 22 namespace AccountSA { 23 class MockDomainPlugin : public DomainAccountPlugin { 24 public: 25 MockDomainPlugin(); 26 virtual ~MockDomainPlugin(); 27 void Auth(const DomainAccountInfo &info, const std::vector<uint8_t> &password, 28 const std::shared_ptr<DomainAccountCallback> &callback) override; 29 void AuthWithPopup(const AccountSA::DomainAccountInfo &info, 30 const std::shared_ptr<AccountSA::DomainAccountCallback> &callback) override; 31 void AuthWithToken(const AccountSA::DomainAccountInfo &info, const std::vector<uint8_t> &token, 32 const std::shared_ptr<AccountSA::DomainAccountCallback> &callback) override; 33 void GetAuthStatusInfo(const DomainAccountInfo &info, 34 const std::shared_ptr<DomainAccountCallback> &callback) override; 35 virtual void GetDomainAccountInfo(const GetDomainAccountInfoOptions &options, 36 const std::shared_ptr<DomainAccountCallback> &callback) override; 37 void OnAccountBound(const DomainAccountInfo &info, const int32_t localId, 38 const std::shared_ptr<DomainAccountCallback> &callback) override; 39 void OnAccountUnBound(const DomainAccountInfo &info, 40 const std::shared_ptr<DomainAccountCallback> &callback) override; 41 void IsAccountTokenValid(const DomainAccountInfo &info, const std::vector<uint8_t> &token, 42 const std::shared_ptr<DomainAccountCallback> &callback) override; 43 void GetAccessToken(const DomainAccountInfo &domainInfo, const std::vector<uint8_t> &accountToken, 44 const GetAccessTokenOptions &option, const std::shared_ptr<DomainAccountCallback> &callback) override; 45 46 private: 47 void AuthCommonInterface(const DomainAccountInfo &info, const std::vector<uint8_t> &authData, 48 const std::shared_ptr<DomainAccountCallback> &callback, AuthMode authMode); 49 50 private: 51 int32_t remainingTimes_; 52 int32_t freezingTime_; 53 }; 54 } // AccountSA 55 } // OHOS 56 #endif // OS_ACCOUNT_FRAMEWORKS_DOMAIN_ACCOUNT_TEST_INCLUDE_MOCK_DOMAIN_PLUGIN_H