• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 COOPERATE_SERVER_TEST_H
17 #define COOPERATE_SERVER_TEST_H
18 
19 #include <gtest/gtest.h>
20 
21 #include "devicestatus_define.h"
22 #include "cooperate_server.h"
23 #include "test_context.h"
24 
25 namespace OHOS {
26 namespace Msdp {
27 namespace DeviceStatus {
28 
29 
30 class MockHapToken {
31 public:
32     explicit MockHapToken(
33         const std::string& bundle, const std::vector<std::string>& reqPerm, bool isSystemApp = true);
34     ~MockHapToken();
35 private:
36     uint64_t selfToken_;
37     uint32_t mockToken_;
38 };
39 
40 class MockNativeToken {
41 public:
42     explicit MockNativeToken(const std::string& process);
43     ~MockNativeToken();
44 private:
45     uint64_t selfToken_;
46 };
47 
48 class CooperateServerTest : public testing::Test {
49 public:
50     CooperateServerTest();
51     ~CooperateServerTest() = default;
52 
53     void SetUp();
54     void TearDown();
55     static void SetUpTestCase();
56     static void TearDownTestCase();
57 
58 private:
59     Intention intention_ { Intention::COOPERATE };
60     std::shared_ptr<TestContext> context_ { nullptr };
61     std::shared_ptr<CooperateServer> cooperateServer_ { nullptr };
62 };
63 } // namespace DeviceStatus
64 } // namespace Msdp
65 } // namespace OHOS
66 #endif //COOPERATE_SERVER_TEST_H
67