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 "gtest/gtest.h"
17
18 #define private public
19 #include "intellisense_server.h"
20 #undef private
21
22 namespace OHOS {
23 namespace RME {
24 using namespace testing;
25 using namespace testing::ext;
26
27 class IntelliSenseServerTest : public testing::Test {
28 public:
29 static void SetUpTestCase();
30 static void TearDownTestCase();
31 void SetUp();
32 void TearDown();
33 };
34
SetUpTestCase()35 void IntelliSenseServerTest::SetUpTestCase()
36 {
37 }
38
TearDownTestCase()39 void IntelliSenseServerTest::TearDownTestCase()
40 {
41 }
42
SetUp()43 void IntelliSenseServerTest::SetUp()
44 {
45 }
46
TearDown()47 void IntelliSenseServerTest::TearDown()
48 {
49 }
50
51 /**
52 * @tc.name: ReportContinuousTaskTest
53 * @tc.desc: Verify the ReportContinuousTask function.
54 * @tc.type: FUNC
55 */
56 HWTEST_F(IntelliSenseServerTest, ReportContinuousTaskTest, TestSize.Level1)
57 {
58 int pid = 777;
59 int uid = 888;
60 int status = 0;
61 IntelliSenseServer::GetInstance().m_switch = false;
62 IntelliSenseServer::GetInstance().ReportContinuousTask(pid, uid, status);
63 IntelliSenseServer::GetInstance().m_switch = true;
64 IntelliSenseServer::GetInstance().ReportContinuousTask(pid, uid, status);
65 status = 1;
66 IntelliSenseServer::GetInstance().ReportContinuousTask(pid, uid, status);
67 status = 2;
68 IntelliSenseServer::GetInstance().ReportContinuousTask(pid, uid, status);
69 }
70 } // namespace RME
71 } // namespace OHOS