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
18 #include "ability_manager_adapter.h"
19 #include "ability_manager_ipc_interface_code.h"
20 #include "app_manager_access_client.h"
21 #include "app_mgr_ipc_interface_code.h"
22
23 using namespace testing::ext;
24
25 namespace OHOS {
26 namespace Security {
27 namespace AccessToken {
28 class ClientCodeCompareTest : public testing::Test {
29 public:
30 static void SetUpTestCase();
31 static void TearDownTestCase();
32 void SetUp();
33 void TearDown();
34 };
35
SetUpTestCase()36 void ClientCodeCompareTest::SetUpTestCase() {}
TearDownTestCase()37 void ClientCodeCompareTest::TearDownTestCase() {}
SetUp()38 void ClientCodeCompareTest::SetUp() {}
TearDown()39 void ClientCodeCompareTest::TearDown() {}
40
41 /*
42 * @tc.name: AmsCodeTest001
43 * @tc.desc: test ability manager service interface code consistency.
44 * @tc.type: FUNC
45 * @tc.require:
46 */
47 HWTEST_F(ClientCodeCompareTest, AmsCodeTest001, TestSize.Level1)
48 {
49 // ability manager interface code
50 EXPECT_EQ(static_cast<uint32_t>(AbilityManagerAdapter::Message::START_ABILITY),
51 static_cast<uint32_t>(AAFwk::AbilityManagerInterfaceCode::START_ABILITY));
52 EXPECT_EQ(static_cast<uint32_t>(AbilityManagerAdapter::Message::KILL_PROCESS_FOR_PERMISSION_UPDATE),
53 static_cast<uint32_t>(AAFwk::AbilityManagerInterfaceCode::KILL_PROCESS_FOR_PERMISSION_UPDATE));
54
55 // app manager interface code
56 EXPECT_EQ(static_cast<uint32_t>(AppManagerAccessClient::Message::REGISTER_APPLICATION_STATE_OBSERVER),
57 static_cast<uint32_t>(AppExecFwk::AppMgrInterfaceCode::REGISTER_APPLICATION_STATE_OBSERVER));
58 EXPECT_EQ(static_cast<uint32_t>(AppManagerAccessClient::Message::UNREGISTER_APPLICATION_STATE_OBSERVER),
59 static_cast<uint32_t>(AppExecFwk::AppMgrInterfaceCode::UNREGISTER_APPLICATION_STATE_OBSERVER));
60 EXPECT_EQ(static_cast<uint32_t>(AppManagerAccessClient::Message::GET_FOREGROUND_APPLICATIONS),
61 static_cast<uint32_t>(AppExecFwk::AppMgrInterfaceCode::GET_FOREGROUND_APPLICATIONS));
62 }
63 } // namespace AccessToken
64 } // namespace Security
65 } // namespace OHOS
66