1 /*
2 * Copyright (c) 2022 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 #include "concurrent_task_service.h"
18
19 namespace OHOS {
20 namespace FFRT_TEST {
21 using namespace testing;
22 using namespace testing::ext;
23 using namespace OHOS::ConcurrentTask;
24
25
26 class ConcurrentTaskServiceTest : public testing::Test {
27 public:
28 static void SetUpTestCase();
29 static void TearDownTestCase();
30 void SetUp();
31 void TearDown();
32 };
33
SetUpTestCase()34 void ConcurrentTaskServiceTest::SetUpTestCase()
35 {
36 }
37
TearDownTestCase()38 void ConcurrentTaskServiceTest::TearDownTestCase()
39 {
40 }
41
SetUp()42 void ConcurrentTaskServiceTest::SetUp()
43 {
44 }
45
TearDown()46 void ConcurrentTaskServiceTest::TearDown()
47 {
48 }
49
50 /**
51 * @tc.name: QueryIntervalTest
52 * @tc.desc: Test whether the QueryInterval interface are normal.
53 * @tc.type: FUNC
54 */
55 HWTEST_F(ConcurrentTaskServiceTest, QueryIntervalTest, TestSize.Level1)
56 {
57 int queryItem = 0;
58 IntervalReply queryRs = {87, 657, 357, 214};
59 ConcurrentTaskService queInt;
60 queInt.QueryInterval(queryItem, queryRs);
61 EXPECT_NE(queryRs.tid, -1);
62 }
63
64 /**
65 * @tc.name: QueryDeadlineTest
66 * @tc.desc: Test whether the QueryDeadline interface are normal.
67 * @tc.type: FUNC
68 */
69 HWTEST_F(ConcurrentTaskServiceTest, QueryDeadlineTest, TestSize.Level1)
70 {
71 int queryItem = 0;
72 DeadlineReply ddlReply = { false };
73 Json::Value payload;
74 payload["1111"] = "60";
75 payload["2222"] = "90";
76 ConcurrentTaskService queInt;
77 queInt.QueryDeadline(queryItem, ddlReply, payload);
78 EXPECT_FALSE(payload.empty());
79 }
80 }
81 }