Description: UIExtension支持无障碍子树

IssueNo: #IA6Y83
Sig: SIG_ApplicationFramework
Feature or Bugfix: Feature
Binary Source: No

Signed-off-by: yangzk <yangzhongkai@huawei.com>
Change-Id: I0e0bbbde29c2d67cb889cd0bd6cfccca2f64522f
This commit is contained in:
yangzk 2024-06-28 19:57:56 +08:00
parent 8762c28e76
commit 26ec8c1c94
28 changed files with 584 additions and 2185 deletions

View File

@ -63,14 +63,6 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_FOCUS_STATE_EVENT),
parcel, reply, option);
parcel.RewindRead(0);
eventStub->OnRemoteRequest(
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_FOCUS_MOVE_SEARCH),
parcel, reply, option);
parcel.RewindRead(0);
eventStub->OnRemoteRequest(
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_FIND_FOCUSED_ELEMENT_INFO),
parcel, reply, option);
parcel.RewindRead(0);
eventStub->OnRemoteRequest(
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_CLEAR_FOCUS),
parcel, reply, option);

View File

@ -60,11 +60,19 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
parcel, reply, option);
parcel.RewindRead(0);
eventStub->OnRemoteRequest(
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_EXECUTE_ACTION),
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_HOVER_EVENT),
parcel, reply, option);
parcel.RewindRead(0);
eventStub->OnRemoteRequest(
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_HOVER_EVENT),
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_CHILD_TREE_REGISTER),
parcel, reply, option);
parcel.RewindRead(0);
eventStub->OnRemoteRequest(
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_CHILD_TREE_UNREGISTER),
parcel, reply, option);
parcel.RewindRead(0);
eventStub->OnRemoteRequest(
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_DUMP_CHILD_INFO),
parcel, reply, option);
return true;
}

View File

@ -58,14 +58,6 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
eventStub->OnRemoteRequest(
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_BACKPRESSED_EVENT),
parcel, reply, option);
parcel.RewindRead(0);
eventStub->OnRemoteRequest(
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_SEARCH_ELEMENT_INFO),
parcel, reply, option);
parcel.RewindRead(0);
eventStub->OnRemoteRequest(
static_cast<uint32_t>(Rosen::WindowEventInterfaceCode::TRANS_ID_TRANSFER_SEARCH_ELEMENT_INFO_BY_TEXT),
parcel, reply, option);
return true;
}
} // namespace.OHOS

View File

@ -136,6 +136,10 @@ ohos_shared_library("scene_session") {
defines += [ "IMF_ENABLE" ]
}
if (build_variant == "root") {
defines += [ "ACCESSIBILITY_DUMP_FOR_TEST" ]
}
innerapi_tags = [ "platformsdk" ]
part_name = "window_manager"
subsystem_name = "window"

View File

@ -61,18 +61,13 @@ public:
const sptr<IRemoteObject>& listener) override;
WSError TransferFocusActiveEvent(bool isFocusActive) override;
WSError TransferFocusState(bool focusState) override;
WSError TransferSearchElementInfo(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos) override;
WSError TransferSearchElementInfosByText(int64_t elementId, const std::string& text, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos) override;
WSError TransferFindFocusedElementInfo(int64_t elementId, int32_t focusType, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info) override;
WSError TransferFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info) override;
WSError TransferExecuteAction(int64_t elementId, const std::map<std::string, std::string>& actionArguments,
int32_t action, int64_t baseParent) override;
WSError TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType,
int32_t eventType, int64_t timeMs) override;
WSError TransferAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId) override;
WSError TransferAccessibilityChildTreeUnregister() override;
WSError TransferAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info) override;
private:
void PrintKeyEvent(const std::shared_ptr<MMI::KeyEvent>& event);

View File

@ -91,36 +91,26 @@ public:
{
return WSError::WS_OK;
}
virtual WSError NotifySearchElementInfoByAccessibilityId(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos)
{
return WSError::WS_OK;
}
virtual WSError NotifySearchElementInfosByText(int64_t elementId, const std::string& text, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos)
{
return WSError::WS_OK;
}
virtual WSError NotifyFindFocusedElementInfo(int64_t elementId, int32_t focusType, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info)
{
return WSError::WS_OK;
}
virtual WSError NotifyFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info)
{
return WSError::WS_OK;
}
virtual WSError NotifyExecuteAction(int64_t elementId, const std::map<std::string, std::string>& actionArguments,
int32_t action, int64_t baseParent)
{
return WSError::WS_OK;
}
virtual WSError NotifyAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType,
int64_t timeMs)
{
return WSError::WS_OK;
}
virtual WSError NotifyAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId)
{
return WSError::WS_OK;
}
virtual WSError NotifyAccessibilityChildTreeUnregister()
{
return WSError::WS_OK;
}
virtual WSError NotifyAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info)
{
return WSError::WS_OK;
}
virtual void NotifyKeyboardPanelInfoChange(const KeyboardPanelInfo& keyboardPanelInfo) {}
};
} // namespace OHOS::Rosen

View File

@ -57,18 +57,13 @@ public:
const sptr<IRemoteObject>& listener) = 0;
virtual WSError TransferFocusActiveEvent(bool isFocusActive) = 0;
virtual WSError TransferFocusState(bool focusState) = 0;
virtual WSError TransferSearchElementInfo(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos) = 0;
virtual WSError TransferSearchElementInfosByText(int64_t elementId, const std::string& text, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos) = 0;
virtual WSError TransferFindFocusedElementInfo(int64_t elementId, int32_t focusType, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info) = 0;
virtual WSError TransferFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info) = 0;
virtual WSError TransferExecuteAction(int64_t elementId, const std::map<std::string, std::string>& actionArguments,
int32_t action, int64_t baseParent) = 0;
virtual WSError TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType,
int64_t timeMs) = 0;
virtual WSError TransferAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId) = 0;
virtual WSError TransferAccessibilityChildTreeUnregister() = 0;
virtual WSError TransferAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info) = 0;
};
} // namespace OHOS::Rosen
#endif // OHOS_WINDOW_SCENE_SESSION_WINDOW_EVENT_CHANNEL_INTERFACE_H

View File

@ -40,18 +40,13 @@ public:
const sptr<IRemoteObject>& listener) override;
WSError TransferFocusActiveEvent(bool isFocusActive) override;
WSError TransferFocusState(bool focusState) override;
WSError TransferSearchElementInfo(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos) override;
WSError TransferSearchElementInfosByText(int64_t elementId, const std::string& text, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos) override;
WSError TransferFindFocusedElementInfo(int64_t elementId, int32_t focusType, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info) override;
WSError TransferFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info) override;
WSError TransferExecuteAction(int64_t elementId, const std::map<std::string, std::string>& actionArguments,
int32_t action, int64_t baseParent) override;
WSError TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType,
int64_t timeMs) override;
WSError TransferAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId) override;
WSError TransferAccessibilityChildTreeUnregister() override;
WSError TransferAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info) override;
private:
static inline BrokerDelegator<WindowEventChannelProxy> delegator_;
};

View File

@ -39,12 +39,10 @@ private:
int HandleGetApplicationPid(MessageParcel& data, MessageParcel& reply);
int HandleTransferFocusActiveEvent(MessageParcel& data, MessageParcel& reply);
int HandleTransferFocusStateEvent(MessageParcel& data, MessageParcel& reply);
int HandleTransferSearchElementInfo(MessageParcel& data, MessageParcel& reply);
int HandleTransferSearchElementInfosByText(MessageParcel& data, MessageParcel& reply);
int HandleTransferFindFocusedElementInfo(MessageParcel& data, MessageParcel& reply);
int HandleTransferFocusMoveSearch(MessageParcel& data, MessageParcel& reply);
int HandleTransferExecuteAction(MessageParcel& data, MessageParcel& reply);
int HandleTransferAccessibilityHoverEvent(MessageParcel& data, MessageParcel& reply);
int HandleTransferAccessibilityChildTreeRegister(MessageParcel& data, MessageParcel& reply);
int HandleTransferAccessibilityChildTreeUnregister(MessageParcel& data, MessageParcel& reply);
int HandleTransferAccessibilityDumpChildInfo(MessageParcel& data, MessageParcel& reply);
};
} // namespace OHOS::Rosen
#endif // OHOS_WINDOW_SCENE_WINDOW_EVENT_CHANNEL_STUB_H

View File

@ -26,13 +26,11 @@ enum class WindowEventInterfaceCode {
TRANS_ID_TRANSFER_FOCUS_WINDOW_ID_EVENT,
TRANS_ID_TRANSFER_FOCUS_STATE_EVENT,
TRANS_ID_TRANSFER_BACKPRESSED_EVENT,
TRANS_ID_TRANSFER_SEARCH_ELEMENT_INFO,
TRANS_ID_TRANSFER_SEARCH_ELEMENT_INFO_BY_TEXT,
TRANS_ID_TRANSFER_FIND_FOCUSED_ELEMENT_INFO,
TRANS_ID_TRANSFER_FOCUS_MOVE_SEARCH,
TRANS_ID_TRANSFER_EXECUTE_ACTION,
TRANS_ID_TRANSFER_CLEAR_FOCUS,
TRANS_ID_TRANSFER_ACCESSIBILITY_HOVER_EVENT,
TRANS_ID_TRANSFER_ACCESSIBILITY_CHILD_TREE_REGISTER,
TRANS_ID_TRANSFER_ACCESSIBILITY_CHILD_TREE_UNREGISTER,
TRANS_ID_TRANSFER_ACCESSIBILITY_DUMP_CHILD_INFO,
TRANS_ID_TRANSFER_KEY_EVENT_ASYNC,
};
} // namespace Rosen

View File

@ -288,64 +288,47 @@ WSError WindowEventChannel::TransferFocusState(bool focusState)
return WSError::WS_OK;
}
WSError WindowEventChannel::TransferSearchElementInfo(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos)
{
if (!sessionStage_) {
WLOGFE("session stage is null!");
return WSError::WS_ERROR_NULLPTR;
}
return sessionStage_->NotifySearchElementInfoByAccessibilityId(elementId, mode, baseParent, infos);
}
WSError WindowEventChannel::TransferSearchElementInfosByText(int64_t elementId, const std::string& text,
int64_t baseParent, std::list<Accessibility::AccessibilityElementInfo>& infos)
{
if (!sessionStage_) {
WLOGFE("session stage is null!");
return WSError::WS_ERROR_NULLPTR;
}
return sessionStage_->NotifySearchElementInfosByText(elementId, text, baseParent, infos);
}
WSError WindowEventChannel::TransferFindFocusedElementInfo(int64_t elementId, int32_t focusType, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info)
{
if (!sessionStage_) {
WLOGFE("session stage is null!");
return WSError::WS_ERROR_NULLPTR;
}
return sessionStage_->NotifyFindFocusedElementInfo(elementId, focusType, baseParent, info);
}
WSError WindowEventChannel::TransferFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info)
{
if (!sessionStage_) {
WLOGFE("session stage is null!");
return WSError::WS_ERROR_NULLPTR;
}
return sessionStage_->NotifyFocusMoveSearch(elementId, direction, baseParent, info);
}
WSError WindowEventChannel::TransferExecuteAction(int64_t elementId,
const std::map<std::string, std::string>& actionArguments, int32_t action,
int64_t baseParent)
{
if (!sessionStage_) {
WLOGFE("session stage is null!");
return WSError::WS_ERROR_NULLPTR;
}
return sessionStage_->NotifyExecuteAction(elementId, actionArguments, action, baseParent);
}
WSError WindowEventChannel::TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType,
int32_t eventType, int64_t timeMs)
{
if (!sessionStage_) {
WLOGFE("session stage is null!");
TLOGE(WmsLogTag::WMS_UIEXT, "session stage is null.");
return WSError::WS_ERROR_NULLPTR;
}
return sessionStage_->NotifyAccessibilityHoverEvent(pointX, pointY, sourceType, eventType, timeMs);
}
WSError WindowEventChannel::TransferAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId)
{
if (!sessionStage_) {
TLOGE(WmsLogTag::WMS_UIEXT, "session stage is null.");
return WSError::WS_ERROR_NULLPTR;
}
return sessionStage_->NotifyAccessibilityChildTreeRegister(windowId, treeId, accessibilityId);
}
WSError WindowEventChannel::TransferAccessibilityChildTreeUnregister()
{
if (!sessionStage_) {
TLOGE(WmsLogTag::WMS_UIEXT, "session stage is null.");
return WSError::WS_ERROR_NULLPTR;
}
return sessionStage_->NotifyAccessibilityChildTreeUnregister();
}
WSError WindowEventChannel::TransferAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info)
{
#ifdef ACCESSIBILITY_DUMP_FOR_TEST
if (!sessionStage_) {
TLOGE(WmsLogTag::WMS_UIEXT, "session stage is null.");
return WSError::WS_ERROR_NULLPTR;
}
return sessionStage_->NotifyAccessibilityDumpChildInfo(params, info);
#else
info.emplace_back("not support in user build variant");
return WSError::WS_OK;
#endif
}
} // namespace OHOS::Rosen

View File

@ -30,7 +30,6 @@
namespace OHOS::Rosen {
namespace {
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowEventChannelProxy"};
constexpr int64_t MAX_COUNT = 210 * 9 * 9 * 100000000000;
}
WSError WindowEventChannelProxy::TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent)
@ -214,209 +213,6 @@ WSError WindowEventChannelProxy::TransferFocusState(bool focusState)
return static_cast<WSError>(ret);
}
WSError GetElementInfos(MessageParcel& reply, std::list<Accessibility::AccessibilityElementInfo>& infos)
{
int64_t count = 0;
if (!reply.ReadInt64(count)) {
WLOGFE("GetElementInfos failed to read count");
return WSError::WS_ERROR_IPC_FAILED;
}
if (count > MAX_COUNT) {
WLOGFE("GetElementInfos count over size");
return WSError::WS_ERROR_IPC_FAILED;
}
infos.clear();
for (int i = 0; i < count; i++) {
sptr<Accessibility::AccessibilityElementInfoParcel> infoPtr =
reply.ReadStrongParcelable<Accessibility::AccessibilityElementInfoParcel>();
if (infoPtr != nullptr) {
infos.push_back(*infoPtr);
}
}
return WSError::WS_OK;
}
WSError WindowEventChannelProxy::TransferSearchElementInfo(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos)
{
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(GetDescriptor())) {
WLOGFE("WriteInterfaceToken failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(elementId)) {
WLOGFE("Write elementId failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt32(mode)) {
WLOGFE("Write mode failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(baseParent)) {
WLOGFE("Write baseParent failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (Remote()->SendRequest(static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_SEARCH_ELEMENT_INFO),
data, reply, option) != ERR_NONE) {
WLOGFE("SendRequest failed");
return WSError::WS_ERROR_IPC_FAILED;
}
return GetElementInfos(reply, infos);
}
WSError WindowEventChannelProxy::TransferSearchElementInfosByText(int64_t elementId, const std::string& text,
int64_t baseParent, std::list<Accessibility::AccessibilityElementInfo>& infos)
{
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(GetDescriptor())) {
WLOGFE("WriteInterfaceToken failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(elementId)) {
WLOGFE("Write elementId failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteString(text)) {
WLOGFE("Write text failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(baseParent)) {
WLOGFE("Write baseParent failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (Remote()->SendRequest(
static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_SEARCH_ELEMENT_INFO_BY_TEXT), data, reply,
option) != ERR_NONE) {
WLOGFE("SendRequest failed");
return WSError::WS_ERROR_IPC_FAILED;
}
return GetElementInfos(reply, infos);
}
WSError GetElementInfo(MessageParcel& reply, Accessibility::AccessibilityElementInfo& info)
{
sptr<Accessibility::AccessibilityElementInfoParcel> infoPtr =
reply.ReadStrongParcelable<Accessibility::AccessibilityElementInfoParcel>();
if (infoPtr != nullptr) {
info = *infoPtr;
}
return WSError::WS_OK;
}
WSError WindowEventChannelProxy::TransferFindFocusedElementInfo(int64_t elementId, int32_t focusType,
int64_t baseParent, Accessibility::AccessibilityElementInfo& info)
{
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(GetDescriptor())) {
WLOGFE("WriteInterfaceToken failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(elementId)) {
WLOGFE("Write elementId failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt32(focusType)) {
WLOGFE("Write focusType failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(baseParent)) {
WLOGFE("Write baseParent failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (Remote()->SendRequest(
static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_FIND_FOCUSED_ELEMENT_INFO), data, reply,
option) != ERR_NONE) {
WLOGFE("SendRequest failed");
return WSError::WS_ERROR_IPC_FAILED;
}
return GetElementInfo(reply, info);
}
WSError WindowEventChannelProxy::TransferFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info)
{
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(GetDescriptor())) {
WLOGFE("WriteInterfaceToken failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(elementId)) {
WLOGFE("Write elementId failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt32(direction)) {
WLOGFE("Write direction failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(baseParent)) {
WLOGFE("Write baseParent failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (Remote()->SendRequest(static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_FOCUS_MOVE_SEARCH),
data, reply, option) != ERR_NONE) {
WLOGFE("SendRequest failed");
return WSError::WS_ERROR_IPC_FAILED;
}
return GetElementInfo(reply, info);
}
WSError WindowEventChannelProxy::TransferExecuteAction(int64_t elementId,
const std::map<std::string, std::string>& actionArguments, int32_t action,
int64_t baseParent)
{
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
if (!data.WriteInterfaceToken(GetDescriptor())) {
WLOGFE("WriteInterfaceToken failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(elementId)) {
WLOGFE("Write elementId failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt32(action)) {
WLOGFE("Write action failed");
return WSError::WS_ERROR_IPC_FAILED;
}
std::vector<std::string> actionArgumentsKey {};
std::vector<std::string> actionArgumentsValue {};
for (auto iter = actionArguments.begin(); iter != actionArguments.end(); iter++) {
actionArgumentsKey.push_back(iter->first);
actionArgumentsValue.push_back(iter->second);
}
if (!data.WriteStringVector(actionArgumentsKey)) {
WLOGFE("actionArgumentsKey write error");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteStringVector(actionArgumentsValue)) {
WLOGFE("actionArgumentsValue write error");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(baseParent)) {
WLOGFE("Write baseParent failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (Remote()->SendRequest(static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_EXECUTE_ACTION),
data, reply, option) != ERR_NONE) {
WLOGFE("SendRequest failed");
return WSError::WS_ERROR_IPC_FAILED;
}
int32_t ret = reply.ReadInt32();
return static_cast<WSError>(ret);
}
WSError WindowEventChannelProxy::TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType,
int32_t eventType, int64_t timeMs)
{
@ -424,7 +220,7 @@ WSError WindowEventChannelProxy::TransferAccessibilityHoverEvent(float pointX, f
MessageParcel reply;
MessageOption option(MessageOption::TF_ASYNC);
if (!data.WriteInterfaceToken(GetDescriptor())) {
WLOGFE("WriteInterfaceToken failed");
TLOGE(WmsLogTag::WMS_UIEXT, "WriteInterfaceToken failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteFloat(pointX) ||
@ -432,13 +228,96 @@ WSError WindowEventChannelProxy::TransferAccessibilityHoverEvent(float pointX, f
!data.WriteInt32(sourceType) ||
!data.WriteInt32(eventType) ||
!data.WriteInt64(timeMs)) {
WLOGFE("Write TransferAccessibilityHoverEvent data failed");
TLOGE(WmsLogTag::WMS_UIEXT, "Write TransferAccessibilityHoverEvent data failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (Remote()->SendRequest(
static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_HOVER_EVENT),
data, reply, option) != ERR_NONE) {
WLOGFE("SendRequest failed");
TLOGE(WmsLogTag::WMS_UIEXT, "SendRequest failed");
return WSError::WS_ERROR_IPC_FAILED;
}
int32_t ret = reply.ReadInt32();
return static_cast<WSError>(ret);
}
WSError WindowEventChannelProxy::TransferAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId)
{
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_ASYNC);
if (!data.WriteInterfaceToken(GetDescriptor())) {
TLOGE(WmsLogTag::WMS_UIEXT, "WriteInterfaceToken failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteUint32(windowId)) {
TLOGE(WmsLogTag::WMS_UIEXT, "write windowId fail, action error");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt32(treeId)) {
TLOGE(WmsLogTag::WMS_UIEXT, "write treeId fail, action error");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt64(accessibilityId)) {
TLOGE(WmsLogTag::WMS_UIEXT, "write accessibilityId fail, action error");
return WSError::WS_ERROR_IPC_FAILED;
}
int error = Remote()->SendRequest(
static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_CHILD_TREE_REGISTER),
data, reply, option);
if (error != ERR_OK) {
TLOGE(WmsLogTag::WMS_UIEXT, "failed to SendRequest: %{public}d", error);
return WSError::WS_ERROR_IPC_FAILED;
}
int32_t ret = reply.ReadInt32();
return static_cast<WSError>(ret);
}
WSError WindowEventChannelProxy::TransferAccessibilityChildTreeUnregister()
{
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_ASYNC);
if (!data.WriteInterfaceToken(GetDescriptor())) {
TLOGE(WmsLogTag::WMS_UIEXT, "WriteInterfaceToken failed");
return WSError::WS_ERROR_IPC_FAILED;
}
int error = Remote()->SendRequest(
static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_CHILD_TREE_UNREGISTER),
data, reply, option);
if (error != ERR_OK) {
TLOGE(WmsLogTag::WMS_UIEXT, "failed to SendRequest: %{public}d", error);
return WSError::WS_ERROR_IPC_FAILED;
}
int32_t ret = reply.ReadInt32();
return static_cast<WSError>(ret);
}
WSError WindowEventChannelProxy::TransferAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info)
{
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (!data.WriteInterfaceToken(GetDescriptor())) {
TLOGE(WmsLogTag::WMS_UIEXT, "WriteInterfaceToken failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteStringVector(params)) {
TLOGE(WmsLogTag::WMS_UIEXT, "failed to write params");
return WSError::WS_ERROR_IPC_FAILED;
}
int error = Remote()->SendRequest(
static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_DUMP_CHILD_INFO),
data, reply, option);
if (error != ERR_OK) {
TLOGE(WmsLogTag::WMS_UIEXT, "failed to SendRequest: %{public}d", error);
return WSError::WS_ERROR_IPC_FAILED;
}
if (!reply.ReadStringVector(&info)) {
TLOGE(WmsLogTag::WMS_UIEXT, "%{public}s, Read reply info failed.", __func__);
return WSError::WS_ERROR_IPC_FAILED;
}
int32_t ret = reply.ReadInt32();

View File

@ -28,7 +28,6 @@
namespace OHOS::Rosen {
namespace {
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowEventChannelStub"};
constexpr int32_t MAX_ARGUMENTS_KEY_SIZE = 1000;
}
int WindowEventChannelStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
@ -53,18 +52,14 @@ int WindowEventChannelStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
return HandleTransferFocusStateEvent(data, reply);
case static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_BACKPRESSED_EVENT):
return HandleTransferBackpressedEvent(data, reply);
case static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_SEARCH_ELEMENT_INFO):
return HandleTransferSearchElementInfo(data, reply);
case static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_SEARCH_ELEMENT_INFO_BY_TEXT):
return HandleTransferSearchElementInfosByText(data, reply);
case static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_FIND_FOCUSED_ELEMENT_INFO):
return HandleTransferFindFocusedElementInfo(data, reply);
case static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_FOCUS_MOVE_SEARCH):
return HandleTransferFocusMoveSearch(data, reply);
case static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_EXECUTE_ACTION):
return HandleTransferExecuteAction(data, reply);
case static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_HOVER_EVENT):
return HandleTransferAccessibilityHoverEvent(data, reply);
case static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_CHILD_TREE_REGISTER):
return HandleTransferAccessibilityChildTreeRegister(data, reply);
case static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_CHILD_TREE_UNREGISTER):
return HandleTransferAccessibilityChildTreeUnregister(data, reply);
case static_cast<uint32_t>(WindowEventInterfaceCode::TRANS_ID_TRANSFER_ACCESSIBILITY_DUMP_CHILD_INFO):
return HandleTransferAccessibilityDumpChildInfo(data, reply);
default:
WLOGFE("Failed to find function handler!");
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
@ -163,188 +158,6 @@ int WindowEventChannelStub::HandleTransferFocusStateEvent(MessageParcel& data, M
return ERR_NONE;
}
int WindowEventChannelStub::HandleTransferSearchElementInfo(MessageParcel& data, MessageParcel& reply)
{
int64_t elementId = 0;
if (!data.ReadInt64(elementId)) {
WLOGFE("Parameter elementId is invalid!");
return ERR_INVALID_DATA;
}
int32_t mode = 0;
if (!data.ReadInt32(mode)) {
WLOGFE("Parameter mode is invalid!");
return ERR_INVALID_DATA;
}
int64_t baseParent = 0;
if (!data.ReadInt64(baseParent)) {
WLOGFE("Parameter baseParent is invalid!");
return ERR_INVALID_DATA;
}
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError errCode = TransferSearchElementInfo(elementId, mode, baseParent, infos);
if (errCode != WSError::WS_OK) {
WLOGFE("Failed to TransferSearchElementInfo:%{public}d", static_cast<int32_t>(errCode));
return static_cast<int32_t>(errCode);
}
int64_t count = static_cast<int64_t>(infos.size());
if (!reply.WriteInt64(count)) {
WLOGFE("Failed to write count!");
return ERR_INVALID_DATA;
}
for (auto &info : infos) {
Accessibility::AccessibilityElementInfoParcel infoParcel(info);
if (!reply.WriteParcelable(&infoParcel)) {
WLOGFE("Failed to WriteParcelable info");
return ERR_INVALID_DATA;
}
}
return ERR_NONE;
}
int WindowEventChannelStub::HandleTransferSearchElementInfosByText(MessageParcel& data, MessageParcel& reply)
{
int64_t elementId = 0;
if (!data.ReadInt64(elementId)) {
WLOGFE("Parameter elementId is invalid!");
return ERR_INVALID_DATA;
}
std::string text;
if (!data.ReadString(text)) {
WLOGFE("Parameter text is invalid!");
return ERR_INVALID_DATA;
}
int64_t baseParent = 0;
if (!data.ReadInt64(baseParent)) {
WLOGFE("Parameter baseParent is invalid!");
return ERR_INVALID_DATA;
}
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError errCode = TransferSearchElementInfosByText(elementId, text, baseParent, infos);
if (errCode != WSError::WS_OK) {
WLOGFE("Failed to HandleTransferSearchElementInfosByText:%{public}d", static_cast<int32_t>(errCode));
return static_cast<int32_t>(errCode);
}
int64_t count = static_cast<int64_t>(infos.size());
if (!reply.WriteInt64(count)) {
WLOGFE("Failed to write count!");
return ERR_INVALID_DATA;
}
for (auto &info : infos) {
Accessibility::AccessibilityElementInfoParcel infoParcel(info);
if (!reply.WriteParcelable(&infoParcel)) {
WLOGFE("Failed to WriteParcelable info");
return ERR_INVALID_DATA;
}
}
return ERR_NONE;
}
int WindowEventChannelStub::HandleTransferFindFocusedElementInfo(MessageParcel& data, MessageParcel& reply)
{
int64_t elementId = 0;
if (!data.ReadInt64(elementId)) {
WLOGFE("Parameter elementId is invalid!");
return ERR_INVALID_DATA;
}
int32_t focusType = 0;
if (!data.ReadInt32(focusType)) {
WLOGFE("Parameter focusType is invalid!");
return ERR_INVALID_DATA;
}
int64_t baseParent = 0;
if (!data.ReadInt64(baseParent)) {
WLOGFE("Parameter baseParent is invalid!");
return ERR_INVALID_DATA;
}
Accessibility::AccessibilityElementInfo info;
WSError errCode = TransferFindFocusedElementInfo(elementId, focusType, baseParent, info);
if (errCode != WSError::WS_OK) {
WLOGFE("Failed to TransferFindFocusedElementInfo:%{public}d", static_cast<int32_t>(errCode));
return static_cast<int32_t>(errCode);
}
Accessibility::AccessibilityElementInfoParcel infoParcel(info);
if (!reply.WriteParcelable(&infoParcel)) {
WLOGFE("Failed to WriteParcelable info");
return ERR_INVALID_DATA;
}
return ERR_NONE;
}
int WindowEventChannelStub::HandleTransferFocusMoveSearch(MessageParcel& data, MessageParcel& reply)
{
int64_t elementId = 0;
if (!data.ReadInt64(elementId)) {
WLOGFE("Parameter elementId is invalid!");
return ERR_INVALID_DATA;
}
int32_t direction = 0;
if (!data.ReadInt32(direction)) {
WLOGFE("Parameter direction is invalid!");
return ERR_INVALID_DATA;
}
int64_t baseParent = 0;
if (!data.ReadInt64(baseParent)) {
WLOGFE("Parameter baseParent is invalid!");
return ERR_INVALID_DATA;
}
Accessibility::AccessibilityElementInfo info;
WSError errCode = TransferFocusMoveSearch(elementId, direction, baseParent, info);
if (errCode != WSError::WS_OK) {
WLOGFE("Failed to TransferFocusMoveSearch:%{public}d", static_cast<int32_t>(errCode));
return static_cast<int32_t>(errCode);
}
Accessibility::AccessibilityElementInfoParcel infoParcel(info);
if (!reply.WriteParcelable(&infoParcel)) {
WLOGFE("Failed to WriteParcelable info");
return ERR_INVALID_DATA;
}
return ERR_NONE;
}
int WindowEventChannelStub::HandleTransferExecuteAction(MessageParcel& data, MessageParcel& reply)
{
int64_t elementId = 0;
if (!data.ReadInt64(elementId)) {
WLOGFE("Parameter elementId is invalid!");
return ERR_INVALID_DATA;
}
int32_t action = 0;
if (!data.ReadInt32(action)) {
WLOGFE("Parameter action is invalid!");
return ERR_INVALID_DATA;
}
std::vector<std::string> actionArgumentsKey;
std::vector<std::string> actionArgumentsValue;
std::map<std::string, std::string> actionArguments;
if (!data.ReadStringVector(&actionArgumentsKey)) {
WLOGFE("ReadStringVector actionArgumentsKey failed");
return ERR_INVALID_VALUE;
}
if (!data.ReadStringVector(&actionArgumentsValue)) {
WLOGFE("ReadStringVector actionArgumentsValue failed");
return ERR_INVALID_VALUE;
}
if (actionArgumentsKey.size() != actionArgumentsValue.size()) {
WLOGFE("Read actionArguments failed.");
return ERR_INVALID_VALUE;
}
if (actionArgumentsKey.size() > MAX_ARGUMENTS_KEY_SIZE) {
WLOGFE("ActionArguments over max size");
return ERR_INVALID_VALUE;
}
for (size_t i = 0; i < actionArgumentsKey.size(); i++) {
actionArguments.insert(make_pair(actionArgumentsKey[i], actionArgumentsValue[i]));
}
int64_t baseParent = 0;
if (!data.ReadInt64(baseParent)) {
WLOGFE("Parameter baseParent is invalid!");
return ERR_INVALID_DATA;
}
WSError errCode = TransferExecuteAction(elementId, actionArguments, action, baseParent);
reply.WriteInt32(static_cast<int32_t>(errCode));
return ERR_NONE;
}
int WindowEventChannelStub::HandleTransferAccessibilityHoverEvent(MessageParcel& data, MessageParcel& reply)
{
float pointX = 0;
@ -364,4 +177,41 @@ int WindowEventChannelStub::HandleTransferAccessibilityHoverEvent(MessageParcel&
reply.WriteInt32(static_cast<int32_t>(errCode));
return ERR_NONE;
}
int32_t WindowEventChannelStub::HandleTransferAccessibilityChildTreeRegister(MessageParcel &data, MessageParcel &reply)
{
uint32_t windowId = 0;
int32_t treeId = -1;
int64_t accessibilityId = -1;
if (!data.ReadUint32(windowId) ||
!data.ReadInt32(treeId) ||
!data.ReadInt64(accessibilityId)) {
TLOGE(WmsLogTag::WMS_UIEXT, "Read HandleTransferAccessibilityChildTreeRegister data failed!");
return ERR_INVALID_DATA;
}
WSError errCode = TransferAccessibilityChildTreeRegister(windowId, treeId, accessibilityId);
reply.WriteInt32(static_cast<int32_t>(errCode));
return ERR_NONE;
}
int32_t WindowEventChannelStub::HandleTransferAccessibilityChildTreeUnregister(
MessageParcel &data, MessageParcel &reply)
{
WSError errCode = TransferAccessibilityChildTreeUnregister();
reply.WriteInt32(static_cast<int32_t>(errCode));
return ERR_NONE;
}
int32_t WindowEventChannelStub::HandleTransferAccessibilityDumpChildInfo(MessageParcel &data, MessageParcel &reply)
{
std::vector<std::string> params;
if (!data.ReadStringVector(&params)) {
TLOGE(WmsLogTag::WMS_UIEXT, "Read HandleTransferAccessibilityDumpChildInfo data failed!");
return ERR_INVALID_VALUE;
}
std::vector<std::string> info;
TransferAccessibilityDumpChildInfo(params, info);
reply.WriteStringVector(info);
return ERR_NONE;
}
}

View File

@ -91,6 +91,11 @@ public:
AAFwk::WantParams& reWantParams);
WSError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info,
int64_t uiExtensionIdLevel) override;
WSError TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType,
int64_t timeMs);
WSError TransferAccessibilityChildTreeRegister(uint32_t windowId, int32_t treeId, int64_t accessibilityId);
WSError TransferAccessibilityChildTreeUnregister();
WSError TransferAccessibilityDumpChildInfo(const std::vector<std::string>& params, std::vector<std::string>& info);
void NotifySyncOn() override;
void NotifyAsyncOn() override;
WSError NotifyDensityFollowHost(bool isFollowHost, float densityValue = 1.0f);

View File

@ -150,19 +150,6 @@ public:
bool needNotifyClient = true);
virtual WSError TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent);
virtual WSError TransferSearchElementInfo(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos);
virtual WSError TransferSearchElementInfosByText(int64_t elementId, const std::string& text, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos);
virtual WSError TransferFindFocusedElementInfo(int64_t elementId, int32_t focusType, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info);
virtual WSError TransferFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info);
virtual WSError TransferExecuteAction(int64_t elementId, const std::map<std::string, std::string>& actionArguments,
int32_t action, int64_t baseParent);
WSError TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType,
int64_t timeMs);
virtual WSError NotifyClientToUpdateRect(std::shared_ptr<RSTransaction> rsTransaction) { return WSError::WS_OK; }
WSError TransferBackPressedEventForConsumed(bool& isConsumed);
WSError TransferKeyEventForConsumed(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool& isConsumed,

View File

@ -370,6 +370,45 @@ WSError ExtensionSession::TransferAccessibilityEvent(const Accessibility::Access
return WSError::WS_OK;
}
WSError ExtensionSession::TransferAccessibilityHoverEvent(
float pointX, float pointY, int32_t sourceType, int32_t eventType, int64_t timeMs)
{
if (!windowEventChannel_) {
TLOGE(WmsLogTag::WMS_UIEXT, "windowEventChannel_ is null");
return WSError::WS_ERROR_NULLPTR;
}
return windowEventChannel_->TransferAccessibilityHoverEvent(pointX, pointY, sourceType, eventType, timeMs);
}
WSError ExtensionSession::TransferAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId)
{
if (!windowEventChannel_) {
TLOGE(WmsLogTag::WMS_UIEXT, "windowEventChannel_ is null");
return WSError::WS_ERROR_NULLPTR;
}
return windowEventChannel_->TransferAccessibilityChildTreeRegister(windowId, treeId, accessibilityId);
}
WSError ExtensionSession::TransferAccessibilityChildTreeUnregister()
{
if (!windowEventChannel_) {
TLOGE(WmsLogTag::WMS_UIEXT, "windowEventChannel_ is null");
return WSError::WS_ERROR_NULLPTR;
}
return windowEventChannel_->TransferAccessibilityChildTreeUnregister();
}
WSError ExtensionSession::TransferAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info)
{
if (!windowEventChannel_) {
TLOGE(WmsLogTag::WMS_UIEXT, "windowEventChannel_ is null");
return WSError::WS_ERROR_NULLPTR;
}
return windowEventChannel_->TransferAccessibilityDumpChildInfo(params, info);
}
WSError ExtensionSession::UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type)
{
if (!IsSessionValid()) {

View File

@ -2747,66 +2747,6 @@ Rotation Session::GetRotation() const
return rotation_;
}
WSError Session::TransferSearchElementInfo(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos)
{
if (!windowEventChannel_) {
WLOGFE("windowEventChannel_ is null");
return WSError::WS_ERROR_NULLPTR;
}
return windowEventChannel_->TransferSearchElementInfo(elementId, mode, baseParent, infos);
}
WSError Session::TransferSearchElementInfosByText(int64_t elementId, const std::string& text, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos)
{
if (!windowEventChannel_) {
WLOGFE("windowEventChannel_ is null");
return WSError::WS_ERROR_NULLPTR;
}
return windowEventChannel_->TransferSearchElementInfosByText(elementId, text, baseParent, infos);
}
WSError Session::TransferFindFocusedElementInfo(int64_t elementId, int32_t focusType, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info)
{
if (!windowEventChannel_) {
WLOGFE("windowEventChannel_ is null");
return WSError::WS_ERROR_NULLPTR;
}
return windowEventChannel_->TransferFindFocusedElementInfo(elementId, focusType, baseParent, info);
}
WSError Session::TransferFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info)
{
if (!windowEventChannel_) {
WLOGFE("windowEventChannel_ is null");
return WSError::WS_ERROR_NULLPTR;
}
return windowEventChannel_->TransferFocusMoveSearch(elementId, direction, baseParent, info);
}
WSError Session::TransferExecuteAction(int64_t elementId, const std::map<std::string, std::string>& actionArguments,
int32_t action, int64_t baseParent)
{
if (!windowEventChannel_) {
WLOGFE("windowEventChannel_ is null");
return WSError::WS_ERROR_NULLPTR;
}
return windowEventChannel_->TransferExecuteAction(elementId, actionArguments, action, baseParent);
}
WSError Session::TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType,
int64_t timeMs)
{
if (!windowEventChannel_) {
WLOGFE("windowEventChannel_ is null");
return WSError::WS_ERROR_NULLPTR;
}
return windowEventChannel_->TransferAccessibilityHoverEvent(pointX, pointY, sourceType, eventType, timeMs);
}
void Session::SetSessionInfoLockedStateChangeListener(const NotifySessionInfoLockedStateChangeFunc& func)
{
sessionInfoLockedStateChangeFunc_ = func;

View File

@ -39,7 +39,6 @@ namespace OHOS {
namespace Rosen {
namespace {
const std::string UNDEFINED = "undefined";
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowSessionTest"};
}
class WindowSessionTest : public testing::Test {
@ -48,12 +47,6 @@ public:
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
WSError TransferSearchElementInfo(bool isChannelNull);
WSError TransferSearchElementInfosByText(bool isChannelNull);
WSError TransferFindFocusedElementInfo(bool isChannelNull);
WSError TransferFocusMoveSearch(bool isChannelNull);
WSError TransferExecuteAction(bool isChannelNull);
int32_t GetTaskCount();
sptr<SceneSessionManager> ssm_;
@ -105,77 +98,6 @@ RSSurfaceNode::SharedPtr WindowSessionTest::CreateRSSurfaceNode()
return surfaceNode;
}
WSError WindowSessionTest::TransferSearchElementInfo(bool isChannelNull)
{
int64_t elementId = 0;
int32_t mode = 0;
int64_t baseParent = 0;
std::list<Accessibility::AccessibilityElementInfo> infos;
if (isChannelNull) {
return session_->TransferSearchElementInfo(elementId, mode, baseParent, infos);
} else {
session_->windowEventChannel_ = new TestWindowEventChannel();
return session_->TransferSearchElementInfo(elementId, mode, baseParent, infos);
}
}
WSError WindowSessionTest::TransferSearchElementInfosByText(bool isChannelNull)
{
int64_t elementId = 0;
std::string text;
int64_t baseParent = 0;
std::list<Accessibility::AccessibilityElementInfo> infos;
if (isChannelNull) {
return session_->TransferSearchElementInfosByText(elementId, text, baseParent, infos);
} else {
session_->windowEventChannel_ = new TestWindowEventChannel();
return session_->TransferSearchElementInfosByText(elementId, text, baseParent, infos);
}
}
WSError WindowSessionTest::TransferFindFocusedElementInfo(bool isChannelNull)
{
int64_t elementId = 0;
int32_t focusType = 0;
int64_t baseParent = 0;
Accessibility::AccessibilityElementInfo info;
if (isChannelNull) {
return session_->TransferFindFocusedElementInfo(elementId, focusType, baseParent, info);
} else {
session_->windowEventChannel_ = new TestWindowEventChannel();
return session_->TransferFindFocusedElementInfo(elementId, focusType, baseParent, info);
}
}
WSError WindowSessionTest::TransferFocusMoveSearch(bool isChannelNull)
{
int64_t elementId = 0;
int32_t direction = 0;
int64_t baseParent = 0;
Accessibility::AccessibilityElementInfo info;
if (isChannelNull) {
return session_->TransferFocusMoveSearch(elementId, direction, baseParent, info);
} else {
session_->windowEventChannel_ = new TestWindowEventChannel();
return session_->TransferFocusMoveSearch(elementId, direction, baseParent, info);
}
}
WSError WindowSessionTest::TransferExecuteAction(bool isChannelNull)
{
int64_t elementId = 0;
std::map<std::string, std::string> actionArguments;
int32_t action = 0;
int64_t baseParent = 0;
if (isChannelNull) {
return session_->TransferExecuteAction(elementId, actionArguments, action, baseParent);
} else {
session_->windowEventChannel_ = new TestWindowEventChannel();
return session_->TransferExecuteAction(elementId, actionArguments, action, baseParent);
}
}
int32_t WindowSessionTest::GetTaskCount()
{
std::string dumpInfo = session_->handler_->GetEventRunner()->GetEventQueue()->DumpCurrentQueueSize();
@ -190,136 +112,6 @@ int32_t WindowSessionTest::GetTaskCount()
}
namespace {
/**
* @tc.name: TransferSearchElementInfo01
* @tc.desc: windowEventChannel_ is not nullptr
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, TransferSearchElementInfo01, Function | SmallTest | Level2)
{
WLOGFI("TransferSearchElementInfo01 begin!");
ASSERT_NE(session_, nullptr);
ASSERT_EQ(WSError::WS_OK, TransferSearchElementInfo(false));
WLOGFI("TransferSearchElementInfo01 end!");
}
/**
* @tc.name: TransferSearchElementInfo02
* @tc.desc: windowEventChannel_ is nullptr
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, TransferSearchElementInfo02, Function | SmallTest | Level2)
{
WLOGFI("TransferSearchElementInfo02 begin!");
ASSERT_NE(session_, nullptr);
ASSERT_EQ(WSError::WS_ERROR_NULLPTR, TransferSearchElementInfo(true));
WLOGFI("TransferSearchElementInfo02 end!");
}
/**
* @tc.name: TransferSearchElementInfosByText01
* @tc.desc: windowEventChannel_ is not nullptr
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, TransferSearchElementInfosByText01, Function | SmallTest | Level2)
{
WLOGFI("TransferSearchElementInfosByText01 begin!");
ASSERT_NE(session_, nullptr);
ASSERT_EQ(WSError::WS_OK, TransferSearchElementInfosByText(false));
WLOGFI("TransferSearchElementInfosByText01 end!");
}
/**
* @tc.name: TransferSearchElementInfosByText02
* @tc.desc: windowEventChannel_ is nullptr
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, TransferSearchElementInfosByText02, Function | SmallTest | Level2)
{
WLOGFI("TransferSearchElementInfosByText02 begin!");
ASSERT_NE(session_, nullptr);
ASSERT_EQ(WSError::WS_ERROR_NULLPTR, TransferSearchElementInfosByText(true));
WLOGFI("TransferSearchElementInfosByText02 end!");
}
/**
* @tc.name: TransferFindFocusedElementInfo01
* @tc.desc: windowEventChannel_ is not nullptr
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, TransferFindFocusedElementInfo01, Function | SmallTest | Level2)
{
WLOGFI("TransferFindFocusedElementInfo01 begin!");
ASSERT_NE(session_, nullptr);
ASSERT_EQ(WSError::WS_OK, TransferFindFocusedElementInfo(false));
WLOGFI("TransferFindFocusedElementInfo01 end!");
}
/**
* @tc.name: TransferFindFocusedElementInfo02
* @tc.desc: windowEventChannel_ is nullptr
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, TransferFindFocusedElementInfo02, Function | SmallTest | Level2)
{
WLOGFI("TransferFindFocusedElementInfo02 begin!");
ASSERT_NE(session_, nullptr);
ASSERT_EQ(WSError::WS_ERROR_NULLPTR, TransferFindFocusedElementInfo(true));
WLOGFI("TransferFindFocusedElementInfo02 end!");
}
/**
* @tc.name: TransferFocusMoveSearch01
* @tc.desc: windowEventChannel_ is not nullptr
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, TransferFocusMoveSearch01, Function | SmallTest | Level2)
{
WLOGFI("TransferFocusMoveSearch01 begin!");
ASSERT_NE(session_, nullptr);
ASSERT_EQ(WSError::WS_OK, TransferFocusMoveSearch(false));
WLOGFI("TransferFocusMoveSearch01 end!");
}
/**
* @tc.name: TransferFocusMoveSearch02
* @tc.desc: windowEventChannel_ is nullptr
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, TransferFocusMoveSearch02, Function | SmallTest | Level2)
{
WLOGFI("TransferFocusMoveSearch02 begin!");
ASSERT_NE(session_, nullptr);
ASSERT_EQ(WSError::WS_ERROR_NULLPTR, TransferFocusMoveSearch(true));
WLOGFI("TransferFocusMoveSearch02 end!");
}
/**
* @tc.name: TransferExecuteAction01
* @tc.desc: windowEventChannel_ is not nullptr
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, TransferExecuteAction01, Function | SmallTest | Level2)
{
WLOGFI("TransferExecuteAction01 begin!");
ASSERT_NE(session_, nullptr);
ASSERT_EQ(WSError::WS_OK, TransferExecuteAction(false));
WLOGFI("TransferExecuteAction01 end!");
}
/**
* @tc.name: TransferExecuteAction02
* @tc.desc: windowEventChannel_ is nullptr
* @tc.type: FUNC
*/
HWTEST_F(WindowSessionTest, TransferExecuteAction02, Function | SmallTest | Level2)
{
WLOGFI("TransferExecuteAction02 begin!");
ASSERT_NE(session_, nullptr);
ASSERT_EQ(WSError::WS_ERROR_NULLPTR, TransferExecuteAction(true));
WLOGFI("TransferExecuteAction02 end!");
}
/**
* @tc.name: SetForceTouchable
* @tc.desc: SetForceTouchable

View File

@ -1661,7 +1661,6 @@ HWTEST_F(WindowSessionTest2, SetOffset, Function | SmallTest | Level2)
WSRectF bounds;
session_->SetBounds(bounds);
session_->GetBounds();
session_->TransferAccessibilityHoverEvent(50, 100, 50, 50, 500);
session_->UpdateTitleInTargetPos(true, 100);
session_->SetNotifySystemSessionPointerEventFunc(nullptr);
session_->SetNotifySystemSessionKeyEventFunc(nullptr);

View File

@ -37,18 +37,13 @@ public:
const sptr<IRemoteObject>& listener) override;
WSError TransferFocusState(bool focusState) override;
WSError TransferBackpressedEventForConsumed(bool& isConsumed) override;
WSError TransferSearchElementInfo(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos) override;
WSError TransferSearchElementInfosByText(int64_t elementId, const std::string& text, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos) override;
WSError TransferFindFocusedElementInfo(int64_t elementId, int32_t focusType, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info) override;
WSError TransferFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info) override;
WSError TransferExecuteAction(int64_t elementId, const std::map<std::string, std::string>& actionArguments,
int32_t action, int64_t baseParent) override;
WSError TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType,
int64_t timeMs) override;
WSError TransferAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId) override;
WSError TransferAccessibilityChildTreeUnregister() override;
WSError TransferAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info) override;
sptr<IRemoteObject> AsObject() override
{
@ -93,32 +88,19 @@ WSError TestWindowEventChannel::TransferBackpressedEventForConsumed(bool& isCons
return WSError::WS_OK;
}
WSError TestWindowEventChannel::TransferSearchElementInfo(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos)
WSError TestWindowEventChannel::TransferAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId)
{
return WSError::WS_OK;
}
WSError TestWindowEventChannel::TransferSearchElementInfosByText(int64_t elementId, const std::string& text,
int64_t baseParent, std::list<Accessibility::AccessibilityElementInfo>& infos)
WSError TestWindowEventChannel::TransferAccessibilityChildTreeUnregister()
{
return WSError::WS_OK;
}
WSError TestWindowEventChannel::TransferFindFocusedElementInfo(int64_t elementId, int32_t focusType, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info)
{
return WSError::WS_OK;
}
WSError TestWindowEventChannel::TransferFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info)
{
return WSError::WS_OK;
}
WSError TestWindowEventChannel::TransferExecuteAction(int64_t elementId,
const std::map<std::string, std::string>& actionArguments, int32_t action, int64_t baseParent)
WSError TestWindowEventChannel::TransferAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info)
{
return WSError::WS_OK;
}

View File

@ -60,431 +60,129 @@ void WindowEventChannelProxyMockTest::TearDown()
namespace {
/**
* @tc.name: TransferSearchElementInfo
* @tc.desc: test function : TransferSearchElementInfo
* @tc.name: TransferAccessibilityChildTreeRegister
* @tc.desc: test function : TransferAccessibilityChildTreeRegister
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferSearchElementInfo, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyMockTest, TransferAccessibilityChildTreeRegister, Function | SmallTest | Level1)
{
WLOGI("TransferSearchElementInfo begin");
WLOGI("TransferAccessibilityChildTreeRegister begin");
MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true);
int64_t elementId = 0;
int32_t mode = 0;
int64_t baseParent = 0;
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError res = windowEventChannelProxy_->TransferSearchElementInfo(elementId, mode, baseParent, infos);
uint32_t windowId = 0;
int32_t treeId = 0;
int64_t accessibilityId = 0;
WSError res = windowEventChannelProxy_->TransferAccessibilityChildTreeRegister(windowId, treeId, accessibilityId);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
MockMessageParcel::ClearAllErrorFlag();
WLOGI("TransferSearchElementInfo end");
WLOGI("TransferAccessibilityChildTreeRegister end");
}
/**
* @tc.name: TransferSearchElementInfo
* @tc.desc: test function : TransferSearchElementInfo
* @tc.name: TransferAccessibilityChildTreeRegister
* @tc.desc: test function : TransferAccessibilityChildTreeRegister
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferSearchElementInfo1, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyMockTest, TransferAccessibilityChildTreeRegister1, Function | SmallTest | Level1)
{
WLOGI("TransferSearchElementInfo1 begin");
int64_t elementId = -1;
int32_t mode = 0;
int64_t baseParent = 0;
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError res = windowEventChannelProxy_->TransferSearchElementInfo(elementId, mode, baseParent, infos);
WLOGI("TransferAccessibilityChildTreeRegister1 begin");
uint32_t windowId = 0;
int32_t treeId = -1;
int64_t accessibilityId = 0;
WSError res = windowEventChannelProxy_->TransferAccessibilityChildTreeRegister(windowId, treeId, accessibilityId);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferSearchElementInfo1 end");
WLOGI("TransferAccessibilityChildTreeRegister1 end");
}
/**
* @tc.name: TransferSearchElementInfo2
* @tc.desc: test function : TransferSearchElementInfo
* @tc.name: TransferAccessibilityChildTreeRegister
* @tc.desc: test function : TransferAccessibilityChildTreeRegister
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferSearchElementInfo2, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyMockTest, TransferAccessibilityChildTreeRegister2, Function | SmallTest | Level1)
{
WLOGI("TransferSearchElementInfo2 begin");
int64_t elementId = 0;
int32_t mode = -1;
int64_t baseParent = 0;
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError res = windowEventChannelProxy_->TransferSearchElementInfo(elementId, mode, baseParent, infos);
WLOGI("TransferAccessibilityChildTreeRegister2 begin");
uint32_t windowId = 0;
int32_t treeId = 0;
int64_t accessibilityId = -1;
WSError res = windowEventChannelProxy_->TransferAccessibilityChildTreeRegister(windowId, treeId, accessibilityId);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferSearchElementInfo2 end");
WLOGI("TransferAccessibilityChildTreeRegister2 end");
}
/**
* @tc.name: TransferSearchElementInfo3
* @tc.desc: test function : TransferSearchElementInfo
* @tc.name: TransferAccessibilityChildTreeUnregister
* @tc.desc: test function : TransferAccessibilityChildTreeUnregister
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferSearchElementInfo3, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyMockTest, TransferAccessibilityChildTreeUnregister, Function | SmallTest | Level1)
{
WLOGI("TransferSearchElementInfo3 begin");
int64_t elementId = 0;
int32_t mode = 0;
int64_t baseParent = -1;
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError res = windowEventChannelProxy_->TransferSearchElementInfo(elementId, mode, baseParent, infos);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferSearchElementInfo3 end");
}
/**
* @tc.name: TransferSearchElementInfo4
* @tc.desc: test function : TransferSearchElementInfo
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferSearchElementInfo4, Function | SmallTest | Level1)
{
WLOGI("TransferSearchElementInfo4 begin");
MockMessageParcel::SetReadInt64ErrorFlag(true);
int64_t elementId = 0;
int32_t mode = 0;
int64_t baseParent = 0;
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError res = windowEventChannelProxy_->TransferSearchElementInfo(elementId, mode, baseParent, infos);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
MockMessageParcel::ClearAllErrorFlag();
WLOGI("TransferSearchElementInfo4 end");
}
/**
* @tc.name: TransferSearchElementInfosByText
* @tc.desc: test function : TransferSearchElementInfosByText
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferSearchElementInfosByText, Function | SmallTest | Level1)
{
WLOGI("TransferSearchElementInfosByText begin");
WLOGI("TransferAccessibilityChildTreeUnregister begin");
MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true);
int64_t elementId = 0;
string text;
int64_t baseParent = 0;
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError res = windowEventChannelProxy_->TransferSearchElementInfosByText(elementId, text, baseParent, infos);
WSError res = windowEventChannelProxy_->TransferAccessibilityChildTreeUnregister();
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
MockMessageParcel::ClearAllErrorFlag();
WLOGI("TransferSearchElementInfosByText end");
WLOGI("TransferAccessibilityChildTreeUnregister end");
}
/**
* @tc.name: TransferSearchElementInfosByText1
* @tc.desc: test function : TransferSearchElementInfosByText
* @tc.name: TransferAccessibilityChildTreeUnregister
* @tc.desc: test function : TransferAccessibilityChildTreeUnregister
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferSearchElementInfosByText1, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyMockTest, TransferAccessibilityChildTreeUnregister1, Function | SmallTest | Level1)
{
WLOGI("TransferSearchElementInfosByText1 begin");
int64_t elementId = -1;
string text;
int64_t baseParent = 0;
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError res = windowEventChannelProxy_->TransferSearchElementInfosByText(elementId, text, baseParent, infos);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferSearchElementInfosByText1 end");
WLOGI("TransferAccessibilityChildTreeUnregister1 begin");
WSError res = windowEventChannelProxy_->TransferAccessibilityChildTreeUnregister();
ASSERT_EQ(WSError::WS_OK, res);
WLOGI("TransferAccessibilityChildTreeUnregister1 end");
}
/**
* @tc.name: TransferSearchElementInfosByText2
* @tc.desc: test function : TransferSearchElementInfosByText
* @tc.name: TransferAccessibilityDumpChildInfo
* @tc.desc: test function : TransferAccessibilityDumpChildInfo
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferSearchElementInfosByText2, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyMockTest, TransferAccessibilityDumpChildInfo, Function | SmallTest | Level1)
{
WLOGI("TransferSearchElementInfosByText2 begin");
int64_t elementId = 0;
string text = "error";
int64_t baseParent = 0;
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError res = windowEventChannelProxy_->TransferSearchElementInfosByText(elementId, text, baseParent, infos);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferSearchElementInfosByText2 end");
}
/**
* @tc.name: TransferSearchElementInfosByText3
* @tc.desc: test function : TransferSearchElementInfosByText
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferSearchElementInfosByText3, Function | SmallTest | Level1)
{
WLOGI("TransferSearchElementInfosByText3 begin");
int64_t elementId = 0;
string text;
int64_t baseParent = -1;
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError res = windowEventChannelProxy_->TransferSearchElementInfosByText(elementId, text, baseParent, infos);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferSearchElementInfosByText3 end");
}
/**
* @tc.name: TransferSearchElementInfosByText4
* @tc.desc: test function : TransferSearchElementInfosByText
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferSearchElementInfosByText4, Function | SmallTest | Level1)
{
WLOGI("TransferSearchElementInfosByText4 begin");
MockMessageParcel::SetReadInt64ErrorFlag(true);
int64_t elementId = 0;
string text;
int64_t baseParent = 0;
std::list<Accessibility::AccessibilityElementInfo> infos;
WSError res = windowEventChannelProxy_->TransferSearchElementInfosByText(elementId, text, baseParent, infos);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
MockMessageParcel::ClearAllErrorFlag();
WLOGI("TransferSearchElementInfosByText4 end");
}
/**
* @tc.name: TransferFindFocusedElementInfo
* @tc.desc: test function : TransferFindFocusedElementInfo
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferFindFocusedElementInfo, Function | SmallTest | Level1)
{
WLOGI("TransferFindFocusedElementInfo begin");
WLOGI("TransferAccessibilityDumpChildInfo begin");
std::vector<std::string> params;
std::vector<std::string> info;
MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true);
int64_t elementId = 0;
int32_t focusType = 0;
int64_t baseParent = 0;
Accessibility::AccessibilityElementInfo info;
WSError res = windowEventChannelProxy_->TransferFindFocusedElementInfo(elementId, focusType, baseParent, info);
WSError res = windowEventChannelProxy_->TransferAccessibilityDumpChildInfo(params, info);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
MockMessageParcel::ClearAllErrorFlag();
WLOGI("TransferFindFocusedElementInfo end");
WLOGI("TransferAccessibilityDumpChildInfo end");
}
/**
* @tc.name: TransferFindFocusedElementInfo1
* @tc.desc: test function : TransferFindFocusedElementInfo
* @tc.name: TransferAccessibilityDumpChildInfo
* @tc.desc: test function : TransferAccessibilityDumpChildInfo
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferFindFocusedElementInfo1, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyMockTest, TransferAccessibilityDumpChildInfo1, Function | SmallTest | Level1)
{
WLOGI("TransferFindFocusedElementInfo1 begin");
int64_t elementId = -1;
int32_t focusType = 0;
int64_t baseParent = 0;
Accessibility::AccessibilityElementInfo info;
WSError res = windowEventChannelProxy_->TransferFindFocusedElementInfo(elementId, focusType, baseParent, info);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferFindFocusedElementInfo1 end");
WLOGI("TransferAccessibilityDumpChildInfo1 begin");
std::vector<std::string> params;
std::vector<std::string> info;
WSError res = windowEventChannelProxy_->TransferAccessibilityDumpChildInfo(params, info);
ASSERT_EQ(WSError::WS_OK, res);
WLOGI("TransferAccessibilityDumpChildInfo1 end");
}
/**
* @tc.name: TransferFindFocusedElementInfo2
* @tc.desc: test function : TransferFindFocusedElementInfo
* @tc.name: TransferAccessibilityDumpChildInfo
* @tc.desc: test function : TransferAccessibilityDumpChildInfo
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferFindFocusedElementInfo2, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyMockTest, TransferAccessibilityDumpChildInfo2, Function | SmallTest | Level1)
{
WLOGI("TransferFindFocusedElementInfo2 begin");
int64_t elementId = 0;
int32_t focusType = -1;
int64_t baseParent = 0;
Accessibility::AccessibilityElementInfo info;
WSError res = windowEventChannelProxy_->TransferFindFocusedElementInfo(elementId, focusType, baseParent, info);
WLOGI("TransferAccessibilityDumpChildInfo2 begin");
std::vector<std::string> params;
params.push_back("test");
std::vector<std::string> info;
WSError res = windowEventChannelProxy_->TransferAccessibilityDumpChildInfo(params, info);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferFindFocusedElementInfo2 end");
}
/**
* @tc.name: TransferFindFocusedElementInfo3
* @tc.desc: test function : TransferFindFocusedElementInfo
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferFindFocusedElementInfo3, Function | SmallTest | Level1)
{
WLOGI("TransferFindFocusedElementInfo3 begin");
int64_t elementId = 0;
int32_t focusType = 0;
int64_t baseParent = -1;
Accessibility::AccessibilityElementInfo info;
WSError res = windowEventChannelProxy_->TransferFindFocusedElementInfo(elementId, focusType, baseParent, info);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferFindFocusedElementInfo3 end");
}
/**
* @tc.name: TransferFocusMoveSearch
* @tc.desc: test function : TransferFocusMoveSearch
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferFocusMoveSearch, Function | SmallTest | Level1)
{
WLOGI("TransferFocusMoveSearch begin");
MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true);
int64_t elementId = 0;
int32_t direction = 0;
int64_t baseParent = 0;
Accessibility::AccessibilityElementInfo info;
WSError res = windowEventChannelProxy_->TransferFocusMoveSearch(elementId, direction, baseParent, info);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
MockMessageParcel::ClearAllErrorFlag();
WLOGI("TransferFocusMoveSearch end");
}
/**
* @tc.name: TransferFocusMoveSearch1
* @tc.desc: test function : TransferFocusMoveSearch
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferFocusMoveSearch1, Function | SmallTest | Level1)
{
WLOGI("TransferFocusMoveSearch1 begin");
int64_t elementId = -1;
int32_t direction = 0;
int64_t baseParent = 0;
Accessibility::AccessibilityElementInfo info;
WSError res = windowEventChannelProxy_->TransferFocusMoveSearch(elementId, direction, baseParent, info);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferFocusMoveSearch1 end");
}
/**
* @tc.name: TransferFocusMoveSearch2
* @tc.desc: test function : TransferFocusMoveSearch
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferFocusMoveSearch2, Function | SmallTest | Level1)
{
WLOGI("TransferFocusMoveSearch2 begin");
int64_t elementId = 0;
int32_t direction = -1;
int64_t baseParent = 0;
Accessibility::AccessibilityElementInfo info;
WSError res = windowEventChannelProxy_->TransferFocusMoveSearch(elementId, direction, baseParent, info);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferFocusMoveSearch2 end");
}
/**
* @tc.name: TransferFocusMoveSearch3
* @tc.desc: test function : TransferFocusMoveSearch
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferFocusMoveSearch3, Function | SmallTest | Level1)
{
WLOGI("TransferFocusMoveSearch3 begin");
int64_t elementId = 0;
int32_t direction = 0;
int64_t baseParent = -1;
Accessibility::AccessibilityElementInfo info;
WSError res = windowEventChannelProxy_->TransferFocusMoveSearch(elementId, direction, baseParent, info);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferFocusMoveSearch3 end");
}
/**
* @tc.name: TransferExecuteAction
* @tc.desc: test function : TransferExecuteAction
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferExecuteAction, Function | SmallTest | Level1)
{
WLOGI("TransferExecuteAction begin");
MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true);
int64_t elementId = 0;
map<string, string> actionArguments;
int32_t action = 0;
int64_t baseParent = 0;
WSError res = windowEventChannelProxy_->TransferExecuteAction(elementId, actionArguments, action, baseParent);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
MockMessageParcel::ClearAllErrorFlag();
WLOGI("TransferExecuteAction end");
}
/**
* @tc.name: TransferExecuteAction1
* @tc.desc: test function : TransferExecuteAction
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferExecuteAction1, Function | SmallTest | Level1)
{
WLOGI("TransferExecuteAction1 begin");
int64_t elementId = -1;
map<string, string> actionArguments;
int32_t action = 0;
int64_t baseParent = 0;
WSError res = windowEventChannelProxy_->TransferExecuteAction(elementId, actionArguments, action, baseParent);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferExecuteAction1 end");
}
/**
* @tc.name: TransferExecuteAction2
* @tc.desc: test function : TransferExecuteAction
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferExecuteAction2, Function | SmallTest | Level1)
{
WLOGI("TransferExecuteAction2 begin");
int64_t elementId = 0;
map<string, string> actionArguments;
actionArguments.insert(pair<string, string>("test", "test"));
int32_t action = 0;
int64_t baseParent = 0;
WSError res = windowEventChannelProxy_->TransferExecuteAction(elementId, actionArguments, action, baseParent);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferExecuteAction2 end");
}
/**
* @tc.name: TransferExecuteAction3
* @tc.desc: test function : TransferExecuteAction
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferExecuteAction3, Function | SmallTest | Level1)
{
WLOGI("TransferExecuteAction3 begin");
int64_t elementId = 0;
map<string, string> actionArguments;
int32_t action = -1;
int64_t baseParent = 0;
WSError res = windowEventChannelProxy_->TransferExecuteAction(elementId, actionArguments, action, baseParent);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferExecuteAction3 end");
}
/**
* @tc.name: TransferExecuteAction4
* @tc.desc: test function : TransferExecuteAction
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyMockTest, TransferExecuteAction4, Function | SmallTest | Level1)
{
WLOGI("TransferExecuteAction4 begin");
int64_t elementId = 0;
map<string, string> actionArguments;
int32_t action = 0;
int64_t baseParent = -1;
WSError res = windowEventChannelProxy_->TransferExecuteAction(elementId, actionArguments, action, baseParent);
ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, res);
WLOGI("TransferExecuteAction4 end");
WLOGI("TransferAccessibilityDumpChildInfo2 end");
}
}
}

View File

@ -157,50 +157,42 @@ HWTEST_F(WindowEventChannelProxyTest, TransferFocusState, Function | SmallTest |
}
/**
* @tc.name: TransferFindFocusedElementInfo
* @tc.desc: test function : TransferFindFocusedElementInfo
* @tc.name: TransferAccessibilityChildTreeRegister
* @tc.desc: test function : TransferAccessibilityChildTreeRegister
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyTest, TransferFindFocusedElementInfo, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyTest, TransferAccessibilityChildTreeRegister, Function | SmallTest | Level1)
{
int64_t elementId = 0;
int32_t focusType = 0;
int64_t baseParent = 0;
Accessibility::AccessibilityElementInfo info;
uint32_t windowId = 0;
int32_t treeId = 0;
int64_t accessibilityId = 0;
WSError res = windowEventChannelProxy_->TransferFindFocusedElementInfo(elementId, focusType, baseParent, info);
WSError res = windowEventChannelProxy_->TransferAccessibilityChildTreeRegister(windowId, treeId, accessibilityId);
ASSERT_EQ(WSError::WS_OK, res);
}
/**
* @tc.name: TransferFocusMoveSearch
* @tc.desc: test function : TransferFocusMoveSearch
* @tc.name: TransferAccessibilityChildTreeUnregister
* @tc.desc: test function : TransferAccessibilityChildTreeUnregister
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyTest, TransferFocusMoveSearch, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyTest, TransferAccessibilityChildTreeUnregister, Function | SmallTest | Level1)
{
int64_t elementId = 0;
int32_t direction = 0;
int64_t baseParent = 0;
Accessibility::AccessibilityElementInfo info;
WSError res = windowEventChannelProxy_->TransferFocusMoveSearch(elementId, direction, baseParent, info);
WSError res = windowEventChannelProxy_->TransferAccessibilityChildTreeUnregister();
ASSERT_EQ(WSError::WS_OK, res);
}
/**
* @tc.name: TransferExecuteAction
* @tc.desc: test function : TransferExecuteAction
* @tc.name: TransferAccessibilityDumpChildInfo
* @tc.desc: test function : TransferAccessibilityDumpChildInfo
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelProxyTest, TransferExecuteAction, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelProxyTest, TransferAccessibilityDumpChildInfo, Function | SmallTest | Level1)
{
int64_t elementId = 0;
map<string, string> actionArguments;
int32_t action = 0;
int64_t baseParent = 0;
std::vector<std::string> params;
std::vector<std::string> info;
WSError res = windowEventChannelProxy_->TransferExecuteAction(elementId, actionArguments, action, baseParent);
WSError res = windowEventChannelProxy_->TransferAccessibilityDumpChildInfo(params, info);
ASSERT_EQ(WSError::WS_OK, res);
}
}

View File

@ -62,91 +62,83 @@ void WindowEventChannelMockStubTest::TearDown()
}
/**
* @tc.name: HandleTransferSearchElementInfo
* @tc.desc: test function : HandleTransferSearchElementInfo
* @tc.name: HandleTransferAccessibilityChildTreeRegister01
* @tc.desc: test function : HandleTransferAccessibilityChildTreeRegister01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelMockStubTest, HandleTransferSearchElementInfo, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelMockStubTest, HandleTransferAccessibilityChildTreeRegister01, Function | SmallTest | Level1)
{
WLOGI("HandleTransferSearchElementInfo begin");
WLOGI("HandleTransferAccessibilityChildTreeRegister01 begin");
MockMessageParcel::ClearAllErrorFlag();
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteUint64(0);
data.WriteInt32(0);
data.WriteInt64(0);
MockMessageParcel::SetWriteInt32ErrorFlag(true);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferAccessibilityChildTreeRegister(data, reply));
WLOGI("HandleTransferAccessibilityChildTreeRegister01 end");
}
/**
* @tc.name: HandleTransferAccessibilityChildTreeRegister02
* @tc.desc: test function : HandleTransferAccessibilityChildTreeRegister02
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelMockStubTest, HandleTransferAccessibilityChildTreeRegister02, Function | SmallTest | Level1)
{
WLOGI("HandleTransferAccessibilityChildTreeRegister02 begin");
MockMessageParcel::ClearAllErrorFlag();
MessageParcel data;
MessageParcel reply;
data.WriteUint32(0);
data.WriteInt32(0);
data.WriteInt64(0);
MockMessageParcel::SetWriteInt64ErrorFlag(true);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferSearchElementInfo(data, reply));
WLOGI("HandleTransferSearchElementInfo end");
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferAccessibilityChildTreeRegister(data, reply));
WLOGI("HandleTransferAccessibilityChildTreeRegister02 end");
}
/**
* @tc.name: HandleTransferSearchElementInfosByText
* @tc.desc: test function : HandleTransferSearchElementInfosByText
* @tc.name: HandleTransferAccessibilityChildTreeUnregister
* @tc.desc: test function : HandleTransferAccessibilityChildTreeUnregister
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelMockStubTest, HandleTransferSearchElementInfosByText, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelMockStubTest, HandleTransferAccessibilityChildTreeUnregister, Function | SmallTest | Level1)
{
WLOGI("HandleTransferSearchElementInfosByText begin");
WLOGI("HandleTransferAccessibilityChildTreeUnregister begin");
MockMessageParcel::ClearAllErrorFlag();
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteString("action");
data.WriteUint64(0);
MockMessageParcel::SetWriteInt64ErrorFlag(true);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferSearchElementInfosByText(data, reply));
WLOGI("HandleTransferSearchElementInfosByText end");
ASSERT_EQ(ERR_NONE, windowEventChannelStub_->HandleTransferAccessibilityChildTreeUnregister(data, reply));
WLOGI("HandleTransferAccessibilityChildTreeUnregister end");
}
/**
* @tc.name: HandleTransferFindFocusedElementInfo
* @tc.desc: test function : HandleTransferFindFocusedElementInfo
* @tc.name: HandleTransferAccessibilityDumpChildInfo
* @tc.desc: test function : HandleTransferAccessibilityDumpChildInfo
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelMockStubTest, HandleTransferFindFocusedElementInfo, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelMockStubTest, HandleTransferAccessibilityDumpChildInfo, Function | SmallTest | Level1)
{
WLOGI("HandleTransferFindFocusedElementInfo begin");
WLOGI("HandleTransferAccessibilityDumpChildInfo begin");
MockMessageParcel::ClearAllErrorFlag();
MessageParcel data;
MessageParcel reply;
std::vector<std::string> params;
data.WriteStringVector(params);
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteUint64(0);
MockMessageParcel::SetWriteParcelableErrorFlag(true);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferFindFocusedElementInfo(data, reply));
WLOGI("HandleTransferFindFocusedElementInfo end");
}
/**
* @tc.name: HandleTransferFocusMoveSearch
* @tc.desc: test function : HandleTransferFocusMoveSearch
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelMockStubTest, HandleTransferFocusMoveSearch, Function | SmallTest | Level1)
{
WLOGI("HandleTransferFocusMoveSearch begin");
MockMessageParcel::ClearAllErrorFlag();
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteUint64(0);
MockMessageParcel::SetWriteParcelableErrorFlag(true);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferFocusMoveSearch(data, reply));
WLOGI("HandleTransferFocusMoveSearch end");
ASSERT_EQ(ERR_NONE, windowEventChannelStub_->HandleTransferAccessibilityDumpChildInfo(data, reply));
WLOGI("HandleTransferAccessibilityDumpChildInfo end");
}
}
}

View File

@ -68,7 +68,6 @@ void WindowEventChannelStubTest::TearDown()
}
namespace {
constexpr int32_t MAX_ARGUMENTS_KEY_SIZE = 1000;
/**
* @tc.name: OnRemoteRequest
* @tc.desc: test function : OnRemoteRequest
@ -196,514 +195,106 @@ HWTEST_F(WindowEventChannelStubTest, HandleTransferFocusStateEvent, Function | S
}
/**
* @tc.name: HandleTransferSearchElementInfo01
* @tc.desc: test function : HandleTransferSearchElementInfo01
* @tc.name: HandleTransferAccessibilityChildTreeRegister01
* @tc.desc: test function : HandleTransferAccessibilityChildTreeRegister01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferSearchElementInfo01, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelStubTest, HandleTransferAccessibilityChildTreeRegister01, Function | SmallTest | Level1)
{
WLOGI("HandleTransferSearchElementInfo01 begin");
WLOGI("HandleTransferAccessibilityChildTreeRegister01 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteInt32(0);
data.WriteInt64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(0, windowEventChannelStub_->HandleTransferSearchElementInfo(data, reply));
WLOGI("HandleTransferSearchElementInfo01 end");
ASSERT_EQ(0, windowEventChannelStub_->HandleTransferAccessibilityChildTreeRegister(data, reply));
WLOGI("HandleTransferAccessibilityChildTreeRegister01 end");
}
/**
* @tc.name: HandleTransferSearchElementInfo02
* @tc.desc: test function : HandleTransferSearchElementInfo02
* @tc.name: HandleTransferAccessibilityChildTreeRegister02
* @tc.desc: test function : HandleTransferAccessibilityChildTreeRegister02
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferSearchElementInfo02, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelStubTest, HandleTransferAccessibilityChildTreeRegister02, Function | SmallTest | Level1)
{
WLOGI("HandleTransferSearchElementInfo02 begin");
WLOGI("HandleTransferAccessibilityChildTreeRegister02 begin");
MessageParcel data;
MessageParcel reply;
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferSearchElementInfo(data, reply));
WLOGI("HandleTransferSearchElementInfo02 end");
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferAccessibilityChildTreeRegister(data, reply));
WLOGI("HandleTransferAccessibilityChildTreeRegister02 end");
}
/**
* @tc.name: HandleTransferSearchElementInfo03
* @tc.desc: test function : HandleTransferSearchElementInfo03
* @tc.name: HandleTransferAccessibilityChildTreeRegister03
* @tc.desc: test function : HandleTransferAccessibilityChildTreeRegister03
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferSearchElementInfo03, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelStubTest, HandleTransferAccessibilityChildTreeRegister03, Function | SmallTest | Level1)
{
WLOGI("HandleTransferSearchElementInfo03 begin");
WLOGI("HandleTransferAccessibilityChildTreeRegister03 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferSearchElementInfo(data, reply));
WLOGI("HandleTransferSearchElementInfo03 end");
}
/**
* @tc.name: HandleTransferSearchElementInfo04
* @tc.desc: test function : HandleTransferSearchElementInfo04
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferSearchElementInfo04, Function | SmallTest | Level1)
{
WLOGI("HandleTransferSearchElementInfo04 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteUint32(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferSearchElementInfo(data, reply));
WLOGI("HandleTransferSearchElementInfo04 end");
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferAccessibilityChildTreeRegister(data, reply));
WLOGI("HandleTransferAccessibilityChildTreeRegister03 end");
}
/**
* @tc.name: HandleTransferSearchElementInfosByText01
* @tc.desc: test function : HandleTransferSearchElementInfosByText01
* @tc.name: HandleTransferAccessibilityChildTreeRegister04
* @tc.desc: test function : HandleTransferAccessibilityChildTreeRegister04
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferSearchElementInfosByText01, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelStubTest, HandleTransferAccessibilityChildTreeRegister04, Function | SmallTest | Level1)
{
WLOGI("HandleTransferSearchElementInfosByText01 begin");
WLOGI("HandleTransferAccessibilityChildTreeRegister04 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteString("action");
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(0, windowEventChannelStub_->HandleTransferSearchElementInfosByText(data, reply));
WLOGI("HandleTransferSearchElementInfosByText01 end");
}
/**
* @tc.name: HandleTransferSearchElementInfosByText02
* @tc.desc: test function : HandleTransferSearchElementInfosByText02
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferSearchElementInfosByText02, Function | SmallTest | Level1)
{
WLOGI("HandleTransferSearchElementInfosByText02 begin");
MessageParcel data;
MessageParcel reply;
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferSearchElementInfosByText(data, reply));
WLOGI("HandleTransferSearchElementInfosByText02 end");
}
/**
* @tc.name: HandleTransferSearchElementInfosByText03
* @tc.desc: test function : HandleTransferSearchElementInfosByText02
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferSearchElementInfosByText03, Function | SmallTest | Level1)
{
WLOGI("HandleTransferSearchElementInfosByText03 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferSearchElementInfosByText(data, reply));
WLOGI("HandleTransferSearchElementInfosByText03 end");
}
/**
* @tc.name: HandleTransferSearchElementInfosByText04
* @tc.desc: test function : HandleTransferSearchElementInfosByText04
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferSearchElementInfosByText04, Function | SmallTest | Level1)
{
WLOGI("HandleTransferSearchElementInfosByText04 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteString("action");
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferSearchElementInfosByText(data, reply));
WLOGI("HandleTransferSearchElementInfosByText04 end");
}
/**
* @tc.name: HandleTransferFindFocusedElementInfo01
* @tc.desc: test function : HandleTransferFindFocusedElementInfo01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferFindFocusedElementInfo01, Function | SmallTest | Level1)
{
WLOGI("HandleTransferFindFocusedElementInfo01 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteUint64(0);
data.WriteInt32(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(0, windowEventChannelStub_->HandleTransferFindFocusedElementInfo(data, reply));
WLOGI("HandleTransferFindFocusedElementInfo01 end");
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferAccessibilityChildTreeRegister(data, reply));
WLOGI("HandleTransferAccessibilityChildTreeRegister04 end");
}
/**
* @tc.name: HandleTransferFindFocusedElementInfo02
* @tc.desc: test function : HandleTransferFindFocusedElementInfo02
* @tc.name: HandleTransferAccessibilityChildTreeUnregister01
* @tc.desc: test function : HandleTransferAccessibilityChildTreeUnregister01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferFindFocusedElementInfo02, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelStubTest, HandleTransferAccessibilityChildTreeUnregister01, Function | SmallTest | Level1)
{
WLOGI("HandleTransferFindFocusedElementInfo02 begin");
WLOGI("HandleTransferAccessibilityChildTreeUnregister01 begin");
MessageParcel data;
MessageParcel reply;
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferFindFocusedElementInfo(data, reply));
WLOGI("HandleTransferFindFocusedElementInfo02 end");
ASSERT_EQ(0, windowEventChannelStub_->HandleTransferAccessibilityChildTreeUnregister(data, reply));
WLOGI("HandleTransferAccessibilityChildTreeUnregister01 end");
}
/**
* @tc.name: HandleTransferFindFocusedElementInfo03
* @tc.desc: test function : HandleTransferFindFocusedElementInfo03
* @tc.name: HandleTransferAccessibilityDumpChildInfo01
* @tc.desc: test function : HandleTransferAccessibilityDumpChildInfo01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferFindFocusedElementInfo03, Function | SmallTest | Level1)
HWTEST_F(WindowEventChannelStubTest, HandleTransferAccessibilityDumpChildInfo01, Function | SmallTest | Level1)
{
WLOGI("HandleTransferFindFocusedElementInfo03 begin");
WLOGI("HandleTransferAccessibilityDumpChildInfo01 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
std::vector<std::string> params;
data.WriteStringVector(params);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferFindFocusedElementInfo(data, reply));
WLOGI("HandleTransferFindFocusedElementInfo03 end");
}
/**
* @tc.name: HandleTransferFindFocusedElementInfo04
* @tc.desc: test function : HandleTransferFindFocusedElementInfo04
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferFindFocusedElementInfo04, Function | SmallTest | Level1)
{
WLOGI("HandleTransferFindFocusedElementInfo04 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteUint32(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferFindFocusedElementInfo(data, reply));
WLOGI("HandleTransferFindFocusedElementInfo04 end");
}
/**
* @tc.name: HandleTransferFocusMoveSearch01
* @tc.desc: test function : HandleTransferFocusMoveSearch01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferFocusMoveSearch01, Function | SmallTest | Level1)
{
WLOGI("HandleTransferFocusMoveSearch01 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(0, windowEventChannelStub_->HandleTransferFocusMoveSearch(data, reply));
WLOGI("HandleTransferFocusMoveSearch01 end");
}
/**
* @tc.name: HandleTransferFocusMoveSearch02
* @tc.desc: test function : HandleTransferFocusMoveSearch02
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferFocusMoveSearch02, Function | SmallTest | Level1)
{
WLOGI("HandleTransferFocusMoveSearch02 begin");
MessageParcel data;
MessageParcel reply;
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferFocusMoveSearch(data, reply));
WLOGI("HandleTransferFocusMoveSearch02 end");
}
/**
* @tc.name: HandleTransferFocusMoveSearch03
* @tc.desc: test function : HandleTransferFocusMoveSearch03
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferFocusMoveSearch03, Function | SmallTest | Level1)
{
WLOGI("HandleTransferFocusMoveSearch03 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferFocusMoveSearch(data, reply));
WLOGI("HandleTransferFocusMoveSearch03 end");
}
/**
* @tc.name: HandleTransferFocusMoveSearch04
* @tc.desc: test function : HandleTransferFocusMoveSearch04
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferFocusMoveSearch04, Function | SmallTest | Level1)
{
WLOGI("HandleTransferFocusMoveSearch04 begin");
MessageParcel data;
MessageParcel reply;
data.WriteUint64(0);
data.WriteUint32(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferFocusMoveSearch(data, reply));
WLOGI("HandleTransferFocusMoveSearch04 end");
}
/**
* @tc.name: HandleTransferExecuteAction01
* @tc.desc: test function : HandleTransferExecuteAction01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferExecuteAction01, Function | SmallTest | Level1)
{
WLOGI("HandleTransferExecuteAction01 begin");
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
std::vector<std::string> actionArgumentsKey {};
std::vector<std::string> actionArgumentsValue {};
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteStringVector(actionArgumentsKey);
data.WriteStringVector(actionArgumentsValue);
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(0, windowEventChannelStub_->HandleTransferExecuteAction(data, reply));
WLOGI("HandleTransferExecuteAction01 end");
}
/**
* @tc.name: HandleTransferExecuteAction02
* @tc.desc: test function : HandleTransferExecuteAction02
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferExecuteAction02, Function | SmallTest | Level1)
{
WLOGI("HandleTransferExecuteAction02 begin");
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferExecuteAction(data, reply));
WLOGI("HandleTransferExecuteAction02 end");
}
/**
* @tc.name: HandleTransferExecuteAction03
* @tc.desc: test function : HandleTransferExecuteAction03
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferExecuteAction03, Function | SmallTest | Level1)
{
WLOGI("HandleTransferExecuteAction03 begin");
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferExecuteAction(data, reply));
WLOGI("HandleTransferExecuteAction03 end");
}
/**
* @tc.name: HandleTransferExecuteAction04
* @tc.desc: test function : HandleTransferExecuteAction04
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferExecuteAction04, Function | SmallTest | Level1)
{
WLOGI("HandleTransferExecuteAction04 begin");
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
data.WriteUint64(0);
data.WriteUint32(0);
std::vector<std::string> actionArgumentsKey {};
std::vector<std::string> actionArgumentsValue {};
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_DATA, windowEventChannelStub_->HandleTransferExecuteAction(data, reply));
WLOGI("HandleTransferExecuteAction04 end");
}
/**
* @tc.name: HandleTransferExecuteAction05
* @tc.desc: test function : HandleTransferExecuteAction
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferExecuteAction05, Function | SmallTest | Level1)
{
WLOGI("HandleTransferExecuteAction05 begin");
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
std::vector<std::string> actionArgumentsKey;
std::vector<std::string> actionArgumentsValue;
for (int i = 0; i <= MAX_ARGUMENTS_KEY_SIZE; i++) {
actionArgumentsKey.push_back(std::to_string(i));
actionArgumentsValue.push_back(std::to_string(i));
}
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteStringVector(actionArgumentsKey);
data.WriteStringVector(actionArgumentsValue);
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_VALUE, windowEventChannelStub_->HandleTransferExecuteAction(data, reply));
WLOGI("HandleTransferExecuteAction05 end");
}
/**
* @tc.name: HandleTransferExecuteAction06
* @tc.desc: test function : HandleTransferExecuteAction
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferExecuteAction06, Function | SmallTest | Level1)
{
WLOGI("HandleTransferExecuteAction06 begin");
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
std::vector<std::string> actionArgumentsKey;
std::vector<std::string> actionArgumentsValue;
for (int i = 0; i <= 4; i++) {
actionArgumentsKey.push_back(std::to_string(i));
}
for (int i = 0; i <= 5; i++) {
actionArgumentsValue.push_back(std::to_string(i));
}
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteStringVector(actionArgumentsKey);
data.WriteStringVector(actionArgumentsValue);
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_VALUE, windowEventChannelStub_->HandleTransferExecuteAction(data, reply));
WLOGI("HandleTransferExecuteAction06 end");
}
/**
* @tc.name: HandleTransferExecuteAction01
* @tc.desc: test function : HandleTransferExecuteAction
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferExecuteAction07, Function | SmallTest | Level1)
{
WLOGI("HandleTransferExecuteAction07 begin");
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
std::vector<std::string> actionArgumentsKey;
actionArgumentsKey.push_back("action");
std::vector<std::string> actionArgumentsValue;
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteStringVector(actionArgumentsKey);
data.WriteStringVector(actionArgumentsValue);
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_VALUE, windowEventChannelStub_->HandleTransferExecuteAction(data, reply));
WLOGI("HandleTransferExecuteAction07 end");
}
/**
* @tc.name: HandleTransferExecuteAction02
* @tc.desc: test function : HandleTransferExecuteAction
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferExecuteAction08, Function | SmallTest | Level1)
{
WLOGI("HandleTransferExecuteAction08 begin");
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
std::vector<std::string> actionArgumentsKey;
std::vector<std::string> actionArgumentsValue;
actionArgumentsValue.push_back("click");
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteStringVector(actionArgumentsKey);
data.WriteStringVector(actionArgumentsValue);
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_VALUE, windowEventChannelStub_->HandleTransferExecuteAction(data, reply));
WLOGI("HandleTransferExecuteAction08 end");
}
/**
* @tc.name: HandleTransferExecuteAction03
* @tc.desc: test function : HandleTransferExecuteAction
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelStubTest, HandleTransferExecuteAction09, Function | SmallTest | Level1)
{
WLOGI("HandleTransferExecuteAction09 begin");
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
std::vector<std::string> actionArgumentsKey;
actionArgumentsKey.push_back("action");
actionArgumentsKey.push_back("action");
std::vector<std::string> actionArgumentsValue;
actionArgumentsValue.push_back("click");
data.WriteUint64(0);
data.WriteUint32(0);
data.WriteStringVector(actionArgumentsKey);
data.WriteStringVector(actionArgumentsValue);
data.WriteUint64(0);
ASSERT_TRUE((windowEventChannelStub_ != nullptr));
ASSERT_EQ(ERR_INVALID_VALUE, windowEventChannelStub_->HandleTransferExecuteAction(data, reply));
WLOGI("HandleTransferExecuteAction09 end");
ASSERT_EQ(0, windowEventChannelStub_->HandleTransferAccessibilityDumpChildInfo(data, reply));
WLOGI("HandleTransferAccessibilityDumpChildInfo01 end");
}
}
}

View File

@ -38,12 +38,9 @@ public:
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
WSError TransferSearchElementInfo(bool isChannelNull);
WSError TransferSearchElementInfosByText(bool isChannelNull);
WSError TransferFindFocusedElementInfo(bool isChannelNull);
WSError TransferFocusMoveSearch(bool isChannelNull);
WSError TransferExecuteAction(bool isChannelNull);
WSError TransferAccessibilityChildTreeRegister(bool isChannelNull);
WSError TransferAccessibilityChildTreeUnregister(bool isChannelNull);
WSError TransferAccessibilityDumpChildInfo(bool isChannelNull);
sptr<ISessionStage> sessionStage = new SessionStageMocker();
sptr<WindowEventChannel> windowEventChannel_ = new WindowEventChannelMocker(sessionStage);
@ -65,65 +62,33 @@ void WindowEventChannelTest::TearDown()
{
}
WSError WindowEventChannelTest::TransferSearchElementInfo(bool isChannelNull)
WSError WindowEventChannelTest::TransferAccessibilityChildTreeRegister(bool isChannelNull)
{
int64_t elementId = 0;
int32_t mode = 0;
int64_t baseParent = 0;
list<AccessibilityElementInfo> infos;
uint32_t windowId = 0;
int32_t treeId = 0;
int64_t accessibilityId = 0;
if (isChannelNull) {
windowEventChannel_->sessionStage_ = nullptr;
}
return windowEventChannel_->TransferSearchElementInfo(elementId, mode, baseParent, infos);
return windowEventChannel_->TransferAccessibilityChildTreeRegister(windowId, treeId, accessibilityId);
}
WSError WindowEventChannelTest::TransferSearchElementInfosByText(bool isChannelNull)
WSError WindowEventChannelTest::TransferAccessibilityChildTreeUnregister(bool isChannelNull)
{
int64_t elementId = 0;
string text;
int64_t baseParent = 0;
list<AccessibilityElementInfo> infos;
if (isChannelNull) {
windowEventChannel_->sessionStage_ = nullptr;
}
return windowEventChannel_->TransferSearchElementInfosByText(elementId, text, baseParent, infos);
return windowEventChannel_->TransferAccessibilityChildTreeUnregister();
}
WSError WindowEventChannelTest::TransferFindFocusedElementInfo(bool isChannelNull)
WSError WindowEventChannelTest::TransferAccessibilityDumpChildInfo(bool isChannelNull)
{
int64_t elementId = 0;
int32_t focusType = 0;
int64_t baseParent = 0;
AccessibilityElementInfo info;
std::vector<std::string> params;
std::vector<std::string> info;
if (isChannelNull) {
windowEventChannel_->sessionStage_ = nullptr;
}
return windowEventChannel_->TransferFindFocusedElementInfo(elementId, focusType, baseParent, info);
}
WSError WindowEventChannelTest::TransferFocusMoveSearch(bool isChannelNull)
{
int64_t elementId = 0;
int32_t direction = 0;
int64_t baseParent = 0;
AccessibilityElementInfo info;
if (isChannelNull) {
windowEventChannel_->sessionStage_ = nullptr;
}
return windowEventChannel_->TransferFocusMoveSearch(elementId, direction, baseParent, info);
}
WSError WindowEventChannelTest::TransferExecuteAction(bool isChannelNull)
{
int64_t elementId = 0;
map<string, string> actionArguments;
int32_t action = 0;
int64_t baseParent = 0;
if (isChannelNull) {
windowEventChannel_->sessionStage_ = nullptr;
}
return windowEventChannel_->TransferExecuteAction(elementId, actionArguments, action, baseParent);
return windowEventChannel_->TransferAccessibilityDumpChildInfo(params, info);
}
namespace {
@ -326,141 +291,81 @@ HWTEST_F(WindowEventChannelTest, TransferFocusState, Function | SmallTest | Leve
}
/**
* @tc.name: TransferSearchElementInfo01
* @tc.desc: normal function TransferSearchElementInfo01
* @tc.name: TransferAccessibilityChildTreeRegister01
* @tc.desc: normal function TransferAccessibilityChildTreeRegister01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelTest, TransferSearchElementInfo01, Function | SmallTest | Level2)
HWTEST_F(WindowEventChannelTest, TransferAccessibilityChildTreeRegister01, Function | SmallTest | Level2)
{
WLOGFI("TransferSearchElementInfo01 begin");
auto res = TransferSearchElementInfo(true);
WLOGFI("TransferAccessibilityChildTreeRegister01 begin");
auto res = TransferAccessibilityChildTreeRegister(true);
ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
WLOGFI("TransferSearchElementInfo01 end");
WLOGFI("TransferAccessibilityChildTreeRegister01 end");
}
/**
* @tc.name: TransferSearchElementInfo02
* @tc.desc: normal function TransferSearchElementInfo02
* @tc.name: TransferAccessibilityChildTreeRegister01
* @tc.desc: normal function TransferAccessibilityChildTreeRegister01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelTest, TransferSearchElementInfo02, Function | SmallTest | Level2)
HWTEST_F(WindowEventChannelTest, TransferAccessibilityChildTreeRegister02, Function | SmallTest | Level2)
{
WLOGFI("TransferSearchElementInfo02 begin");
auto res = TransferSearchElementInfo(false);
WLOGFI("TransferAccessibilityChildTreeRegister02 begin");
auto res = TransferAccessibilityChildTreeRegister(false);
ASSERT_EQ(res, WSError::WS_OK);
WLOGFI("TransferSearchElementInfo02 end");
WLOGFI("TransferAccessibilityChildTreeRegister02 end");
}
/**
* @tc.name: TransferSearchElementInfosByText01
* @tc.desc: normal function TransferSearchElementInfosByText01
* @tc.name: TransferAccessibilityChildTreeUnregister01
* @tc.desc: normal function TransferAccessibilityChildTreeUnregister01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelTest, TransferSearchElementInfosByText01, Function | SmallTest | Level2)
HWTEST_F(WindowEventChannelTest, TransferAccessibilityChildTreeUnregister01, Function | SmallTest | Level2)
{
WLOGFI("TransferSearchElementInfosByText01 begin");
ASSERT_TRUE((windowEventChannel_ != nullptr));
auto res = TransferSearchElementInfosByText(true);
WLOGFI("TransferAccessibilityChildTreeUnregister01 begin");
auto res = TransferAccessibilityChildTreeUnregister(true);
ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
WLOGFI("TransferSearchElementInfosByText01 end");
WLOGFI("TransferAccessibilityChildTreeUnregister01 end");
}
/**
* @tc.name: TransferSearchElementInfosByText02
* @tc.desc: normal function TransferSearchElementInfosByText02
* @tc.name: TransferAccessibilityChildTreeUnregister02
* @tc.desc: normal function TransferAccessibilityChildTreeUnregister02
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelTest, TransferSearchElementInfosByText02, Function | SmallTest | Level2)
HWTEST_F(WindowEventChannelTest, TransferAccessibilityChildTreeUnregister02, Function | SmallTest | Level2)
{
WLOGFI("TransferSearchElementInfosByText02 begin");
ASSERT_TRUE((windowEventChannel_ != nullptr));
auto res = TransferSearchElementInfosByText(false);
WLOGFI("TransferAccessibilityChildTreeUnregister02 begin");
auto res = TransferAccessibilityChildTreeUnregister(false);
ASSERT_EQ(res, WSError::WS_OK);
WLOGFI("TransferSearchElementInfosByText02 end");
WLOGFI("TransferAccessibilityChildTreeUnregister02 end");
}
/**
* @tc.name: TransferFindFocusedElementInfo01
* @tc.desc: normal function TransferFindFocusedElementInfo01
* @tc.name: TransferAccessibilityDumpChildInfo01
* @tc.desc: normal function TransferAccessibilityDumpChildInfo01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelTest, TransferFindFocusedElementInfo01, Function | SmallTest | Level2)
HWTEST_F(WindowEventChannelTest, TransferAccessibilityDumpChildInfo01, Function | SmallTest | Level2)
{
WLOGFI("TransferFindFocusedElementInfo01 begin");
ASSERT_TRUE((windowEventChannel_ != nullptr));
auto res = TransferFindFocusedElementInfo(true);
WLOGFI("TransferAccessibilityDumpChildInfo01 begin");
auto res = TransferAccessibilityDumpChildInfo(true);
ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
WLOGFI("TransferFindFocusedElementInfo01 end");
WLOGFI("TransferAccessibilityDumpChildInfo01 end");
}
/**
* @tc.name: TransferFindFocusedElementInfo02
* @tc.desc: normal function TransferFindFocusedElementInfo02
* @tc.name: TransferAccessibilityDumpChildInfo02
* @tc.desc: normal function TransferAccessibilityDumpChildInfo02
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelTest, TransferFindFocusedElementInfo02, Function | SmallTest | Level2)
HWTEST_F(WindowEventChannelTest, TransferAccessibilityDumpChildInfo02, Function | SmallTest | Level2)
{
WLOGFI("TransferFindFocusedElementInfo02 begin");
ASSERT_TRUE((windowEventChannel_ != nullptr));
auto res = TransferFindFocusedElementInfo(false);
WLOGFI("TransferAccessibilityDumpChildInfo02 begin");
auto res = TransferAccessibilityDumpChildInfo(false);
ASSERT_EQ(res, WSError::WS_OK);
WLOGFI("TransferFindFocusedElementInfo02 end");
}
/**
* @tc.name: TransferFocusMoveSearch01
* @tc.desc: normal function TransferFocusMoveSearch01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelTest, TransferFocusMoveSearch01, Function | SmallTest | Level2)
{
WLOGFI("TransferFocusMoveSearch01 begin");
ASSERT_TRUE((windowEventChannel_ != nullptr));
auto res = TransferFocusMoveSearch(true);
ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
WLOGFI("TransferFocusMoveSearch01 end");
}
/**
* @tc.name: TransferFocusMoveSearch02
* @tc.desc: normal function TransferFocusMoveSearch02
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelTest, TransferFocusMoveSearch02, Function | SmallTest | Level2)
{
WLOGFI("TransferFocusMoveSearch02 begin");
ASSERT_TRUE((windowEventChannel_ != nullptr));
auto res = TransferFocusMoveSearch(false);
ASSERT_EQ(res, WSError::WS_OK);
WLOGFI("TransferFocusMoveSearch02 end");
}
/**
* @tc.name: TransferExecuteAction01
* @tc.desc: normal function TransferExecuteAction01
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelTest, TransferExecuteAction01, Function | SmallTest | Level2)
{
WLOGFI("TransferExecuteAction01 begin");
ASSERT_TRUE((windowEventChannel_ != nullptr));
auto res = TransferExecuteAction(true);
ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
WLOGFI("TransferExecuteAction01 end");
}
/**
* @tc.name: TransferExecuteAction02
* @tc.desc: normal function TransferExecuteAction02
* @tc.type: FUNC
*/
HWTEST_F(WindowEventChannelTest, TransferExecuteAction02, Function | SmallTest | Level2)
{
WLOGFI("TransferExecuteAction02 begin");
ASSERT_TRUE((windowEventChannel_ != nullptr));
auto res = TransferExecuteAction(false);
ASSERT_EQ(res, WSError::WS_OK);
WLOGFI("TransferExecuteAction02 end");
WLOGFI("TransferAccessibilityDumpChildInfo02 end");
}
/**

View File

@ -23,6 +23,12 @@
namespace OHOS {
namespace Rosen {
struct AccessibilityChildTreeInfo {
uint32_t windowId = 0;
int32_t treeId = -1;
int64_t accessibilityId = -1;
};
class WindowExtensionSessionImpl : public WindowSessionImpl {
public:
explicit WindowExtensionSessionImpl(const sptr<WindowOption>& option);
@ -48,18 +54,13 @@ public:
const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) override;
WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea) override;
WSError NotifySearchElementInfoByAccessibilityId(int64_t elementId, int32_t mode, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos) override;
WSError NotifySearchElementInfosByText(int64_t elementId, const std::string& text, int64_t baseParent,
std::list<Accessibility::AccessibilityElementInfo>& infos) override;
WSError NotifyFindFocusedElementInfo(int64_t elementId, int32_t focusType, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info) override;
WSError NotifyFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info) override;
WSError NotifyExecuteAction(int64_t elementId, const std::map<std::string, std::string>& actionAguments,
int32_t action, int64_t baseParent) override;
WSError NotifyAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType,
int64_t timeMs) override;
WSError NotifyAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId) override;
WSError NotifyAccessibilityChildTreeUnregister() override;
WSError NotifyAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info) override;
WMError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info,
int64_t uiExtensionIdLevel) override;
WMError Destroy(bool needNotifyServer, bool needClearListener = true) override;
@ -103,11 +104,13 @@ private:
void CheckAndAddExtWindowFlags();
void CheckAndRemoveExtWindowFlags();
WMError UpdateExtWindowFlags(const ExtensionWindowFlags& flags, const ExtensionWindowFlags& actions);
void UpdateAccessibilityTreeInfo();
std::atomic<bool> isDensityFollowHost_ { false };
std::optional<std::atomic<float>> hostDensityValue_ = std::nullopt;
sptr<IOccupiedAreaChangeListener> occupiedAreaChangeListener_;
std::optional<std::atomic<bool>> focusState_ = std::nullopt;
std::optional<AccessibilityChildTreeInfo> accessibilityChildTreeInfo_ = std::nullopt;
static std::set<sptr<WindowSessionImpl>> windowExtensionSessionSet_;
static std::shared_mutex windowExtensionSessionMutex_;
int16_t rotationAnimationCount_ { 0 };

View File

@ -436,6 +436,7 @@ WMError WindowExtensionSessionImpl::NapiSetUIContent(const std::string& contentI
std::unique_lock<std::shared_mutex> lock(uiContentMutex_);
uiContent_ = std::move(uiContent);
}
UpdateAccessibilityTreeInfo();
std::shared_ptr<Ace::UIContent> uiContent = GetUIContentSharedPtr();
if (focusState_ != std::nullopt) {
focusState_.value() ? uiContent->Focus() : uiContent->UnFocus();
@ -551,77 +552,12 @@ void WindowExtensionSessionImpl::UpdateRectForRotation(const Rect& wmRect, const
handler_->PostTask(task, "WMS_WindowExtensionSessionImpl_UpdateRectForRotation");
}
WSError WindowExtensionSessionImpl::NotifySearchElementInfoByAccessibilityId(int64_t elementId, int32_t mode,
int64_t baseParent, std::list<Accessibility::AccessibilityElementInfo>& infos)
{
std::shared_ptr<Ace::UIContent> uiContent = GetUIContentSharedPtr();
if (uiContent == nullptr) {
WLOGFE("NotifySearchElementInfoByAccessibilityId error, no uiContent");
return WSError::WS_ERROR_NO_UI_CONTENT_ERROR;
}
uiContent->SearchElementInfoByAccessibilityId(elementId, mode, baseParent, infos);
return WSError::WS_OK;
}
WSError WindowExtensionSessionImpl::NotifySearchElementInfosByText(int64_t elementId, const std::string& text,
int64_t baseParent, std::list<Accessibility::AccessibilityElementInfo>& infos)
{
std::shared_ptr<Ace::UIContent> uiContent = GetUIContentSharedPtr();
if (uiContent == nullptr) {
WLOGFE("NotifySearchElementInfosByText error, no uiContent");
return WSError::WS_ERROR_NO_UI_CONTENT_ERROR;
}
uiContent->SearchElementInfosByText(elementId, text, baseParent, infos);
return WSError::WS_OK;
}
WSError WindowExtensionSessionImpl::NotifyFindFocusedElementInfo(int64_t elementId, int32_t focusType,
int64_t baseParent, Accessibility::AccessibilityElementInfo& info)
{
std::shared_ptr<Ace::UIContent> uiContent = GetUIContentSharedPtr();
if (uiContent == nullptr) {
WLOGFE("NotifyFindFocusedElementInfo error, no uiContent");
return WSError::WS_ERROR_NO_UI_CONTENT_ERROR;
}
uiContent->FindFocusedElementInfo(elementId, focusType, baseParent, info);
return WSError::WS_OK;
}
WSError WindowExtensionSessionImpl::NotifyFocusMoveSearch(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo& info)
{
std::shared_ptr<Ace::UIContent> uiContent = GetUIContentSharedPtr();
if (uiContent == nullptr) {
WLOGFE("NotifyFocusMoveSearch error, no uiContent");
return WSError::WS_ERROR_NO_UI_CONTENT_ERROR;
}
uiContent->FocusMoveSearch(elementId, direction, baseParent, info);
return WSError::WS_OK;
}
WSError WindowExtensionSessionImpl::NotifyExecuteAction(int64_t elementId,
const std::map<std::string, std::string>& actionAguments, int32_t action,
int64_t baseParent)
{
std::shared_ptr<Ace::UIContent> uiContent = GetUIContentSharedPtr();
if (uiContent == nullptr) {
WLOGFE("NotifyExecuteAction error, no uiContent");
return WSError::WS_ERROR_NO_UI_CONTENT_ERROR;
}
bool ret = uiContent->NotifyExecuteAction(elementId, actionAguments, action, baseParent);
if (!ret) {
WLOGFE("NotifyExecuteAction fail");
return WSError::WS_ERROR_INTERNAL_ERROR;
}
return WSError::WS_OK;
}
WSError WindowExtensionSessionImpl::NotifyAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType,
int32_t eventType, int64_t timeMs)
{
std::shared_ptr<Ace::UIContent> uiContent = GetUIContentSharedPtr();
if (uiContent == nullptr) {
WLOGFE("NotifyExecuteAction error, no uiContent");
WLOGFE("NotifyAccessibilityHoverEvent error, no uiContent");
return WSError::WS_ERROR_NO_UI_CONTENT_ERROR;
}
uiContent->HandleAccessibilityHoverEvent(pointX, pointY, sourceType, eventType, timeMs);
@ -844,6 +780,80 @@ void WindowExtensionSessionImpl::CheckAndRemoveExtWindowFlags()
}
}
WSError WindowExtensionSessionImpl::NotifyAccessibilityChildTreeRegister(
uint32_t windowId, int32_t treeId, int64_t accessibilityId)
{
if (!handler_) {
return WSError::WS_ERROR_INTERNAL_ERROR;
}
auto uiContentSharedPtr = GetUIContentSharedPtr();
if (uiContentSharedPtr == nullptr) {
accessibilityChildTreeInfo_ = {
.windowId = windowId,
.treeId = treeId,
.accessibilityId = accessibilityId
};
TLOGD(WmsLogTag::WMS_UIEXT, "uiContent is null, save the accessibility child tree info.");
return WSError::WS_OK;
}
handler_->PostTask([uiContent = GetUIContentSharedPtr(), windowId, treeId, accessibilityId]() {
if (uiContent == nullptr) {
TLOGE(WmsLogTag::WMS_UIEXT, "NotifyAccessibilityChildTreeRegister error, no uiContent");
return;
}
TLOGI(WmsLogTag::WMS_UIEXT,
"NotifyAccessibilityChildTreeRegister: %{public}d %{public}" PRId64, treeId, accessibilityId);
uiContent->RegisterAccessibilityChildTree(windowId, treeId, accessibilityId);
});
return WSError::WS_OK;
}
WSError WindowExtensionSessionImpl::NotifyAccessibilityChildTreeUnregister()
{
if (!handler_) {
return WSError::WS_ERROR_INTERNAL_ERROR;
}
handler_->PostTask([uiContent = GetUIContentSharedPtr()]() {
if (uiContent == nullptr) {
TLOGE(WmsLogTag::WMS_UIEXT, "NotifyAccessibilityChildTreeUnregister error, no uiContent");
return;
}
uiContent->DeregisterAccessibilityChildTree();
});
return WSError::WS_OK;
}
WSError WindowExtensionSessionImpl::NotifyAccessibilityDumpChildInfo(
const std::vector<std::string>& params, std::vector<std::string>& info)
{
if (!handler_) {
return WSError::WS_ERROR_INTERNAL_ERROR;
}
handler_->PostSyncTask([uiContent = GetUIContentSharedPtr(), params, &info]() {
if (uiContent == nullptr) {
TLOGE(WmsLogTag::WMS_UIEXT, "NotifyAccessibilityDumpChildInfo error, no uiContent");
return;
}
uiContent->AccessibilityDumpChildInfo(params, info);
});
return WSError::WS_OK;
}
void WindowExtensionSessionImpl::UpdateAccessibilityTreeInfo()
{
if (accessibilityChildTreeInfo_ == std::nullopt) {
return;
}
std::shared_ptr<Ace::UIContent> uiContent = GetUIContentSharedPtr();
if (uiContent == nullptr) {
return;
}
uiContent->RegisterAccessibilityChildTree(accessibilityChildTreeInfo_->windowId,
accessibilityChildTreeInfo_->treeId, accessibilityChildTreeInfo_->accessibilityId);
accessibilityChildTreeInfo_.reset();
}
WMError WindowExtensionSessionImpl::UpdateExtWindowFlags(const ExtensionWindowFlags& flags,
const ExtensionWindowFlags& actions)
{

View File

@ -807,235 +807,20 @@ HWTEST_F(WindowExtensionSessionImplTest, UpdateRectForRotation01, Function | Sma
}
/**
* @tc.name: NotifySearchElementInfoByAccessibilityId01
* @tc.desc: NotifySearchElementInfoByAccessibilityId Test
* @tc.name: NotifyAccessibilityChildTreeRegister01
* @tc.desc: NotifyAccessibilityChildTreeRegister Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifySearchElementInfoByAccessibilityId01, Function | SmallTest | Level3)
HWTEST_F(WindowExtensionSessionImplTest, NotifyAccessibilityChildTreeRegister01, Function | SmallTest | Level3)
{
int64_t elementId = 0;
int32_t mode = 0;
int64_t baseParent = 0;
list<AccessibilityElementInfo> infos;
uint32_t windowId = 0;
int32_t treeId = 0;
int64_t accessibilityId = 0;
window_->uiContent_ = std::make_unique<Ace::UIContentMocker>();
ASSERT_NE(nullptr, window_->uiContent_);
ASSERT_EQ(WSError::WS_OK, window_->NotifySearchElementInfoByAccessibilityId(elementId, mode, baseParent, infos));
ASSERT_EQ(WSError::WS_OK, window_->NotifyAccessibilityChildTreeRegister(windowId, treeId, accessibilityId));
}
/**
* @tc.name: NotifySearchElementInfoByAccessibilityId02
* @tc.desc: NotifySearchElementInfoByAccessibilityId Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifySearchElementInfoByAccessibilityId02, Function | SmallTest | Level3)
{
int64_t elementId = 0;
int32_t mode = 0;
int64_t baseParent = 0;
list<AccessibilityElementInfo> infos;
ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR,
window_->NotifySearchElementInfoByAccessibilityId(elementId, mode, baseParent, infos));
}
/**
* @tc.name: NotifySearchElementInfosByText01
* @tc.desc: NotifySearchElementInfosByText Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifySearchElementInfosByText01, Function | SmallTest | Level3)
{
int64_t elementId = 0;
string text;
int64_t baseParent = 0;
list<AccessibilityElementInfo> infos;
window_->uiContent_ = std::make_unique<Ace::UIContentMocker>();
ASSERT_NE(nullptr, window_->uiContent_);
ASSERT_EQ(WSError::WS_OK, window_->NotifySearchElementInfosByText(elementId, text, baseParent, infos));
}
/**
* @tc.name: NotifySearchElementInfosByText02
* @tc.desc: NotifySearchElementInfosByText Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifySearchElementInfosByText02, Function | SmallTest | Level3)
{
int64_t elementId = 0;
string text;
int64_t baseParent = 0;
list<AccessibilityElementInfo> infos;
ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR,
window_->NotifySearchElementInfosByText(elementId, text, baseParent, infos));
}
/**
* @tc.name: NotifyFindFocusedElementInfo01
* @tc.desc: NotifyFindFocusedElementInfo Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifyFindFocusedElementInfo01, Function | SmallTest | Level3)
{
int64_t elementId = 0;
int32_t focusType = 0;
int64_t baseParent = 0;
AccessibilityElementInfo info;
window_->uiContent_ = std::make_unique<Ace::UIContentMocker>();
ASSERT_NE(nullptr, window_->uiContent_);
ASSERT_EQ(WSError::WS_OK,
window_->NotifyFindFocusedElementInfo(elementId, focusType, baseParent, info));
}
/**
* @tc.name: NotifyFindFocusedElementInfo02
* @tc.desc: NotifyFindFocusedElementInfo Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifyFindFocusedElementInfo02, Function | SmallTest | Level3)
{
int64_t elementId = 0;
int32_t focusType = 0;
int64_t baseParent = 0;
AccessibilityElementInfo info;
ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR,
window_->NotifyFindFocusedElementInfo(elementId, focusType, baseParent, info));
}
/**
* @tc.name: NotifyFocusMoveSearch01
* @tc.desc: NotifyFocusMoveSearch Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifyFocusMoveSearch01, Function | SmallTest | Level3)
{
int64_t elementId = 0;
int32_t direction = 0;
int64_t baseParent = 0;
AccessibilityElementInfo info;
window_->uiContent_ = std::make_unique<Ace::UIContentMocker>();
ASSERT_NE(nullptr, window_->uiContent_);
ASSERT_EQ(WSError::WS_OK,
window_->NotifyFocusMoveSearch(elementId, direction, baseParent, info));
}
/**
* @tc.name: NotifyFocusMoveSearch02
* @tc.desc: NotifyFocusMoveSearch Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifyFocusMoveSearch02, Function | SmallTest | Level3)
{
int64_t elementId = 0;
int32_t direction = 0;
int64_t baseParent = 0;
AccessibilityElementInfo info;
ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR,
window_->NotifyFocusMoveSearch(elementId, direction, baseParent, info));
}
/**
* @tc.name: NotifyExecuteAction01
* @tc.desc: NotifyExecuteAction Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifyExecuteAction01, Function | SmallTest | Level3)
{
int64_t elementId = 0;
std::map<std::string, std::string> actionAguments;
int32_t action = 0;
int64_t baseParent = 0;
window_->uiContent_ = std::make_unique<Ace::UIContentMocker>();
ASSERT_NE(nullptr, window_->uiContent_);
ASSERT_EQ(WSError::WS_ERROR_INTERNAL_ERROR,
window_->NotifyExecuteAction(elementId, actionAguments, action, baseParent));
}
/**
* @tc.name: NotifyExecuteAction02
* @tc.desc: NotifyExecuteAction Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifyExecuteAction02, Function | SmallTest | Level3)
{
int64_t elementId = 0;
std::map<std::string, std::string> actionAguments;
int32_t action = 0;
int64_t baseParent = 0;
ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR,
window_->NotifyExecuteAction(elementId, actionAguments, action, baseParent));
}
/**
* @tc.name: NotifyExecuteAction03
* @tc.desc: NotifyExecuteAction Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifyExecuteAction03, Function | SmallTest | Level3)
{
int64_t elementId = 0;
std::map<std::string, std::string> actionAguments;
int32_t action = 0;
int64_t baseParent = 0;
window_->uiContent_ = std::make_unique<Ace::UIContentMocker>();
ASSERT_NE(nullptr, window_->uiContent_);
Ace::UIContentMocker* content = reinterpret_cast<Ace::UIContentMocker*>(window_->uiContent_.get());
EXPECT_CALL(*content, NotifyExecuteAction).WillOnce(Return(true));
ASSERT_EQ(WSError::WS_OK, window_->NotifyExecuteAction(elementId, actionAguments, action, baseParent));
}
/**
* @tc.name: NotifyAccessibilityHoverEvent01
* @tc.desc: NotifyExecuteAction Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifyAccessibilityHoverEvent01, Function | SmallTest | Level3)
{
ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR, window_->NotifyAccessibilityHoverEvent(0.0f, 0.0f, 0, 0, 0));
}
/**
* @tc.name: NotifyAccessibilityHoverEvent02
* @tc.desc: NotifyExecuteAction Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, NotifyAccessibilityHoverEvent02, Function | SmallTest | Level3)
{
window_->uiContent_ = std::make_unique<Ace::UIContentMocker>();
ASSERT_NE(nullptr, window_->uiContent_);
ASSERT_EQ(WSError::WS_OK, window_->NotifyAccessibilityHoverEvent(0.0f, 0.0f, 0, 0, 0));
}
/**
* @tc.name: TransferAccessibilityEvent01
* @tc.desc: TransferAccessibilityEvent Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, TransferAccessibilityEvent01, Function | SmallTest | Level3)
{
AccessibilityEventInfo info;
int64_t uiExtensionIdLevel = 0;
ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW,
window_->TransferAccessibilityEvent(info, uiExtensionIdLevel));
}
/**
* @tc.name: TransferAccessibilityEvent02
* @tc.desc: TransferAccessibilityEvent01 Test
* @tc.type: FUNC
*/
HWTEST_F(WindowExtensionSessionImplTest, TransferAccessibilityEvent02, Function | SmallTest | Level3)
{
SessionInfo sessionInfo;
window_->hostSession_ = new(std::nothrow) SessionMocker(sessionInfo);
ASSERT_NE(nullptr, window_->hostSession_);
ASSERT_NE(nullptr, window_->property_);
window_->property_->SetPersistentId(1);
AccessibilityEventInfo info;
int64_t uiExtensionIdLevel = 0;
ASSERT_EQ(WMError::WM_OK, window_->TransferAccessibilityEvent(info, uiExtensionIdLevel));
}
/**
* @tc.name: NotifyOccupiedAreaChangeInfo01
* @tc.desc: NotifyExecuteAction Test