!6678 优化接口getSnapshot的Fuzz用例

Merge pull request !6678 from 钟林杰/master
This commit is contained in:
openharmony_ci 2024-06-05 09:09:02 +00:00 committed by Gitee
commit 319d3635ad
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -35,20 +35,11 @@ namespace {
constexpr size_t DATA_MIN_SIZE = 2; constexpr size_t DATA_MIN_SIZE = 2;
} }
bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size) void MakeThingsPart01(MessageParcel& parcel)
{ {
if (data == nullptr || size < DATA_MIN_SIZE) {
return false;
}
MessageParcel parcel;
MessageParcel reply; MessageParcel reply;
MessageOption option; MessageOption option;
parcel.WriteInterfaceToken(SceneSessionManagerStub::GetDescriptor());
parcel.WriteBuffer(data, size);
parcel.RewindRead(0);
SceneSessionManager::GetInstance().OnRemoteRequest( SceneSessionManager::GetInstance().OnRemoteRequest(
static_cast<uint32_t>(ISceneSessionManager:: static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_SET_SESSION_LABEL), SceneSessionManagerMessage::TRANS_ID_SET_SESSION_LABEL),
@ -61,6 +52,10 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
static_cast<uint32_t>(ISceneSessionManager:: static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_SET_SESSION_ICON), SceneSessionManagerMessage::TRANS_ID_SET_SESSION_ICON),
parcel, reply, option); parcel, reply, option);
SceneSessionManager::GetInstance().OnRemoteRequest(
static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_GET_SESSION_SNAPSHOT_BY_ID),
parcel, reply, option);
SceneSessionManager::GetInstance().OnRemoteRequest( SceneSessionManager::GetInstance().OnRemoteRequest(
static_cast<uint32_t>(ISceneSessionManager:: static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_SET_GESTURE_NAVIGATION_ENABLED), SceneSessionManagerMessage::TRANS_ID_SET_GESTURE_NAVIGATION_ENABLED),
@ -69,6 +64,13 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
static_cast<uint32_t>(ISceneSessionManager:: static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_UPDATE_AVOIDAREA_LISTENER), SceneSessionManagerMessage::TRANS_ID_UPDATE_AVOIDAREA_LISTENER),
parcel, reply, option); parcel, reply, option);
}
void MakeThingsPart02(MessageParcel& parcel)
{
MessageParcel reply;
MessageOption option;
SceneSessionManager::GetInstance().OnRemoteRequest( SceneSessionManager::GetInstance().OnRemoteRequest(
static_cast<uint32_t>(ISceneSessionManager:: static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_SET_SESSION_CONTINUE_STATE), SceneSessionManagerMessage::TRANS_ID_SET_SESSION_CONTINUE_STATE),
@ -85,6 +87,21 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
static_cast<uint32_t>(ISceneSessionManager:: static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_UPDATE_EXTENSION_WINDOW_FLAGS), SceneSessionManagerMessage::TRANS_ID_UPDATE_EXTENSION_WINDOW_FLAGS),
parcel, reply, option); parcel, reply, option);
}
bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
{
if (data == nullptr || size < DATA_MIN_SIZE) {
return false;
}
MessageParcel parcel;
parcel.WriteInterfaceToken(SceneSessionManagerStub::GetDescriptor());
parcel.WriteBuffer(data, size);
parcel.RewindRead(0);
MakeThingsPart01(parcel);
MakeThingsPart02(parcel);
return true; return true;
} }
} // namespace OHOS } // namespace OHOS