已合并
Remove empty WantSenderStub and inherit IRemoteStub directly #20319
Remove empty WantSenderStub and inherit IRemoteStub directly #20319
已合并
m0_65533854创建于 14 天前
23 个文件变更+4-548
@@ -28,7 +28,7 @@
28#include "want_params.h"28#include "want_params.h"
29#include "want_receiver_stub.h"29#include "want_receiver_stub.h"
30#include "want_sender_info.h"30#include "want_sender_info.h"
31-#include "want_sender_stub.h"31+#include "want_sender_interface.h"
32 32 
33namespace OHOS::AbilityRuntime::WantAgent {33namespace OHOS::AbilityRuntime::WantAgent {
34class PendingWant final : public std::enable_shared_from_this<PendingWant>, public Parcelable {34class PendingWant final : public std::enable_shared_from_this<PendingWant>, public Parcelable {
@@ -21,15 +21,16 @@
21#include "cpp/mutex.h"21#include "cpp/mutex.h"
22 22 
23#include "iremote_object.h"23#include "iremote_object.h"
24+#include "iremote_stub.h"
24#include "pending_want_key.h"25#include "pending_want_key.h"
25#include "refbase.h"26#include "refbase.h"
26#include "sender_info.h"27#include "sender_info.h"
27-#include "want_sender_stub.h"28+#include "want_sender_interface.h"
28 29 
29namespace OHOS {30namespace OHOS {
30namespace AAFwk {31namespace AAFwk {
31class PendingWantManager;32class PendingWantManager;
32-class PendingWantRecord : public WantSenderStub {33+class PendingWantRecord : public IRemoteStub<IWantSender> {
33public:34public:
34 35 
35 PendingWantRecord();36 PendingWantRecord();
@@ -1,34 +0,0 @@
1-/*
2- * Copyright (c) 2021 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 OHOS_ABILITY_RUNTIME_WANT_SENDER_STUB_H
17-#define OHOS_ABILITY_RUNTIME_WANT_SENDER_STUB_H
18- 
19-#include <map>
20-#include "want_sender_interface.h"
21- 
22-#include <iremote_object.h>
23-#include <iremote_stub.h>
24- 
25-namespace OHOS {
26-namespace AAFwk {
27-class WantSenderStub : public IRemoteStub<IWantSender> {
28-public:
29- WantSenderStub() = default;
30- virtual ~WantSenderStub() = default;
31-};
32-} // namespace AAFwk
33-} // namespace OHOS
34-#endif // OHOS_ABILITY_RUNTIME_WANT_SENDER_STUB_H
@@ -108,7 +108,6 @@
108 *WantReceiverStub*;108 *WantReceiverStub*;
109 *WantReceiverProxy*;109 *WantReceiverProxy*;
110 *WantSenderProxy*;110 *WantSenderProxy*;
111- *WantSenderStub*;
112 *WantUtils*;111 *WantUtils*;
113 *WindowOptionsUtils*;112 *WindowOptionsUtils*;
114 };113 };
@@ -563,7 +563,6 @@ group("fuzztest") {
563 "usercontrollerfourth_fuzzer:fuzztest",563 "usercontrollerfourth_fuzzer:fuzztest",
564 "wantagenthelperstring_fuzzer:fuzztest",564 "wantagenthelperstring_fuzzer:fuzztest",
565 "wantagenthelpertrigger_fuzzer:fuzztest",565 "wantagenthelpertrigger_fuzzer:fuzztest",
566- "wantsenderstub_fuzzer:fuzztest",
567 "wantutils_fuzzer:fuzztest",566 "wantutils_fuzzer:fuzztest",
568 "windowoptionsutils_fuzzer:fuzztest",567 "windowoptionsutils_fuzzer:fuzztest",
569 ]568 ]
@@ -1,77 +0,0 @@
1-# Copyright (c) 2024 Huawei Device Co., Ltd.
2-# Licensed under the Apache License, Version 2.0 (the "License");
3-# you may not use this file except in compliance with the License.
4-# You may obtain a copy of the License at
5-#
6-# http://www.apache.org/licenses/LICENSE-2.0
7-#
8-# Unless required by applicable law or agreed to in writing, software
9-# distributed under the License is distributed on an "AS IS" BASIS,
10-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11-# See the License for the specific language governing permissions and
12-# limitations under the License.
13- 
14-#####################hydra-fuzz###################
15-import("//build/config/features.gni")
16-import("//build/ohos.gni")
17-import("//build/test.gni")
18-import("//foundation/ability/ability_runtime/ability_runtime.gni")
19-module_output_path = "ability_runtime/abilitymgr"
20- 
21-##############################fuzztest##########################################
22-ohos_fuzztest("WantSenderStubFuzzTest") {
23- module_out_path = module_output_path
24- 
25- fuzz_config_file =
26- "${ability_runtime_test_path}/fuzztest/wantsenderstub_fuzzer"
27- include_dirs = [ "${ability_runtime_innerkits_path}/ability_manager/include" ]
28- cflags = [
29- "-g",
30- "-O0",
31- "-Wno-unused-variable",
32- "-fno-omit-frame-pointer",
33- ]
34- sources = [ "wantsenderstub_fuzzer.cpp" ]
35- 
36- configs = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager_public_config" ]
37- 
38- deps = [
39- "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
40- "${ability_runtime_native_path}/ability/native:abilitykit_native",
41- "${ability_runtime_services_path}/abilitymgr:abilityms",
42- "${ability_runtime_services_path}/abilitymgr:wantagent_manager",
43- ]
44- 
45- external_deps = [
46- "ability_base:want",
47- "ability_base:zuri",
48- "bundle_framework:appexecfwk_base",
49- "bundle_framework:appexecfwk_core",
50- "c_utils:utils",
51- "common_event_service:cesfwk_innerkits",
52- "ffrt:libffrt",
53- "hilog:libhilog",
54- "ipc:ipc_core",
55- "napi:ace_napi",
56- "safwk:system_ability_fwk",
57- "samgr:samgr_proxy",
58- ]
59- 
60- if (ability_runtime_graphics) {
61- external_deps += [
62- "input:libmmi-client",
63- "window_manager:libwm",
64- ]
65- }
66-}
67- 
68-###############################################################################
69-group("fuzztest") {
70- testonly = true
71- deps = []
72- deps += [
73- # deps file
74- ":WantSenderStubFuzzTest",
75- ]
76-}
77-###############################################################################
@@ -1,16 +0,0 @@
1-/*
2- * Copyright (c) 2024 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-FUZZ
@@ -1,25 +0,0 @@
1-<?xml version="1.0" encoding="utf-8"?>
2-<!-- Copyright (c) 2024 Huawei Device Co., Ltd.
3- 
4- Licensed under the Apache License, Version 2.0 (the "License");
5- you may not use this file except in compliance with the License.
6- You may obtain a copy of the License at
7- 
8- http://www.apache.org/licenses/LICENSE-2.0
9- 
10- Unless required by applicable law or agreed to in writing, software
11- distributed under the License is distributed on an "AS IS" BASIS,
12- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- See the License for the specific language governing permissions and
14- limitations under the License.
15--->
16-<fuzz_config>
17- <fuzztest>
18- <!-- maximum length of a test input -->
19- <max_len>1000</max_len>
20- <!-- maximum total time in seconds to run the fuzzer -->
21- <max_total_time>300</max_total_time>
22- <!-- memory usage limit in Mb -->
23- <rss_limit_mb>4096</rss_limit_mb>
24- </fuzztest>
25-</fuzz_config>
@@ -1,105 +0,0 @@
1-/*
2- * Copyright (c) 2024 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 "wantsenderstub_fuzzer.h"
17- 
18-#include <cstddef>
19-#include <cstdint>
20- 
21-#include "want_sender_stub.h"
22-#include "message_parcel.h"
23-#include "securec.h"
24- 
25-using namespace OHOS::AAFwk;
26- 
27-namespace OHOS {
28-namespace {
29-constexpr int INPUT_ZERO = 0;
30-constexpr int INPUT_ONE = 1;
31-constexpr int ENABLE = 2;
32-constexpr int INPUT_THREE = 3;
33-constexpr size_t U32_AT_SIZE = 4;
34-constexpr size_t OFFSET_ZERO = 24;
35-constexpr size_t OFFSET_ONE = 16;
36-constexpr size_t OFFSET_TWO = 8;
37-const std::u16string ABILITYMGR_INTERFACE_TOKEN = u"ohos.aafwk.WantSender";
38-}
39- 
40-class WantSenderStubFuzzTest : public WantSenderStub {
41-public:
42- WantSenderStubFuzzTest() = default;
43- virtual ~WantSenderStubFuzzTest()
44- {}
45-};
46- 
47-uint32_t GetU32Data(const char* ptr)
48-{
49- // convert fuzz input data to an integer
50- return (ptr[INPUT_ZERO] << OFFSET_ZERO) | (ptr[INPUT_ONE] << OFFSET_ONE) | (ptr[ENABLE] << OFFSET_TWO) |
51- ptr[INPUT_THREE];
52-}
53- 
54-bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
55-{
56- uint32_t code = GetU32Data(data);
57- 
58- MessageParcel parcel;
59- parcel.WriteInterfaceToken(ABILITYMGR_INTERFACE_TOKEN);
60- parcel.WriteBuffer(data, size);
61- parcel.RewindRead(0);
62- MessageParcel reply;
63- MessageOption option;
64- 
65- std::shared_ptr<WantSenderStub> wantsenderstub = std::make_shared<WantSenderStubFuzzTest>();
66- 
67- wantsenderstub->OnRemoteRequest(code, parcel, reply, option);
68- 
69- return true;
70-}
71-}
72- 
73-/* Fuzzer entry point */
74-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
75-{
76- /* Run your code on data */
77- if (data == nullptr) {
78- std::cout << "invalid data" << std::endl;
79- return 0;
80- }
81- 
82- /* Validate the length of size */
83- if (size < OHOS::U32_AT_SIZE) {
84- return 0;
85- }
86- 
87- char* ch = static_cast<char*>(malloc(size + 1));
88- if (ch == nullptr) {
89- std::cout << "malloc failed." << std::endl;
90- return 0;
91- }
92- 
93- (void)memset_s(ch, size + 1, 0x00, size + 1);
94- if (memcpy_s(ch, size + 1, data, size) != EOK) {
95- std::cout << "copy failed." << std::endl;
96- free(ch);
97- ch = nullptr;
98- return 0;
99- }
100- 
101- OHOS::DoSomethingInterestingWithMyAPI(ch, size);
102- free(ch);
103- ch = nullptr;
104- return 0;
105-}
@@ -1,21 +0,0 @@
1-/*
2- * Copyright (c) 2024 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 FUZZTEST_OHOS_ABILITY_RUNTIME_WANTSENDERSTUB_FUZZER_H
17-#define FUZZTEST_OHOS_ABILITY_RUNTIME_WANTSENDERSTUB_FUZZER_H
18- 
19-#define FUZZ_PROJECT_NAME "wantsenderstub_fuzzer"
20- 
21-#endif // FUZZTEST_OHOS_ABILITY_RUNTIME_WANTSENDERSTUB_FUZZER_H
@@ -42,7 +42,6 @@
42#undef protected42#undef protected
43#include "wants_info.h"43#include "wants_info.h"
44#include "want_receiver_stub.h"44#include "want_receiver_stub.h"
45-#include "want_sender_stub.h"
46#include "mission_list_manager.h"45#include "mission_list_manager.h"
47 46 
48using namespace std::placeholders;47using namespace std::placeholders;
@@ -569,7 +569,6 @@ group("unittest") {
569 "want_receiver_proxy_test:unittest",569 "want_receiver_proxy_test:unittest",
570 "want_receiver_stub_test:unittest",570 "want_receiver_stub_test:unittest",
571 "want_sender_info_test:unittest",571 "want_sender_info_test:unittest",
572- "want_sender_stub_test:unittest",
573 "wants_info_test:unittest",572 "wants_info_test:unittest",
574 "window_config_test:unittest",573 "window_config_test:unittest",
575 "window_focus_changed_listener_test:unittest",574 "window_focus_changed_listener_test:unittest",
@@ -35,7 +35,6 @@
35#include "system_ability_definition.h"35#include "system_ability_definition.h"
36#include "wants_info.h"36#include "wants_info.h"
37#include "want_receiver_stub.h"37#include "want_receiver_stub.h"
38-#include "want_sender_stub.h"
39 38 
40using namespace testing;39using namespace testing;
41using namespace testing::ext;40using namespace testing::ext;
@@ -38,7 +38,6 @@
38#include "system_ability_definition.h"38#include "system_ability_definition.h"
39#include "wants_info.h"39#include "wants_info.h"
40#include "want_receiver_stub.h"40#include "want_receiver_stub.h"
41-#include "want_sender_stub.h"
42 41 
43using namespace testing;42using namespace testing;
44using namespace testing::ext;43using namespace testing::ext;
@@ -38,7 +38,6 @@
38#include "system_ability_definition.h"38#include "system_ability_definition.h"
39#include "wants_info.h"39#include "wants_info.h"
40#include "want_receiver_stub.h"40#include "want_receiver_stub.h"
41-#include "want_sender_stub.h"
42 41 
43using namespace testing;42using namespace testing;
44using namespace testing::ext;43using namespace testing::ext;
@@ -42,7 +42,6 @@
42#include "want_agent_client.h"42#include "want_agent_client.h"
43#include "want_agent_helper.h"43#include "want_agent_helper.h"
44#include "want_sender_info.h"44#include "want_sender_info.h"
45-#include "want_sender_stub.h"
46#include "bool_wrapper.h"45#include "bool_wrapper.h"
47#include "zchar_wrapper.h"46#include "zchar_wrapper.h"
48#include "byte_wrapper.h"47#include "byte_wrapper.h"
@@ -37,7 +37,6 @@
37#include "system_ability_definition.h"37#include "system_ability_definition.h"
38#include "wants_info.h"38#include "wants_info.h"
39#include "want_receiver_stub.h"39#include "want_receiver_stub.h"
40-#include "want_sender_stub.h"
41#include "hilog_tag_wrapper.h"40#include "hilog_tag_wrapper.h"
42 41 
43using namespace testing;42using namespace testing;
@@ -42,7 +42,6 @@
42#undef protected42#undef protected
43#include "want_params.h"43#include "want_params.h"
44#include "want_receiver_stub.h"44#include "want_receiver_stub.h"
45-#include "want_sender_stub.h"
46#include "bool_wrapper.h"45#include "bool_wrapper.h"
47 46 
48using namespace testing::ext;47using namespace testing::ext;
@@ -32,7 +32,6 @@
32#undef protected32#undef protected
33#include "want_params.h"33#include "want_params.h"
34#include "want_receiver_stub.h"34#include "want_receiver_stub.h"
35-#include "want_sender_stub.h"
36#include "bool_wrapper.h"35#include "bool_wrapper.h"
37 36 
38using namespace testing::ext;37using namespace testing::ext;
@@ -34,7 +34,6 @@
34#include "want_agent_info.h"34#include "want_agent_info.h"
35#include "want_params.h"35#include "want_params.h"
36#include "want_receiver_stub.h"36#include "want_receiver_stub.h"
37-#include "want_sender_stub.h"
38 37 
39using namespace testing::ext;38using namespace testing::ext;
40using namespace OHOS::AAFwk;39using namespace OHOS::AAFwk;
@@ -1,75 +0,0 @@
1-# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
2-# Licensed under the Apache License, Version 2.0 (the "License");
3-# you may not use this file except in compliance with the License.
4-# You may obtain a copy of the License at
5-#
6-# http://www.apache.org/licenses/LICENSE-2.0
7-#
8-# Unless required by applicable law or agreed to in writing, software
9-# distributed under the License is distributed on an "AS IS" BASIS,
10-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11-# See the License for the specific language governing permissions and
12-# limitations under the License.
13- 
14-import("//build/test.gni")
15-import("//foundation/ability/ability_runtime/ability_runtime.gni")
16- 
17-module_output_path = "ability_runtime/ability_runtime/abilitymgr"
18- 
19-ohos_unittest("want_sender_stub_test") {
20- module_out_path = module_output_path
21- sanitize = {
22- cfi = true
23- cfi_cross_dso = true
24- debug = false
25- blocklist = "../../cfi_blocklist.txt"
26- }
27- branch_protector_ret = "pac_ret"
28- include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock" ]
29- 
30- sources = [
31- "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp",
32- "want_sender_stub_test.cpp",
33- ]
34- 
35- configs = [
36- "${ability_runtime_services_path}/abilitymgr:abilityms_config",
37- "${ability_runtime_test_path}/mock/services_abilitymgr_test:aafwk_mock_config",
38- ]
39- cflags = []
40- if (target_cpu == "arm") {
41- cflags += [ "-DBINDER_IPC_32BIT" ]
42- }
43- deps = [
44- "${ability_runtime_innerkits_path}/ability_manager:ability_manager",
45- "${ability_runtime_innerkits_path}/app_manager:app_manager",
46- "${ability_runtime_native_path}/ability/native:abilitykit_native",
47- "${ability_runtime_services_path}/abilitymgr:abilityms",
48- "${ability_runtime_services_path}/abilitymgr:wantagent_manager",
49- "${ability_runtime_services_path}/common:perm_verification",
50- ]
51- 
52- external_deps = [
53- "ability_base:zuri",
54- "access_token:libaccesstoken_sdk",
55- "c_utils:utils",
56- "common_event_service:cesfwk_innerkits",
57- "ffrt:libffrt",
58- "googletest:gmock_main",
59- "googletest:gtest_main",
60- "hilog:libhilog",
61- "ipc:ipc_core",
62- "napi:ace_napi",
63- "samgr:samgr_proxy",
64- ]
65- 
66- if (background_task_mgr_continuous_task_enable) {
67- external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
68- }
69-}
70- 
71-group("unittest") {
72- testonly = true
73- 
74- deps = [ ":want_sender_stub_test" ]
75-}
@@ -1,54 +0,0 @@
1-/*
2- * Copyright (c) 2021 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 UNITTEST_OHOS_ABILITY_RUNTIME_WANT_SENDER_STUB_IMPL_MOCK_H
17-#define UNITTEST_OHOS_ABILITY_RUNTIME_WANT_SENDER_STUB_IMPL_MOCK_H
18- 
19-#define private public
20-#include "want_sender_stub.h"
21-#undef private
22- 
23-#include <gmock/gmock.h>
24-#include <iremote_object.h>
25-#include <iremote_stub.h>
26-#include "want_sender_interface.h"
27- 
28-namespace OHOS {
29-namespace AAFwk {
30-class WantSenderStubImplMock : public WantSenderStub {
31-public:
32- WantSenderStubImplMock()
33- {}
34- virtual ~WantSenderStubImplMock()
35- {}
36- 
37- int InvokeSendRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
38- {
39- code_ = code;
40- return 0;
41- }
42- 
43- int InvokeErrorSendRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
44- {
45- code_ = code;
46- return UNKNOWN_ERROR;
47- }
48- 
49- int code_ = 0;
50-};
51-} // namespace AAFwk
52-} // namespace OHOS
53- 
54-#endif // UNITTEST_OHOS_ABILITY_RUNTIME_WANT_SENDER_STUB_IMPL_MOCK_H
@@ -1,126 +0,0 @@
1-/*
2- * Copyright (c) 2021 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 "iremote_proxy.h"
18-#include "want_sender_stub_impl_mock.h"
19- 
20-using namespace testing::ext;
21-using namespace testing;
22- 
23-namespace OHOS {
24-namespace AAFwk {
25-class WantSenderStubTest : public testing::Test {
26-public:
27- static void SetUpTestCase(void);
28- static void TearDownTestCase(void);
29- void SetUp();
30- void TearDown();
31- void WriteInterfaceToken(MessageParcel& data);
32- sptr<WantSenderStubImplMock> stub_{ nullptr };
33-};
34- 
35-void WantSenderStubTest::SetUpTestCase(void)
36-{}
37-void WantSenderStubTest::TearDownTestCase(void)
38-{}
39-void WantSenderStubTest::TearDown()
40-{}
41- 
42-void WantSenderStubTest::SetUp()
43-{
44- stub_ = new WantSenderStubImplMock();
45-}
46- 
47-void WantSenderStubTest::WriteInterfaceToken(MessageParcel& data)
48-{
49- data.WriteInterfaceToken(WantSenderStubImplMock::GetDescriptor());
50-}
51- 
52-/*
53- * Feature: WantSenderStub
54- * Function: OnRemoteRequest
55- * SubFunction: NA
56- * FunctionPoints: WantSenderStub OnRemoteRequest
57- * EnvConditions: The code which not exist
58- * CaseDescription: Verify that on remote request is abnormal
59- */
60-HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_001, TestSize.Level1)
61-{
62- MessageParcel data;
63- MessageParcel reply;
64- MessageOption option;
65- 
66- WriteInterfaceToken(data);
67- int res = stub_->OnRemoteRequest(10000, data, reply, option);
68- 
69- EXPECT_EQ(res, IPC_STUB_UNKNOW_TRANS_ERR);
70-}
71- 
72-/*
73- * Feature: WantSenderStub
74- * Function: OnRemoteRequest
75- * SubFunction: NA
76- * FunctionPoints: WantSenderStub OnRemoteRequest
77- * EnvConditions: code = 0 (legacy WANT_SENDER_SEND, removed)
78- * CaseDescription: Regression lock-in. code 0 was the legacy WANT_SENDER_SEND
79- * trans code that allowed bypassing
80- * PendingWantManager::CheckCallerPermission via direct
81- * IWantSender::Send IPC. The trans code enum was deleted along
82- * with WantSenderStub::OnRemoteRequest override, so code 0 now
83- * falls through to IPCObjectStub which returns
84- * IPC_STUB_UNKNOW_TRANS_ERR. This test prevents reintroduction
85- * of WANT_SENDER_SEND handling without an explicit security
86- * review.
87- */
88-HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_Code0_Rejected_0100, TestSize.Level1)
89-{
90- MessageParcel data;
91- MessageParcel reply;
92- MessageOption option;
93- 
94- WriteInterfaceToken(data);
95- int res = stub_->OnRemoteRequest(0, data, reply, option);
96- 
97- EXPECT_EQ(res, IPC_STUB_UNKNOW_TRANS_ERR);
98-}
99- 
100-/*
101- * Feature: WantSenderStub
102- * Function: OnRemoteRequest
103- * SubFunction: NA
104- * FunctionPoints: WantSenderStub OnRemoteRequest
105- * EnvConditions: code = 0, valid interface token + valid SenderInfo payload
106- * CaseDescription: Verify code 0 is rejected even when a valid-looking
107- * SenderInfo payload is attached. Guards against partial
108- * reintroduction (e.g., re-adding SendInner dispatch on code 0
109- * based on payload shape rather than trans code definition).
110- */
111-HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_Code0_WithPayload_Rejected_0100, TestSize.Level1)
112-{
113- MessageParcel data;
114- MessageParcel reply;
115- MessageOption option;
116- 
117- WriteInterfaceToken(data);
118- SenderInfo info;
119- data.WriteParcelable(&info);
120- 
121- int res = stub_->OnRemoteRequest(0, data, reply, option);
122- 
123- EXPECT_EQ(res, IPC_STUB_UNKNOW_TRANS_ERR);
124-}
125-} // namespace AAFwk
126-} // namespace OHOS