• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 #ifndef OHOS_MULTIPLE_USER_CONNECTOR_MOCK_H
16 #define OHOS_MULTIPLE_USER_CONNECTOR_MOCK_H
17 
18 #include <string>
19 #include <gmock/gmock.h>
20 
21 #include "multiple_user_connector.h"
22 
23 namespace OHOS {
24 namespace DistributedHardware {
25 class DmMultipleUserConnector {
26 public:
27     virtual ~DmMultipleUserConnector() = default;
28 public:
29     virtual int32_t GetCurrentAccountUserID(void) = 0;
30     virtual int32_t GetFirstForegroundUserId(void) = 0;
31     virtual DMAccountInfo GetAccountInfoByUserId(int32_t userId) = 0;
32     virtual int32_t GetBackgroundUserIds(std::vector<int32_t> &userIdVec) = 0;
33     virtual int32_t GetForegroundUserIds(std::vector<int32_t> &userVec) = 0;
34     virtual std::string GetOhosAccountId(void) = 0;
35     virtual void GetTokenIdAndForegroundUserId(uint32_t &tokenId, int32_t &userId) = 0;
36     virtual std::string GetOhosAccountIdByUserId(int32_t userId) = 0;
37     virtual std::string GetAccountNickName(int32_t) = 0;
38     virtual void GetCallerUserId(int32_t &) = 0;
39 public:
40     static inline std::shared_ptr<DmMultipleUserConnector> dmMultipleUserConnector = nullptr;
41 };
42 
43 class MultipleUserConnectorMock : public DmMultipleUserConnector {
44 public:
45     MOCK_METHOD(int32_t, GetCurrentAccountUserID, ());
46     MOCK_METHOD(int32_t, GetFirstForegroundUserId, ());
47     MOCK_METHOD(DMAccountInfo, GetAccountInfoByUserId, (int32_t));
48     MOCK_METHOD(int32_t, GetBackgroundUserIds, (std::vector<int32_t> &));
49     MOCK_METHOD(int32_t, GetForegroundUserIds, (std::vector<int32_t> &));
50     MOCK_METHOD(std::string, GetOhosAccountId, ());
51     MOCK_METHOD(void, GetTokenIdAndForegroundUserId, (uint32_t &, int32_t &));
52     MOCK_METHOD(std::string, GetOhosAccountIdByUserId, (int32_t));
53     MOCK_METHOD(std::string, GetAccountNickName, (int32_t));
54     MOCK_METHOD(void, GetCallerUserId, (int32_t &));
55 };
56 }
57 }
58 #endif
59