• 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 #include <gtest/gtest.h>
17 #include "ability_manager_service.h"
18 #include "timeout_state_utils.h"
19 
20 using namespace testing;
21 using namespace testing::ext;
22 
23 namespace OHOS {
24 namespace AAFwk {
25 class TimeoutStateUtilsTest : public testing::Test {
26 public:
27     static void SetUpTestCase();
28     static void TearDownTestCase();
29     void SetUp() override;
30     void TearDown() override;
31 };
32 
SetUpTestCase(void)33 void TimeoutStateUtilsTest::SetUpTestCase(void)
34 {}
35 
TearDownTestCase(void)36 void TimeoutStateUtilsTest::TearDownTestCase(void)
37 {}
38 
SetUp()39 void TimeoutStateUtilsTest::SetUp()
40 {}
41 
TearDown()42 void TimeoutStateUtilsTest::TearDown()
43 {}
44 
45 /**
46  * @tc.number: StateUtilsTest_MsgId2FreezeTimeOutState_0100
47  * @tc.desc: MsgId2FreezeTimeOutState
48  * @tc.type: FUNC
49  * @tc.require: No
50  */
51 HWTEST_F(TimeoutStateUtilsTest, TimeoutStateUtilsTest_MsgId2FreezeTimeOutState_0100, TestSize.Level2)
52 {
53     EXPECT_EQ(TimeoutStateUtils::MsgId2FreezeTimeOutState(AbilityManagerService::LOAD_TIMEOUT_MSG),
54         AbilityRuntime::FreezeUtil::TimeoutState::LOAD);
55     EXPECT_EQ(TimeoutStateUtils::MsgId2FreezeTimeOutState(AbilityManagerService::FOREGROUND_TIMEOUT_MSG),
56         AbilityRuntime::FreezeUtil::TimeoutState::FOREGROUND);
57     EXPECT_EQ(TimeoutStateUtils::MsgId2FreezeTimeOutState(AbilityManagerService::BACKGROUND_TIMEOUT_MSG),
58         AbilityRuntime::FreezeUtil::TimeoutState::BACKGROUND);
59     EXPECT_EQ(TimeoutStateUtils::MsgId2FreezeTimeOutState(AbilityManagerService::CONNECT_TIMEOUT_MSG),
60         AbilityRuntime::FreezeUtil::TimeoutState::CONNECT);
61     EXPECT_EQ(TimeoutStateUtils::MsgId2FreezeTimeOutState(AbilityManagerService::CONNECT_HALF_TIMEOUT_MSG),
62         AbilityRuntime::FreezeUtil::TimeoutState::UNKNOWN);
63 }
64 
65 }  // namespace AAFwk
66 }  // namespace OHOS
67