From 639e93eff783b8a90dfbdb6e69c658742b36c5fb Mon Sep 17 00:00:00 2001 From: Mupceet Date: Tue, 13 Sep 2022 12:42:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9D=99=E6=80=81=E5=91=8A?= =?UTF-8?q?=E8=AD=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mupceet --- .../accessibility_element_operator_proxy.h | 2 +- .../accessibility_element_operator_proxy.cpp | 3 - .../acfwk/include/accessibility_config_impl.h | 10 +-- ...bility_system_ability_client_impl_test.cpp | 2 +- .../accessibility_config_test.cpp | 2 +- .../accessible_ability_client_test.cpp | 8 +- .../napi_accessibility_config_observer.cpp | 3 +- ...pi_accessibility_system_ability_client.cpp | 3 +- .../napi/src/napi_accessibility_utils.cpp | 40 +++++----- .../aams/src/accessibility_account_data.cpp | 3 +- services/aams/src/accessibility_mouse_key.cpp | 5 -- services/aams/test/BUILD.gn | 1 + ...ity_helper.h => accessibility_ut_helper.h} | 48 +----------- ...k_accessibility_element_operator_proxy.cpp | 5 +- .../mock_accessibility_event_transmission.cpp | 2 +- .../mock_accessibility_keyevent_filter.cpp | 2 +- .../mock_accessible_ability_client_proxy.cpp | 2 +- ...ck_accessible_ability_client_stub_impl.cpp | 2 +- ...ock_accessible_ability_manager_service.cpp | 2 +- services/aams/test/mock/src/mock_display.cpp | 9 ++- .../test/mock/src/mock_os_account_manager.cpp | 2 +- .../test/mock/src/mock_system_ability.cpp | 7 +- .../mock_window_accessibility_controller.cpp | 2 +- .../accessibility_input_interceptor_test.cpp | 5 +- .../accessibility_keyevent_filter_test.cpp | 5 +- .../accessibility_mouse_autoclick_test.cpp | 5 +- .../unittest/accessibility_mouse_key_test.cpp | 2 +- .../unittest/accessibility_short_key_test.cpp | 2 +- ...accessibility_touchEvent_injector_test.cpp | 5 +- .../accessibility_touch_guider_test.cpp | 57 +++++++------- .../accessibility_window_manager_test.cpp | 2 +- .../accessibility_zoom_gesture_test.cpp | 2 +- .../accessible_ability_channel_test.cpp | 3 +- .../accessible_ability_connection_test.cpp | 5 +- ...ccessible_ability_manager_service_test.cpp | 5 +- services/test/BUILD.gn | 1 + ...ity_helper.h => accessibility_mt_helper.h} | 49 +----------- .../mock/common/accessibility_common_helper.h | 75 +++++++++++++++++++ ...mock_accessibility_element_operator_impl.h | 24 +++--- ...k_accessibility_element_operator_proxy.cpp | 3 - ...ock_accessibility_element_operator_proxy.h | 16 ++-- .../mock_accessible_ability_client_proxy.cpp | 2 +- services/test/mock/mock_bundle_manager.cpp | 4 +- services/test/mock/mock_bundle_manager.h | 2 +- .../test/mock/mock_os_account_manager.cpp | 2 +- services/test/mock/mock_system_ability.cpp | 7 +- .../src/mock_input_manager.cpp | 10 +-- ...ams_accessibility_keyevent_filter_test.cpp | 5 +- ...accessibility_touchEvent_injector_test.cpp | 5 +- .../aams_accessibility_touch_guider_test.cpp | 39 +++++----- .../aams_accessible_ability_channel_test.cpp | 5 +- .../aams_common_event_registry_test.cpp | 5 +- .../aams_server_test/aams_server_test.cpp | 5 +- 53 files changed, 259 insertions(+), 263 deletions(-) rename services/aams/test/mock/include/{accessibility_ability_helper.h => accessibility_ut_helper.h} (85%) rename services/test/mock/{accessibility_helper.h => accessibility_mt_helper.h} (79%) create mode 100644 services/test/mock/common/accessibility_common_helper.h diff --git a/common/interface/include/accessibility_element_operator_proxy.h b/common/interface/include/accessibility_element_operator_proxy.h index 2eda6398..8976f914 100644 --- a/common/interface/include/accessibility_element_operator_proxy.h +++ b/common/interface/include/accessibility_element_operator_proxy.h @@ -36,7 +36,7 @@ public: /** * @brief destruct function */ - virtual ~AccessibilityElementOperatorProxy() override; + virtual ~AccessibilityElementOperatorProxy() = default; /** * @brief Make the node information by accessibility ID and set the result by callback. diff --git a/common/interface/src/accessibility_element_operator_proxy.cpp b/common/interface/src/accessibility_element_operator_proxy.cpp index a9e929f9..e2dad00c 100644 --- a/common/interface/src/accessibility_element_operator_proxy.cpp +++ b/common/interface/src/accessibility_element_operator_proxy.cpp @@ -22,9 +22,6 @@ AccessibilityElementOperatorProxy::AccessibilityElementOperatorProxy( const sptr &impl) : IRemoteProxy(impl) {} -AccessibilityElementOperatorProxy::~AccessibilityElementOperatorProxy() -{} - bool AccessibilityElementOperatorProxy::WriteInterfaceToken(MessageParcel &data) { HILOG_DEBUG(); diff --git a/frameworks/acfwk/include/accessibility_config_impl.h b/frameworks/acfwk/include/accessibility_config_impl.h index f9350eb5..c84f6f66 100644 --- a/frameworks/acfwk/include/accessibility_config_impl.h +++ b/frameworks/acfwk/include/accessibility_config_impl.h @@ -229,19 +229,19 @@ private: sptr enableAbilityListsObserver_ = nullptr; bool isInitialized_ = false; + bool shortkey_ = false; bool highContrastText_ = false; + bool screenMagnifier_ = false; bool invertColor_ = false; + bool captionState_ = false; bool animationOff_ = false; bool audioMono_ = false; bool mouseKey_ = false; - bool captionState_ = false; - bool screenMagnifier_ = false; - bool shortkey_ = false; int32_t mouseAutoClick_ = 0; - uint32_t daltonizationColorFilter_ = 0; uint32_t contentTimeout_ = 0; - float brightnessDiscount_ = 0.0; + uint32_t daltonizationColorFilter_ = 0; float audioBalance_ = 0.0; + float brightnessDiscount_ = 0.0; std::string shortkeyTarget_ = ""; CaptionProperty captionProperty_ = {}; diff --git a/frameworks/asacfwk/test/unittest/accessibility_system_ability_client_impl_test.cpp b/frameworks/asacfwk/test/unittest/accessibility_system_ability_client_impl_test.cpp index 4670bec2..197dc6d2 100644 --- a/frameworks/asacfwk/test/unittest/accessibility_system_ability_client_impl_test.cpp +++ b/frameworks/asacfwk/test/unittest/accessibility_system_ability_client_impl_test.cpp @@ -15,8 +15,8 @@ #include #include -#include "accessibility_ability_helper.h" #include "accessibility_system_ability_client_impl.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_manager_service.h" #include "mock_accessibility_element_operator.h" #include "system_ability_definition.h" diff --git a/interfaces/innerkits/test/benchmarktest/accessibility_config_test/accessibility_config_test.cpp b/interfaces/innerkits/test/benchmarktest/accessibility_config_test/accessibility_config_test.cpp index cf619c2c..c3fe12b6 100644 --- a/interfaces/innerkits/test/benchmarktest/accessibility_config_test/accessibility_config_test.cpp +++ b/interfaces/innerkits/test/benchmarktest/accessibility_config_test/accessibility_config_test.cpp @@ -24,7 +24,7 @@ namespace { public: AccessibilityConfigObserverImpl() = default; - virtual void OnConfigChanged(const CONFIG_ID id, const ConfigValue &value) override + void OnConfigChanged(const CONFIG_ID id, const ConfigValue &value) override { complete_.set_value(); } diff --git a/interfaces/innerkits/test/benchmarktest/accessible_ability_client_test/accessible_ability_client_test.cpp b/interfaces/innerkits/test/benchmarktest/accessible_ability_client_test/accessible_ability_client_test.cpp index fbfd0186..35bce5cd 100644 --- a/interfaces/innerkits/test/benchmarktest/accessible_ability_client_test/accessible_ability_client_test.cpp +++ b/interfaces/innerkits/test/benchmarktest/accessible_ability_client_test/accessible_ability_client_test.cpp @@ -26,19 +26,19 @@ namespace { AccessibleAbilityListenerImpl() = default; ~AccessibleAbilityListenerImpl() = default; - virtual void OnAbilityConnected() override + void OnAbilityConnected() override { complete_.set_value(); } - virtual void OnAbilityDisconnected() override + void OnAbilityDisconnected() override { complete_.set_value(); } - virtual void OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo) override {} + void OnAccessibilityEvent(const AccessibilityEventInfo &eventInfo) override {} - virtual bool OnKeyPressEvent(const std::shared_ptr &keyEvent) override + bool OnKeyPressEvent(const std::shared_ptr &keyEvent) override { return false; } diff --git a/interfaces/kits/napi/src/napi_accessibility_config_observer.cpp b/interfaces/kits/napi/src/napi_accessibility_config_observer.cpp index a13b3667..5db2277c 100644 --- a/interfaces/kits/napi/src/napi_accessibility_config_observer.cpp +++ b/interfaces/kits/napi/src/napi_accessibility_config_observer.cpp @@ -409,10 +409,9 @@ void NAccessibilityConfigObserverImpl::UnsubscribeObserver(OHOS::AccessibilityCo for (auto iter = observers_.begin(); iter != observers_.end();) { if ((*iter)->configId_ == id) { napi_value item = nullptr; - napi_status status; bool equalFlag = false; napi_get_reference_value((*iter)->env_, (*iter)->handlerRef_, &item); - status = napi_strict_equals((*iter)->env_, item, observer, &equalFlag); + napi_status status = napi_strict_equals((*iter)->env_, item, observer, &equalFlag); if (status == napi_ok && equalFlag) { iter = observers_.erase(iter); } else { diff --git a/interfaces/kits/napi/src/napi_accessibility_system_ability_client.cpp b/interfaces/kits/napi/src/napi_accessibility_system_ability_client.cpp index 8e34a35e..396d699b 100644 --- a/interfaces/kits/napi/src/napi_accessibility_system_ability_client.cpp +++ b/interfaces/kits/napi/src/napi_accessibility_system_ability_client.cpp @@ -957,10 +957,9 @@ void StateListenerImpl::UnsubscribeObserver(napi_value observer) std::lock_guard lock(mutex_); for (auto iter = observers_.begin(); iter != observers_.end();) { napi_value item = nullptr; - napi_status status; bool equalFlag = false; napi_get_reference_value((*iter)->env_, (*iter)->handlerRef_, &item); - status = napi_strict_equals((*iter)->env_, item, observer, &equalFlag); + napi_status status = napi_strict_equals((*iter)->env_, item, observer, &equalFlag); if (status == napi_ok && equalFlag) { iter = observers_.erase(iter); } else { diff --git a/interfaces/kits/napi/src/napi_accessibility_utils.cpp b/interfaces/kits/napi/src/napi_accessibility_utils.cpp index c9541c2e..c41194f4 100644 --- a/interfaces/kits/napi/src/napi_accessibility_utils.cpp +++ b/interfaces/kits/napi/src/napi_accessibility_utils.cpp @@ -30,7 +30,27 @@ using namespace OHOS; using namespace OHOS::Accessibility; using namespace OHOS::AccessibilityConfig; +namespace { + const uint32_t COLOR_TRANSPARENT = 0x00000000; + const uint32_t COLOR_WHITE = 0xffffffff; + const uint32_t COLOR_BLACK = 0xff000000; + const uint32_t COLOR_RED = 0xffff0000; + const uint32_t COLOR_GREEN = 0xff00ff00; + const uint32_t COLOR_BLUE = 0xff0000ff; + const uint32_t COLOR_GRAY = 0xffc0c0c0; + constexpr uint32_t COLOR_STRING_SIZE_STANDARD = 8; + constexpr uint32_t COLOR_STRING_BASE = 16; + const std::regex COLOR_WITH_MAGIC("#[0-9A-Fa-f]{6,8}"); + const std::regex COLOR_WITH_MAGIC_MINI("#[0-9A-Fa-f]{3,4}"); + constexpr uint32_t COLOR_ALPHA_MASK = 0xff000000; + + constexpr int32_t RGB_LENGTH = 6; + constexpr int32_t ALPHA_LENGTH = 2; + constexpr int32_t ALPHA_MOVE = 24; + constexpr int32_t COLOR_MOVE = 8; + const char UNICODE_BODY = '0'; +} // namespace std::string GetStringFromNAPI(napi_env env, napi_value value) { std::string result; @@ -1352,26 +1372,6 @@ void ConvertCaptionPropertyToJS( NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "windowColor", value)); } -const uint32_t COLOR_TRANSPARENT = 0x00000000; -const uint32_t COLOR_WHITE = 0xffffffff; -const uint32_t COLOR_BLACK = 0xff000000; -const uint32_t COLOR_RED = 0xffff0000; -const uint32_t COLOR_GREEN = 0xff00ff00; -const uint32_t COLOR_BLUE = 0xff0000ff; -const uint32_t COLOR_GRAY = 0xffc0c0c0; - -constexpr uint32_t COLOR_STRING_SIZE_STANDARD = 8; -constexpr uint32_t COLOR_STRING_BASE = 16; -const std::regex COLOR_WITH_MAGIC("#[0-9A-Fa-f]{6,8}"); -const std::regex COLOR_WITH_MAGIC_MINI("#[0-9A-Fa-f]{3,4}"); -constexpr uint32_t COLOR_ALPHA_MASK = 0xff000000; - -constexpr int32_t RGB_LENGTH = 6; -constexpr int32_t ALPHA_LENGTH = 2; -constexpr int32_t ALPHA_MOVE = 24; -constexpr int32_t COLOR_MOVE = 8; -const char UNICODE_BODY = '0'; - uint32_t ConvertColorStringToNumer(std::string colorStr) { HILOG_DEBUG("colorStr is %{public}s", colorStr.c_str()); diff --git a/services/aams/src/accessibility_account_data.cpp b/services/aams/src/accessibility_account_data.cpp index 0aa035ed..1b94e3a5 100644 --- a/services/aams/src/accessibility_account_data.cpp +++ b/services/aams/src/accessibility_account_data.cpp @@ -183,7 +183,8 @@ void AccessibilityAccountData::AddAccessibilityWindowConnection( const int32_t windowId, const sptr& interactionConnection) { HILOG_DEBUG("windowId(%{public}d)", windowId); - if (!asacConnections_.count(windowId)) { + auto iter = asacConnections_.find(windowId); + if (iter == asacConnections_.end()) { asacConnections_.insert(std::make_pair(windowId, interactionConnection)); } } diff --git a/services/aams/src/accessibility_mouse_key.cpp b/services/aams/src/accessibility_mouse_key.cpp index d56fccef..c8ad962b 100755 --- a/services/aams/src/accessibility_mouse_key.cpp +++ b/services/aams/src/accessibility_mouse_key.cpp @@ -142,7 +142,6 @@ bool AccessibilityMouseKey::IsMouseKey(const std::vector &pressedKeys, if (pressedKeyCount == ITEM_COUNT_1) { if (std::find(MOUSE_KEYCODE_V.begin(), MOUSE_KEYCODE_V.end(), pressedKeys[0]) != MOUSE_KEYCODE_V.end()) { actionKey = pressedKeys[0]; - HILOG_DEBUG("actionKey:%d", actionKey); return true; } } else if (pressedKeyCount == ITEM_COUNT_2) { @@ -152,7 +151,6 @@ bool AccessibilityMouseKey::IsMouseKey(const std::vector &pressedKeys, continue; } actionKey = pressedKeys[i]; - HILOG_DEBUG("actionKey:%d", actionKey); size_t Index = (i + 1) % ITEM_COUNT_2; if (Index > 1) { return false; @@ -160,7 +158,6 @@ bool AccessibilityMouseKey::IsMouseKey(const std::vector &pressedKeys, if (std::find(CTRL_SHIFT_KEYCODE_V.begin(), CTRL_SHIFT_KEYCODE_V.end(), pressedKeys[Index]) != CTRL_SHIFT_KEYCODE_V.end()) { metaKey1 = pressedKeys[Index]; - HILOG_DEBUG("metaKey1:%d", metaKey1); return true; } } @@ -171,7 +168,6 @@ bool AccessibilityMouseKey::IsMouseKey(const std::vector &pressedKeys, continue; } actionKey = pressedKeys[i]; - HILOG_DEBUG("actionKey:%d", actionKey); size_t Index1 = (i + 1) % ITEM_COUNT_3; size_t Index2 = (i + 2) % ITEM_COUNT_3; if ((Index1 > (ITEM_COUNT_3 - 1)) || (Index2 > (ITEM_COUNT_3 - 1))) { @@ -183,7 +179,6 @@ bool AccessibilityMouseKey::IsMouseKey(const std::vector &pressedKeys, CTRL_SHIFT_KEYCODE_V.end())) { metaKey1 = pressedKeys[Index1]; metaKey2 = pressedKeys[Index2]; - HILOG_DEBUG("metaKey1:%d, metaKey2:%d", metaKey1, metaKey2); return true; } } diff --git a/services/aams/test/BUILD.gn b/services/aams/test/BUILD.gn index 26d3f00f..d3d14cd6 100644 --- a/services/aams/test/BUILD.gn +++ b/services/aams/test/BUILD.gn @@ -34,6 +34,7 @@ config("module_private_config") { "//foundation/barrierfree/accessibility/interfaces/innerkits/common/include", "//foundation/barrierfree/accessibility/services/aams/include", "//foundation/barrierfree/accessibility/services/aams/test/mock/include", + "//foundation/barrierfree/accessibility/services/test/mock/common", "//foundation/barrierfree/accessibility/common/interface/include", "//foundation/barrierfree/accessibility/common/interface/include/parcel", "//foundation/barrierfree/accessibility/util/include", diff --git a/services/aams/test/mock/include/accessibility_ability_helper.h b/services/aams/test/mock/include/accessibility_ut_helper.h similarity index 85% rename from services/aams/test/mock/include/accessibility_ability_helper.h rename to services/aams/test/mock/include/accessibility_ut_helper.h index 596da1d9..f4292942 100644 --- a/services/aams/test/mock/include/accessibility_ability_helper.h +++ b/services/aams/test/mock/include/accessibility_ut_helper.h @@ -13,14 +13,10 @@ * limitations under the License. */ -#ifndef ACCESSIBILITY_ABILILTY_HELPER_H -#define ACCESSIBILITY_ABILILTY_HELPER_H +#ifndef ACCESSIBILITY_UT_HELPER_H +#define ACCESSIBILITY_UT_HELPER_H -#include -#include -#include #include -#include #include "accessibility_event_info.h" #include "hilog/log.h" #include "iremote_object.h" @@ -266,27 +262,6 @@ public: testKeyEvent_ = true; } - bool GetIsServicePublished() - { - return isServicePublished_; - } - - void SetIsServicePublished(bool publish) - { - isServicePublished_ = publish; - } - - void WaitForServicePublish() - { - while (1) { - constexpr int32_t SLEEP_TIME = 10; - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME)); - if (isServicePublished_) { - return; - } - } - } - int GetSendEventTimes() { return sendEventTimes_; @@ -331,22 +306,6 @@ public: { return zoomState_; } - - bool WaitForLoop(const std::function &compare, int32_t timeout) - { - constexpr int32_t SLEEP_TIME = 100; - int32_t count = timeout * 1000 / SLEEP_TIME; - while (count > 0) { - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME)); - if (compare() == true) { - return true; - } else { - count--; - } - } - return false; - } - public: static const int32_t accountId_ = 100; @@ -369,7 +328,6 @@ private: int testDisplayId_ = -1; int testStateType_ = -1; bool testKeyEvent_ = false; - bool isServicePublished_ = false; std::atomic sendEventTimes_ = 0; uint32_t testSequence_ = 0; int32_t keyCode_ = 0; @@ -379,4 +337,4 @@ private: }; } // namespace Accessibility } // namespace OHOS -#endif // ACCESSIBILITY_ABILILTY_HELPER_H \ No newline at end of file +#endif // ACCESSIBILITY_UT_HELPER_H \ No newline at end of file diff --git a/services/aams/test/mock/src/mock_accessibility_element_operator_proxy.cpp b/services/aams/test/mock/src/mock_accessibility_element_operator_proxy.cpp index bcb22c3c..908fd9e5 100644 --- a/services/aams/test/mock/src/mock_accessibility_element_operator_proxy.cpp +++ b/services/aams/test/mock/src/mock_accessibility_element_operator_proxy.cpp @@ -14,7 +14,7 @@ */ #include "accessibility_element_operator_proxy.h" -#include "accessibility_ability_helper.h" +#include "accessibility_ut_helper.h" #include "hilog_wrapper.h" namespace OHOS { @@ -23,9 +23,6 @@ AccessibilityElementOperatorProxy::AccessibilityElementOperatorProxy( const sptr &impl) : IRemoteProxy(impl) {} -AccessibilityElementOperatorProxy::~AccessibilityElementOperatorProxy() -{} - bool AccessibilityElementOperatorProxy::WriteInterfaceToken(MessageParcel &data) { (void)data; diff --git a/services/aams/test/mock/src/mock_accessibility_event_transmission.cpp b/services/aams/test/mock/src/mock_accessibility_event_transmission.cpp index 7004d2ea..a41313c0 100644 --- a/services/aams/test/mock/src/mock_accessibility_event_transmission.cpp +++ b/services/aams/test/mock/src/mock_accessibility_event_transmission.cpp @@ -14,8 +14,8 @@ */ #include -#include "accessibility_ability_helper.h" #include "accessibility_event_transmission.h" +#include "accessibility_ut_helper.h" #include "hilog_wrapper.h" namespace OHOS { diff --git a/services/aams/test/mock/src/mock_accessibility_keyevent_filter.cpp b/services/aams/test/mock/src/mock_accessibility_keyevent_filter.cpp index 910e5f14..8d1b09c6 100644 --- a/services/aams/test/mock/src/mock_accessibility_keyevent_filter.cpp +++ b/services/aams/test/mock/src/mock_accessibility_keyevent_filter.cpp @@ -14,7 +14,7 @@ */ #include "accessibility_keyevent_filter.h" -#include "accessibility_ability_helper.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_manager_service.h" #include "hilog_wrapper.h" diff --git a/services/aams/test/mock/src/mock_accessible_ability_client_proxy.cpp b/services/aams/test/mock/src/mock_accessible_ability_client_proxy.cpp index a2c6278c..6d136ea8 100644 --- a/services/aams/test/mock/src/mock_accessible_ability_client_proxy.cpp +++ b/services/aams/test/mock/src/mock_accessible_ability_client_proxy.cpp @@ -14,9 +14,9 @@ */ #include -#include "accessibility_ability_helper.h" #include "accessibility_account_data.h" #include "accessibility_event_info.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_channel_stub.h" #include "accessible_ability_client_proxy.h" #include "accessible_ability_connection.h" diff --git a/services/aams/test/mock/src/mock_accessible_ability_client_stub_impl.cpp b/services/aams/test/mock/src/mock_accessible_ability_client_stub_impl.cpp index 48346280..5d1c464b 100644 --- a/services/aams/test/mock/src/mock_accessible_ability_client_stub_impl.cpp +++ b/services/aams/test/mock/src/mock_accessible_ability_client_stub_impl.cpp @@ -15,7 +15,7 @@ #include "mock_accessible_ability_client_stub_impl.h" #include -#include "accessibility_ability_helper.h" +#include "accessibility_ut_helper.h" namespace OHOS { namespace Accessibility { diff --git a/services/aams/test/mock/src/mock_accessible_ability_manager_service.cpp b/services/aams/test/mock/src/mock_accessible_ability_manager_service.cpp index 0c0e1433..990602bf 100644 --- a/services/aams/test/mock/src/mock_accessible_ability_manager_service.cpp +++ b/services/aams/test/mock/src/mock_accessible_ability_manager_service.cpp @@ -15,9 +15,9 @@ #include #include "ability_info.h" -#include "accessibility_ability_helper.h" #include "accessibility_display_manager.h" #include "accessibility_event_info.h" +#include "accessibility_ut_helper.h" #include "accessibility_window_manager.h" #include "accessible_ability_manager_service.h" #include "hilog_wrapper.h" diff --git a/services/aams/test/mock/src/mock_display.cpp b/services/aams/test/mock/src/mock_display.cpp index dc08d6be..eac60bb6 100644 --- a/services/aams/test/mock/src/mock_display.cpp +++ b/services/aams/test/mock/src/mock_display.cpp @@ -17,6 +17,11 @@ #include "window/window_manager/utils/include/display_info.h" namespace OHOS::Rosen { +namespace { + const int32_t HEIGHT_VALUE = 1000; + const int32_t WEIGHT_VALUE = 600; +} // namespace + class Display::Impl : public RefBase { public: Impl(const std::string& name, sptr info) @@ -43,12 +48,12 @@ DisplayId Display::GetId() const int32_t Display::GetWidth() const { - return 600; + return WEIGHT_VALUE; } int32_t Display::GetHeight() const { - return 1000; + return HEIGHT_VALUE; } uint32_t Display::GetRefreshRate() const diff --git a/services/aams/test/mock/src/mock_os_account_manager.cpp b/services/aams/test/mock/src/mock_os_account_manager.cpp index 34f95670..4b32c323 100644 --- a/services/aams/test/mock/src/mock_os_account_manager.cpp +++ b/services/aams/test/mock/src/mock_os_account_manager.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "accessibility_ability_helper.h" +#include "accessibility_ut_helper.h" #include "os_account_manager.h" namespace OHOS { diff --git a/services/aams/test/mock/src/mock_system_ability.cpp b/services/aams/test/mock/src/mock_system_ability.cpp index 7683cbd4..2bc77880 100644 --- a/services/aams/test/mock/src/mock_system_ability.cpp +++ b/services/aams/test/mock/src/mock_system_ability.cpp @@ -13,7 +13,8 @@ * limitations under the License. */ -#include "accessibility_ability_helper.h" +#include "accessibility_common_helper.h" +#include "accessibility_ut_helper.h" #include "system_ability.h" using namespace OHOS; @@ -26,7 +27,7 @@ SystemAbility::~SystemAbility() bool SystemAbility::MakeAndRegisterAbility(SystemAbility* systemAbility) { (void)systemAbility; - Accessibility::AccessibilityAbilityHelper::GetInstance().SetIsServicePublished(false); + Accessibility::AccessibilityCommonHelper::GetInstance().SetIsServicePublished(false); return true; } @@ -46,7 +47,7 @@ bool SystemAbility::Publish(sptr systemAbility) { printf("Publish mock start"); systemAbility.ForceSetRefPtr(nullptr); - Accessibility::AccessibilityAbilityHelper::GetInstance().SetIsServicePublished(true); + Accessibility::AccessibilityCommonHelper::GetInstance().SetIsServicePublished(true); printf("Publish mock end"); return true; } diff --git a/services/aams/test/mock/src/mock_window_accessibility_controller.cpp b/services/aams/test/mock/src/mock_window_accessibility_controller.cpp index 902597f9..dc8fb7b3 100644 --- a/services/aams/test/mock/src/mock_window_accessibility_controller.cpp +++ b/services/aams/test/mock/src/mock_window_accessibility_controller.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "accessibility_ability_helper.h" +#include "accessibility_ut_helper.h" #include "window_accessibility_controller.h" namespace OHOS::Rosen { diff --git a/services/aams/test/unittest/accessibility_input_interceptor_test.cpp b/services/aams/test/unittest/accessibility_input_interceptor_test.cpp index 4009d15a..94818a06 100755 --- a/services/aams/test/unittest/accessibility_input_interceptor_test.cpp +++ b/services/aams/test/unittest/accessibility_input_interceptor_test.cpp @@ -14,8 +14,9 @@ */ #include -#include "accessibility_ability_helper.h" +#include "accessibility_common_helper.h" #include "accessibility_input_interceptor.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_manager_service.h" #include "iservice_registry.h" #include "mock_accessible_ability_manager_service.h" @@ -61,7 +62,7 @@ void AccessibilityInputInterceptorTest::SetUp() MMI::MockInputManager::ClearInputEventConsumer(); GTEST_LOG_(INFO) << "AccessibilityInputInterceptorTest SetUp"; Singleton::GetInstance().OnStart(); - AccessibilityAbilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_); inputInterceptor_ = AccessibilityInputInterceptor::GetInstance(); } diff --git a/services/aams/test/unittest/accessibility_keyevent_filter_test.cpp b/services/aams/test/unittest/accessibility_keyevent_filter_test.cpp index 26bfd039..67127e57 100644 --- a/services/aams/test/unittest/accessibility_keyevent_filter_test.cpp +++ b/services/aams/test/unittest/accessibility_keyevent_filter_test.cpp @@ -16,8 +16,9 @@ #include #include #include -#include "accessibility_ability_helper.h" +#include "accessibility_common_helper.h" #include "accessibility_keyevent_filter.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_channel.h" #include "accessible_ability_manager_service.h" #include "iservice_registry.h" @@ -64,7 +65,7 @@ void KeyEventFilterUnitTest::SetUp() { GTEST_LOG_(INFO) << "SetUp"; Singleton::GetInstance().OnStart(); - AccessibilityAbilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_); keyEventFilter_ = std::make_shared(); } diff --git a/services/aams/test/unittest/accessibility_mouse_autoclick_test.cpp b/services/aams/test/unittest/accessibility_mouse_autoclick_test.cpp index f8b7850a..1acbd349 100644 --- a/services/aams/test/unittest/accessibility_mouse_autoclick_test.cpp +++ b/services/aams/test/unittest/accessibility_mouse_autoclick_test.cpp @@ -16,8 +16,9 @@ #include #include #include -#include "accessibility_ability_helper.h" +#include "accessibility_common_helper.h" #include "accessibility_mouse_autoclick.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_manager_service.h" using namespace testing; @@ -54,7 +55,7 @@ void AccessibilityMouseAutoclickUnitTest::SetUp() { GTEST_LOG_(INFO) << "SetUp"; Singleton::GetInstance().OnStart(); - AccessibilityAbilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); mouseAutoclick_ = std::make_shared(); } diff --git a/services/aams/test/unittest/accessibility_mouse_key_test.cpp b/services/aams/test/unittest/accessibility_mouse_key_test.cpp index 00c48eb8..5d3ae76e 100644 --- a/services/aams/test/unittest/accessibility_mouse_key_test.cpp +++ b/services/aams/test/unittest/accessibility_mouse_key_test.cpp @@ -16,8 +16,8 @@ #include #include #include -#include "accessibility_ability_helper.h" #include "accessibility_mouse_key.h" +#include "accessibility_ut_helper.h" using namespace testing; using namespace testing::ext; diff --git a/services/aams/test/unittest/accessibility_short_key_test.cpp b/services/aams/test/unittest/accessibility_short_key_test.cpp index bcae8b52..36a4863b 100644 --- a/services/aams/test/unittest/accessibility_short_key_test.cpp +++ b/services/aams/test/unittest/accessibility_short_key_test.cpp @@ -16,8 +16,8 @@ #include #include #include -#include "accessibility_ability_helper.h" #include "accessibility_short_key.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_manager_service.h" using namespace testing; diff --git a/services/aams/test/unittest/accessibility_touchEvent_injector_test.cpp b/services/aams/test/unittest/accessibility_touchEvent_injector_test.cpp index 9bcb6890..5ddfbf35 100644 --- a/services/aams/test/unittest/accessibility_touchEvent_injector_test.cpp +++ b/services/aams/test/unittest/accessibility_touchEvent_injector_test.cpp @@ -14,8 +14,9 @@ */ #include -#include "accessibility_ability_helper.h" +#include "accessibility_common_helper.h" #include "accessibility_touchEvent_injector.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_client_proxy.h" #include "mock_accessible_ability_client_stub_impl.h" #include "mock_accessible_ability_manager_service.h" @@ -55,7 +56,7 @@ void TouchEventInjectorTest::SetUpTestCase() { GTEST_LOG_(INFO) << "TouchEventInjectorTest SetUpTestCase"; Singleton::GetInstance().OnStart(); - AccessibilityAbilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_); } diff --git a/services/aams/test/unittest/accessibility_touch_guider_test.cpp b/services/aams/test/unittest/accessibility_touch_guider_test.cpp index 9be30161..06cfd1bb 100755 --- a/services/aams/test/unittest/accessibility_touch_guider_test.cpp +++ b/services/aams/test/unittest/accessibility_touch_guider_test.cpp @@ -14,8 +14,9 @@ */ #include -#include "accessibility_ability_helper.h" +#include "accessibility_common_helper.h" #include "accessibility_touch_guider.h" +#include "accessibility_ut_helper.h" using namespace testing; using namespace testing::ext; @@ -134,7 +135,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_001, TestSize.Leve GTEST_LOG_(INFO) << "TouchGuider_Unittest_OnPointerEvent_001 start"; std::shared_ptr event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(0) == EventType::TYPE_TOUCH_BEGIN) { return true; } else { @@ -154,7 +155,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_002, TestSize.Leve GTEST_LOG_(INFO) << "TouchGuider_Unittest_OnPointerEvent_002 start"; std::shared_ptr event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(0) == EventType::TYPE_TOUCH_BEGIN) { return true; } else { @@ -165,7 +166,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_002, TestSize.Leve event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP); touchGuider_->OnPointerEvent(*event); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; @@ -195,7 +196,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_003, TestSize.Leve std::shared_ptr event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(1) == EventType::TYPE_TOUCH_GUIDE_BEGIN) { return true; @@ -206,7 +207,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_003, TestSize.Leve EXPECT_TRUE(ret); EventType eventType = AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(0); EXPECT_EQ(eventType, EventType::TYPE_TOUCH_BEGIN); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0) == MMI::PointerEvent::POINTER_ACTION_MOVE) { return true; @@ -218,7 +219,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_003, TestSize.Leve event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP); touchGuider_->OnPointerEvent(*event); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; @@ -244,7 +245,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_004, TestSize.Leve std::shared_ptr event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(1) == EventType::TYPE_TOUCH_GUIDE_BEGIN) { return true; @@ -255,7 +256,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_004, TestSize.Leve EXPECT_TRUE(ret); EventType eventType = AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(0); EXPECT_EQ(eventType, EventType::TYPE_TOUCH_BEGIN); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0) == MMI::PointerEvent::POINTER_ACTION_MOVE) { return true; @@ -272,7 +273,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_004, TestSize.Leve event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP); touchGuider_->OnPointerEvent(*event); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; } else { @@ -307,7 +308,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_005, TestSize.Leve std::shared_ptr event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(0) == EventType::TYPE_TOUCH_BEGIN) { return true; @@ -322,7 +323,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_005, TestSize.Leve touchGuider_->OnPointerEvent(*event); event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 2, 0, 0); touchGuider_->OnPointerEvent(*event); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0) == MMI::PointerEvent::POINTER_ACTION_DOWN) { return true; @@ -339,7 +340,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_005, TestSize.Leve points.clear(); event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 1, 0, 0); touchGuider_->OnPointerEvent(*event); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(1) == EventType::TYPE_TOUCH_END) { return true; @@ -377,7 +378,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_006, TestSize.Leve std::shared_ptr event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(0) == EventType::TYPE_TOUCH_BEGIN) { return true; @@ -397,7 +398,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_006, TestSize.Leve event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 3, 0, 0); touchGuider_->OnPointerEvent(*event); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0) == MMI::PointerEvent::POINTER_ACTION_DOWN) { return true; @@ -421,7 +422,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_007, TestSize.Leve std::shared_ptr event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(1) == EventType::TYPE_TOUCH_GUIDE_BEGIN) { return true; @@ -433,7 +434,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_007, TestSize.Leve EventType eventType = AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(0); EXPECT_EQ(eventType, EventType::TYPE_TOUCH_BEGIN); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0) == MMI::PointerEvent::POINTER_ACTION_MOVE) { return true; @@ -480,7 +481,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_008, TestSize.Leve event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 2, 0, 0); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(0) == EventType::TYPE_TOUCH_BEGIN) { return true; @@ -489,7 +490,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_008, TestSize.Leve } }), SLEEP_TIME_3); EXPECT_TRUE(ret); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0) == MMI::PointerEvent::POINTER_ACTION_DOWN) { return true; @@ -502,7 +503,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_008, TestSize.Leve points.emplace_back(otherPoint1); event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 3, 0, 0); touchGuider_->OnPointerEvent(*event); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1) == MMI::PointerEvent::POINTER_ACTION_UP) { return true; @@ -536,7 +537,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_009, TestSize.Leve std::shared_ptr event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(0) == EventType::TYPE_TOUCH_BEGIN) { return true; @@ -551,7 +552,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_009, TestSize.Leve touchGuider_->OnPointerEvent(*event); event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 2, 0, 0); touchGuider_->OnPointerEvent(*event); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0) == MMI::PointerEvent::POINTER_ACTION_DOWN) { return true; @@ -563,7 +564,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_009, TestSize.Leve event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 2, 0, 0); touchGuider_->OnPointerEvent(*event); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1) == MMI::PointerEvent::POINTER_ACTION_MOVE) { return true; @@ -601,7 +602,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_010, TestSize.Leve std::shared_ptr event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1, 0, 0); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(0) == EventType::TYPE_TOUCH_BEGIN) { return true; @@ -619,7 +620,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_010, TestSize.Leve points.emplace_back(otherPoint1); event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_MOVE, points, 3, 0, 0); touchGuider_->OnPointerEvent(*event); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1) == MMI::PointerEvent::POINTER_ACTION_UP) { return true; @@ -646,7 +647,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_011, TestSize.Leve std::shared_ptr event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_DOWN); touchGuider_->OnPointerEvent(*event); - bool ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(1) == EventType::TYPE_TOUCH_GUIDE_BEGIN) { return true; @@ -656,7 +657,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_011, TestSize.Leve }), SLEEP_TIME_3); EXPECT_TRUE(ret); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0) == MMI::PointerEvent::POINTER_ACTION_MOVE) { return true; @@ -676,7 +677,7 @@ HWTEST_F(TouchGuiderTest, TouchGuider_Unittest_OnPointerEvent_011, TestSize.Leve AccessibilityEventInfo accessibilityEvent; accessibilityEvent.SetEventType(EventType::TYPE_VIEW_HOVER_EXIT_EVENT); touchGuider_->OnAccessibilityEvent(accessibilityEvent); - ret = AccessibilityAbilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityAbilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; } else { diff --git a/services/aams/test/unittest/accessibility_window_manager_test.cpp b/services/aams/test/unittest/accessibility_window_manager_test.cpp index a7cc54e2..bbad81ff 100644 --- a/services/aams/test/unittest/accessibility_window_manager_test.cpp +++ b/services/aams/test/unittest/accessibility_window_manager_test.cpp @@ -14,9 +14,9 @@ */ #include -#include "accessibility_ability_helper.h" #include "accessibility_account_data.h" #include "accessibility_element_operator_proxy.h" +#include "accessibility_ut_helper.h" #include "accessibility_window_manager.h" #include "accessible_ability_manager_service.h" #include "iservice_registry.h" diff --git a/services/aams/test/unittest/accessibility_zoom_gesture_test.cpp b/services/aams/test/unittest/accessibility_zoom_gesture_test.cpp index aa2d55fa..b4228052 100644 --- a/services/aams/test/unittest/accessibility_zoom_gesture_test.cpp +++ b/services/aams/test/unittest/accessibility_zoom_gesture_test.cpp @@ -16,7 +16,7 @@ #include #include #include -#include "accessibility_ability_helper.h" +#include "accessibility_ut_helper.h" #include "accessibility_zoom_gesture.h" #include "accessible_ability_manager_service.h" diff --git a/services/aams/test/unittest/accessible_ability_channel_test.cpp b/services/aams/test/unittest/accessible_ability_channel_test.cpp index fcc2a8c2..a2d35bca 100644 --- a/services/aams/test/unittest/accessible_ability_channel_test.cpp +++ b/services/aams/test/unittest/accessible_ability_channel_test.cpp @@ -15,9 +15,9 @@ #include #include "accessibility_ability_info.h" -#include "accessibility_ability_helper.h" #include "accessibility_account_data.h" #include "accessibility_element_operator_proxy.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_channel.h" #include "accessible_ability_connection.h" #include "accessible_ability_manager_service.h" @@ -114,7 +114,6 @@ bool AccessibleAbilityChannelUnitTest::TestElementId() if (elementId == ELEMENT_ID) { GTEST_LOG_(INFO) << "element id is true"; return true; - break; } retryCount++; } diff --git a/services/aams/test/unittest/accessible_ability_connection_test.cpp b/services/aams/test/unittest/accessible_ability_connection_test.cpp index 3db19f2a..72e9a078 100644 --- a/services/aams/test/unittest/accessible_ability_connection_test.cpp +++ b/services/aams/test/unittest/accessible_ability_connection_test.cpp @@ -15,9 +15,10 @@ #include #include -#include "accessibility_ability_helper.h" +#include "accessibility_common_helper.h" #include "accessibility_element_operator_proxy.h" #include "accessibility_element_operator_stub.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_connection.h" #include "accessible_ability_manager_service.h" #include "iservice_registry.h" @@ -71,7 +72,7 @@ void AccessibleAbilityConnectionUnitTest::SetUp() GTEST_LOG_(INFO) << "SetUp"; // Start AAMS Singleton::GetInstance().OnStart(); - AccessibilityAbilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_); // new Interaction proxy diff --git a/services/aams/test/unittest/accessible_ability_manager_service_test.cpp b/services/aams/test/unittest/accessible_ability_manager_service_test.cpp index f5b18211..063a8e92 100644 --- a/services/aams/test/unittest/accessible_ability_manager_service_test.cpp +++ b/services/aams/test/unittest/accessible_ability_manager_service_test.cpp @@ -15,9 +15,10 @@ #include #include -#include "accessibility_ability_helper.h" #include "accessibility_ability_info.h" +#include "accessibility_common_helper.h" #include "accessibility_display_manager.h" +#include "accessibility_ut_helper.h" #include "accessible_ability_manager_service.h" #include "iservice_registry.h" #include "mock_accessible_ability_client_stub_impl.h" @@ -64,7 +65,7 @@ void AccessibleAbilityManagerServiceUnitTest::SetUp() { GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest SetUp"; Singleton::GetInstance().OnStart(); - AccessibilityAbilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_); stub_ = new MockAccessibleAbilityClientStubImpl(); } diff --git a/services/test/BUILD.gn b/services/test/BUILD.gn index a83127f6..e24fd99f 100644 --- a/services/test/BUILD.gn +++ b/services/test/BUILD.gn @@ -38,6 +38,7 @@ config("module_private_config") { "//foundation/barrierfree/accessibility/interfaces/innerkits/common/include", "//foundation/barrierfree/accessibility/services/aams/include", "//foundation/barrierfree/accessibility/services/test/mock", + "//foundation/barrierfree/accessibility/services/test/mock/common", "//foundation/barrierfree/accessibility/util/include", "//base/account/os_account/frameworks/common/account_error/include", "//base/account/os_account/frameworks/common/database/include", diff --git a/services/test/mock/accessibility_helper.h b/services/test/mock/accessibility_mt_helper.h similarity index 79% rename from services/test/mock/accessibility_helper.h rename to services/test/mock/accessibility_mt_helper.h index 5fa5d6e7..80f2a876 100644 --- a/services/test/mock/accessibility_helper.h +++ b/services/test/mock/accessibility_mt_helper.h @@ -13,11 +13,9 @@ * limitations under the License. */ -#ifndef ACCESSIBILITY_HELPER_H -#define ACCESSIBILITY_HELPER_H +#ifndef ACCESSIBILITY_MT_HELPER_H +#define ACCESSIBILITY_MT_HELPER_H -#include -#include #include #include "accessibility_def.h" #include "hilog/log.h" @@ -33,7 +31,6 @@ public: static AccessibilityHelper helper; return helper; } - int32_t GetTestWindowId() { return testWindowId_; @@ -61,7 +58,6 @@ public: std::lock_guard lock(mtx_); mTeventType_.push_back(eventType); } - int32_t GetGestureId() { return mTgestureId_; @@ -102,7 +98,6 @@ public: { testWindowChangeTypes_ = testWindowChangeTypes; } - int32_t GetTestChannalId() { return testChannalId_; @@ -111,7 +106,6 @@ public: { testChannalId_ = testChannalId; } - int32_t GetTestKeyPressEvent() { return testKeyPressEvent_; @@ -120,7 +114,6 @@ public: { testKeyPressEvent_ = testKeyPressEvent; } - int32_t GetTestDisplayId() { return testDisplayId_; @@ -129,7 +122,6 @@ public: { testDisplayId_ = testDisplayId; } - int32_t GetTestGesture() { return testGesture_; @@ -138,7 +130,6 @@ public: { testGesture_ = testGesture; } - int32_t GetTestGestureSimulateResult() { return testGestureSimulateResult_; @@ -147,39 +138,6 @@ public: { testGestureSimulateResult_ = testGestureSimulateResult; } - - bool GetIsServicePublished() - { - return isServicePublished_; - } - void SetIsServicePublished(bool publish) - { - isServicePublished_ = publish; - } - void WaitForServicePublish() - { - int32_t sleepTime = 10; - while (1) { - std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime)); - if (isServicePublished_) { - return; - } - } - } - bool WaitForLoop(const std::function &compare, int32_t timeout) - { - constexpr int32_t SLEEP_TIME = 100; - int32_t count = timeout * 1000 / SLEEP_TIME; - while (count > 0) { - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME)); - if (compare() == true) { - return true; - } else { - count--; - } - } - return false; - } public: static const int32_t accountId_ = 100; @@ -196,9 +154,8 @@ private: int32_t testKeyPressEvent_ = -1; int32_t testDisplayId_ = -1; int32_t testGestureSimulateResult_ = -1; - bool isServicePublished_ = false; std::mutex mtx_; }; } // namespace Accessibility } // namespace OHOS -#endif // ACCESSIBILITY_HELPER_H \ No newline at end of file +#endif // ACCESSIBILITY_MT_HELPER_H \ No newline at end of file diff --git a/services/test/mock/common/accessibility_common_helper.h b/services/test/mock/common/accessibility_common_helper.h new file mode 100644 index 00000000..8ba5cd5f --- /dev/null +++ b/services/test/mock/common/accessibility_common_helper.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ACCESSIBILITY_COMMON_HELPER_H +#define ACCESSIBILITY_COMMON_HELPER_H + +#include +#include +#include +#include + +namespace OHOS { +namespace Accessibility { +class AccessibilityCommonHelper { +public: + static AccessibilityCommonHelper& GetInstance() + { + static AccessibilityCommonHelper helper; + return helper; + } + + bool GetIsServicePublished() + { + return isServicePublished_; + } + + void SetIsServicePublished(bool publish) + { + isServicePublished_ = publish; + } + + void WaitForServicePublish() + { + while (1) { + constexpr int32_t sleepTime = 10; + std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime)); + if (isServicePublished_) { + return; + } + } + } + + bool WaitForLoop(const std::function &compare, int32_t timeout) + { + constexpr int32_t sleepTime = 100; + int32_t count = timeout * 1000 / sleepTime; + while (count > 0) { + std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime)); + if (compare() == true) { + return true; + } else { + count--; + } + } + return false; + } + +private: + bool isServicePublished_ = false; +}; +} // namespace Accessibility +} // namespace OHOS +#endif // ACCESSIBILITY_COMMON_HELPER_H \ No newline at end of file diff --git a/services/test/mock/mock_accessibility_element_operator_impl.h b/services/test/mock/mock_accessibility_element_operator_impl.h index c35bb4c2..0b64560d 100644 --- a/services/test/mock/mock_accessibility_element_operator_impl.h +++ b/services/test/mock/mock_accessibility_element_operator_impl.h @@ -53,7 +53,7 @@ public: * PREFETCH_CHILDREN: Need to make the child node info also. * otherwise: Make the node information by elementId only. */ - virtual void SearchElementInfoByAccessibilityId(const int32_t elementId, const int32_t requestId, + void SearchElementInfoByAccessibilityId(const int32_t elementId, const int32_t requestId, const sptr& callback, const int32_t mode) override; /** @@ -63,7 +63,7 @@ public: * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param text Filter for the child components to matched with the text */ - virtual void SearchElementInfosByText(const int32_t elementId, const std::string& text, const int32_t requestId, + void SearchElementInfosByText(const int32_t elementId, const std::string& text, const int32_t requestId, const sptr& callback) override; /** @@ -74,7 +74,7 @@ public: * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus * FOCUS_TYPE_INPUT: text input focus */ - virtual void FindFocusedElementInfo(const int32_t elementId, const int32_t focusType, const int32_t requestId, + void FindFocusedElementInfo(const int32_t elementId, const int32_t focusType, const int32_t requestId, const sptr& callback) override; /** @@ -84,7 +84,7 @@ public: * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) */ - virtual void FocusMoveSearch(const int32_t elementId, const int32_t direction, const int32_t requestId, + void FocusMoveSearch(const int32_t elementId, const int32_t direction, const int32_t requestId, const sptr& callback) override; /** @@ -108,7 +108,7 @@ public: * action: ACCESSIBILITY_ACTION_SET_TEXT, * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") */ - virtual void ExecuteAction(const int32_t elementId, const int32_t action, + void ExecuteAction(const int32_t elementId, const int32_t action, const std::map &actionArguments, int32_t requestId, const sptr& callback) override; @@ -117,14 +117,14 @@ public: * to the id of active window when sendAccessibility. */ - virtual void ClearFocus() override; + void ClearFocus() override; /** * @brief the low layer is notified by the function called while accessibility system execute * the function of executeAction from AS to check the all low windows cared the outside event. * Example: PopupWindow receive the OUTSIDE_EVENT to close itself. */ - virtual void OutsideTouch() override; + void OutsideTouch() override; /** * @brief Get the window id related with operator object @@ -152,7 +152,7 @@ public: * @param infos The element info searched by accessibility id. * @param requestId The request id from AA, it is used to match with request and response. */ - virtual void SetSearchElementInfoByAccessibilityIdResult( + void SetSearchElementInfoByAccessibilityIdResult( const std::list& infos, const int32_t requestId) override; /** @@ -160,7 +160,7 @@ public: * @param infos The element information searched matched with text. * @param requestId The request id from AA, it is used to match with request and response. */ - virtual void SetSearchElementInfoByTextResult( + void SetSearchElementInfoByTextResult( const std::list& infos, const int32_t requestId) override; /** @@ -168,7 +168,7 @@ public: * @param info The element information searched matched with focus type. * @param requestId The request id from AA, it is used to match with request and response. */ - virtual void SetFindFocusedElementInfoResult( + void SetFindFocusedElementInfoResult( const AccessibilityElementInfo& info, const int32_t requestId) override; /** @@ -176,14 +176,14 @@ public: * @param info The element information searched by focus direction. * @param requestId The request id from AA, it is used to match with request and response. */ - virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo& info, const int32_t requestId) override; + void SetFocusMoveSearchResult(const AccessibilityElementInfo& info, const int32_t requestId) override; /** * @brief Set the result of action executed to AA. * @param succeeded True: The action is executed successfully; otherwise is false. * @param requestId The request id from AA, it is used to match with request and response. */ - virtual void SetExecuteActionResult(const bool succeeded, const int32_t requestId) override; + void SetExecuteActionResult(const bool succeeded, const int32_t requestId) override; private: std::mutex mutex_; diff --git a/services/test/mock/mock_accessibility_element_operator_proxy.cpp b/services/test/mock/mock_accessibility_element_operator_proxy.cpp index 50227979..b7753127 100644 --- a/services/test/mock/mock_accessibility_element_operator_proxy.cpp +++ b/services/test/mock/mock_accessibility_element_operator_proxy.cpp @@ -28,9 +28,6 @@ MockAccessibilityElementOperatorProxy::MockAccessibilityElementOperatorProxy(con GTEST_LOG_(INFO) << "MockAccessibilityElementOperatorProxy"; } -MockAccessibilityElementOperatorProxy::~MockAccessibilityElementOperatorProxy() -{} - bool MockAccessibilityElementOperatorProxy::WriteInterfaceToken(MessageParcel& data) { return true; diff --git a/services/test/mock/mock_accessibility_element_operator_proxy.h b/services/test/mock/mock_accessibility_element_operator_proxy.h index ae2be896..8266fb97 100644 --- a/services/test/mock/mock_accessibility_element_operator_proxy.h +++ b/services/test/mock/mock_accessibility_element_operator_proxy.h @@ -36,7 +36,7 @@ public: /** * @brief destruct function */ - virtual ~MockAccessibilityElementOperatorProxy() override; + virtual ~MockAccessibilityElementOperatorProxy() = default; /** * @brief Make the node information by accessibility ID and set the result by callback. @@ -49,7 +49,7 @@ public: * otherwise: Make the node information by elementId only. * @sysCap Accessibility */ - virtual void SearchElementInfoByAccessibilityId(const int32_t elementId, const int32_t requestId, + void SearchElementInfoByAccessibilityId(const int32_t elementId, const int32_t requestId, const sptr& callback, const int32_t mode) override; /** @@ -59,7 +59,7 @@ public: * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param text Filter for the child components to matched with the text */ - virtual void SearchElementInfosByText(const int32_t elementId, const std::string& text, const int32_t requestId, + void SearchElementInfosByText(const int32_t elementId, const std::string& text, const int32_t requestId, const sptr& callback) override; /** @@ -70,7 +70,7 @@ public: * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus * FOCUS_TYPE_INPUT: text input focus */ - virtual void FindFocusedElementInfo(const int32_t elementId, const int32_t focusType, const int32_t requestId, + void FindFocusedElementInfo(const int32_t elementId, const int32_t focusType, const int32_t requestId, const sptr& callback) override; /** @@ -80,7 +80,7 @@ public: * @param callback To transfer the node info to ASAC and it defined by ASAC. * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) */ - virtual void FocusMoveSearch(const int32_t elementId, const int32_t direction, const int32_t requestId, + void FocusMoveSearch(const int32_t elementId, const int32_t direction, const int32_t requestId, const sptr& callback) override; /** @@ -104,7 +104,7 @@ public: * action: ACCESSIBILITY_ACTION_SET_TEXT, * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") */ - virtual void ExecuteAction(const int32_t elementId, const int32_t action, + void ExecuteAction(const int32_t elementId, const int32_t action, const std::map &actionArguments, int32_t requestId, const sptr& callback) override; @@ -112,14 +112,14 @@ public: * @brief The function is called while accessibility System check the id of window is not equal * to the id of active window when sendAccessibility. */ - virtual void ClearFocus() override; + void ClearFocus() override; /** * @brief the low layer is notified by the function called while accessibility system execute * the function of executeAction from AS to check the all low windows cared the outside event. * Example: PopupWindow receive the OUTSIDE_EVENT to close itself. */ - virtual void OutsideTouch() override; + void OutsideTouch() override; int32_t testElementId_ = -1; int32_t testClearFocus_ = -1; diff --git a/services/test/mock/mock_accessible_ability_client_proxy.cpp b/services/test/mock/mock_accessible_ability_client_proxy.cpp index c468a642..cfd75b55 100644 --- a/services/test/mock/mock_accessible_ability_client_proxy.cpp +++ b/services/test/mock/mock_accessible_ability_client_proxy.cpp @@ -16,7 +16,7 @@ #include #include "accessibility_account_data.h" #include "accessibility_event_info.h" -#include "accessibility_helper.h" +#include "accessibility_mt_helper.h" #include "accessible_ability_channel_stub.h" #include "accessible_ability_client_proxy.h" #include "accessible_ability_connection.h" diff --git a/services/test/mock/mock_bundle_manager.cpp b/services/test/mock/mock_bundle_manager.cpp index b658e1fd..6bf49a4c 100644 --- a/services/test/mock/mock_bundle_manager.cpp +++ b/services/test/mock/mock_bundle_manager.cpp @@ -26,7 +26,7 @@ using namespace OHOS::AAFwk; namespace OHOS { namespace { - const std::string AccessibleAbility_JSON_FILE_PATH = "/system/app/dummy_accessibility_ability_config.json"; + const std::string ACCESSIBLE_ABILITY_JSON_FILE_PAT = "/system/app/dummy_accessibility_ability_config.json"; } // namespace namespace AppExecFwk { @@ -263,7 +263,7 @@ bool BundleMgrClient::GetResConfigFile(const ExtensionAbilityInfo& extensionInfo std::vector& profileInfos) const { std::ifstream jsonFileStream; - jsonFileStream.open(AccessibleAbility_JSON_FILE_PATH, std::ios::in); + jsonFileStream.open(ACCESSIBLE_ABILITY_JSON_FILE_PAT, std::ios::in); if (!jsonFileStream.is_open()) { HILOG_ERROR("Open json file failed."); return false; diff --git a/services/test/mock/mock_bundle_manager.h b/services/test/mock/mock_bundle_manager.h index e07a5cc8..f32d2efd 100644 --- a/services/test/mock/mock_bundle_manager.h +++ b/services/test/mock/mock_bundle_manager.h @@ -37,7 +37,7 @@ const std::string COM_IX_HIDATA = "com.ix.hiData"; class BundleMgrStub : public IRemoteStub { public: DECLARE_INTERFACE_DESCRIPTOR(u"IBundleMgr"); - virtual int OnRemoteRequest( + int OnRemoteRequest( uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; }; diff --git a/services/test/mock/mock_os_account_manager.cpp b/services/test/mock/mock_os_account_manager.cpp index 1e33ce95..e8fd0d1f 100644 --- a/services/test/mock/mock_os_account_manager.cpp +++ b/services/test/mock/mock_os_account_manager.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "accessibility_helper.h" +#include "accessibility_mt_helper.h" #include "os_account_manager.h" namespace OHOS { diff --git a/services/test/mock/mock_system_ability.cpp b/services/test/mock/mock_system_ability.cpp index 4d45baee..fa4b9412 100644 --- a/services/test/mock/mock_system_ability.cpp +++ b/services/test/mock/mock_system_ability.cpp @@ -14,7 +14,8 @@ */ #include -#include "accessibility_helper.h" +#include "accessibility_common_helper.h" +#include "accessibility_mt_helper.h" #include "system_ability.h" namespace OHOS { @@ -39,7 +40,7 @@ SystemAbility::~SystemAbility() bool SystemAbility::MakeAndRegisterAbility(SystemAbility* systemAbility) { (void)systemAbility; - Accessibility::AccessibilityHelper::GetInstance().SetIsServicePublished(false); + Accessibility::AccessibilityCommonHelper::GetInstance().SetIsServicePublished(false); return true; } @@ -59,7 +60,7 @@ bool SystemAbility::Publish(sptr systemAbility) { (void)systemAbility; systemAbility.ForceSetRefPtr(nullptr); - Accessibility::AccessibilityHelper::GetInstance().SetIsServicePublished(true); + Accessibility::AccessibilityCommonHelper::GetInstance().SetIsServicePublished(true); return true; } diff --git a/services/test/mock/multimodalinput/src/mock_input_manager.cpp b/services/test/mock/multimodalinput/src/mock_input_manager.cpp index c1f74cd1..56d2e688 100644 --- a/services/test/mock/multimodalinput/src/mock_input_manager.cpp +++ b/services/test/mock/multimodalinput/src/mock_input_manager.cpp @@ -22,7 +22,7 @@ static int mockKeyCode = -1; static std::vector mockTouchActions; static std::function)> mockKeyEventCallback = nullptr; static std::shared_ptr mockInputEventConsumer = nullptr; -static std::mutex mtx_; +static std::mutex g_mtx; int MockInputManager::GetKeyCode() { @@ -31,19 +31,19 @@ int MockInputManager::GetKeyCode() void MockInputManager::ClearTouchActions() { - std::lock_guard lock(mtx_); + std::lock_guard lock(g_mtx); mockTouchActions.clear(); } std::vector MockInputManager::GetTouchActions() { - std::lock_guard lock(mtx_); + std::lock_guard lock(g_mtx); return mockTouchActions; } int32_t MockInputManager::GetTouchActionOfTargetIndex(int32_t index) { - std::lock_guard lock(mtx_); + std::lock_guard lock(g_mtx); int32_t size = static_cast(mockTouchActions.size()); if (size > index) { return mockTouchActions[index]; @@ -80,7 +80,7 @@ void InputManager::SimulateInputEvent(std::shared_ptr keyEvent) void InputManager::SimulateInputEvent(std::shared_ptr pointerEvent) { - std::lock_guard lock(mtx_); + std::lock_guard lock(g_mtx); int32_t touchAction = pointerEvent->GetPointerAction(); mockTouchActions.push_back(touchAction); } diff --git a/services/test/moduletest/aamstest/aams_accessibility_keyevent_filter_test/aams_accessibility_keyevent_filter_test.cpp b/services/test/moduletest/aamstest/aams_accessibility_keyevent_filter_test/aams_accessibility_keyevent_filter_test.cpp index e08cc7ee..88752121 100644 --- a/services/test/moduletest/aamstest/aams_accessibility_keyevent_filter_test/aams_accessibility_keyevent_filter_test.cpp +++ b/services/test/moduletest/aamstest/aams_accessibility_keyevent_filter_test/aams_accessibility_keyevent_filter_test.cpp @@ -18,8 +18,9 @@ #include #include #include "accessibility_account_data.h" -#include "accessibility_helper.h" +#include "accessibility_common_helper.h" #include "accessibility_input_interceptor.h" +#include "accessibility_mt_helper.h" #include "accessible_ability_channel.h" #include "accessible_ability_connection.h" #include "accessible_ability_manager_service.h" @@ -86,7 +87,7 @@ void AamsKeyEventFilterTest::SetUp() GTEST_LOG_(INFO) << "AamsKeyEventFilterTest ModuleTest SetUp"; Singleton::GetInstance().OnStart(); - AccessibilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityHelper::accountId_); GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published"; diff --git a/services/test/moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp b/services/test/moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp index e1df8f4d..139a5ae1 100644 --- a/services/test/moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp +++ b/services/test/moduletest/aamstest/aams_accessibility_touchEvent_injector_test/aams_accessibility_touchEvent_injector_test.cpp @@ -14,10 +14,11 @@ */ #include +#include "accessibility_common_helper.h" #include "accessibility_display_manager.h" #include "accessibility_element_operator_stub.h" -#include "accessibility_helper.h" #include "accessibility_input_interceptor.h" +#include "accessibility_mt_helper.h" #include "accessibility_touch_guider.h" #include "accessibility_touchEvent_injector.h" #include "accessibility_window_manager.h" @@ -73,7 +74,7 @@ void AamsInjectorTest::SetUp() GTEST_LOG_(INFO) << "AamsInjectorTest SetUp"; Singleton::GetInstance().OnStart(); - AccessibilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityHelper::accountId_); GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published"; diff --git a/services/test/moduletest/aamstest/aams_accessibility_touch_guider_test/aams_accessibility_touch_guider_test.cpp b/services/test/moduletest/aamstest/aams_accessibility_touch_guider_test/aams_accessibility_touch_guider_test.cpp index 9faecba8..0f22a809 100755 --- a/services/test/moduletest/aamstest/aams_accessibility_touch_guider_test/aams_accessibility_touch_guider_test.cpp +++ b/services/test/moduletest/aamstest/aams_accessibility_touch_guider_test/aams_accessibility_touch_guider_test.cpp @@ -17,10 +17,11 @@ #include #include "accessibility_touch_guider.h" #include "accessibility_account_data.h" +#include "accessibility_common_helper.h" #include "accessibility_display_manager.h" #include "accessibility_element_operator_stub.h" -#include "accessibility_helper.h" #include "accessibility_input_interceptor.h" +#include "accessibility_mt_helper.h" #include "accessible_ability_channel.h" #include "accessible_ability_connection.h" #include "accessible_ability_manager_service.h" @@ -89,7 +90,7 @@ void AamsTouchGuideTest::SetUp() GTEST_LOG_(INFO) << "AamsTouchGuideTest SetUp"; Singleton::GetInstance().OnStart(); - AccessibilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityHelper::accountId_); GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published"; @@ -244,7 +245,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent001, Te points.emplace_back(point4); event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 2); inputEventConsumer->OnInputEvent(event); - bool ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(1) == EventType::TYPE_TOUCH_END) { return true; @@ -255,7 +256,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent001, Te EXPECT_TRUE(ret); EXPECT_EQ(AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(0), EventType::TYPE_TOUCH_BEGIN); - ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (MMI::MockInputManager::GetTouchActionOfTargetIndex(2) == MMI::PointerEvent::POINTER_ACTION_UP) { return true; } else { @@ -286,7 +287,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent002, Te return; } inputEventConsumer->OnInputEvent(event); - bool ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(1) == EventType::TYPE_TOUCH_GUIDE_BEGIN) { return true; @@ -301,7 +302,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent002, Te inputEventConsumer->OnInputEvent(event); event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, 1); inputEventConsumer->OnInputEvent(event); - ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; @@ -374,7 +375,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent003, Te event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1); inputEventConsumer->OnInputEvent(event); // Determine event type - bool ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; @@ -393,7 +394,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent003, Te EXPECT_EQ(MMI::MockInputManager::GetTouchActionOfTargetIndex(1), MMI::PointerEvent::POINTER_ACTION_MOVE); EXPECT_EQ(MMI::MockInputManager::GetTouchActionOfTargetIndex(2), MMI::PointerEvent::POINTER_ACTION_MOVE); // Determine gesture type - ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetGestureId() == static_cast(GestureType::GESTURE_SWIPE_LEFT_THEN_RIGHT)) { return true; @@ -463,7 +464,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent004, Te event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1); inputEventConsumer->OnInputEvent(event); // Determine event type - bool ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; @@ -482,7 +483,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent004, Te EXPECT_EQ(MMI::MockInputManager::GetTouchActionOfTargetIndex(1), MMI::PointerEvent::POINTER_ACTION_MOVE); EXPECT_EQ(MMI::MockInputManager::GetTouchActionOfTargetIndex(2), MMI::PointerEvent::POINTER_ACTION_MOVE); // Determine gesture type - ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetGestureId() == static_cast(GestureType::GESTURE_SWIPE_DOWN_THEN_UP)) { return true; @@ -552,7 +553,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent005, Te event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1); inputEventConsumer->OnInputEvent(event); // Determine event type - bool ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; @@ -571,7 +572,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent005, Te EXPECT_EQ(MMI::MockInputManager::GetTouchActionOfTargetIndex(1), MMI::PointerEvent::POINTER_ACTION_MOVE); EXPECT_EQ(MMI::MockInputManager::GetTouchActionOfTargetIndex(2), MMI::PointerEvent::POINTER_ACTION_MOVE); // Determine gesture type - ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetGestureId() == static_cast(GestureType::GESTURE_SWIPE_RIGHT_THEN_LEFT)) { return true; @@ -641,7 +642,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent006, Te event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1); inputEventConsumer->OnInputEvent(event); // Determine event type - bool ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; @@ -660,7 +661,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent006, Te EXPECT_EQ(MMI::MockInputManager::GetTouchActionOfTargetIndex(1), MMI::PointerEvent::POINTER_ACTION_MOVE); EXPECT_EQ(MMI::MockInputManager::GetTouchActionOfTargetIndex(2), MMI::PointerEvent::POINTER_ACTION_MOVE); // Determine gesture type - ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetGestureId() == static_cast(GestureType::GESTURE_SWIPE_UP_THEN_DOWN)) { return true; @@ -721,7 +722,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent007, Te event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1); inputEventConsumer->OnInputEvent(event); // Determine event type - bool ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; @@ -739,7 +740,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent007, Te EXPECT_EQ(MMI::MockInputManager::GetTouchActionOfTargetIndex(0), MMI::PointerEvent::POINTER_ACTION_MOVE); EXPECT_EQ(MMI::MockInputManager::GetTouchActionOfTargetIndex(1), MMI::PointerEvent::POINTER_ACTION_MOVE); // Determine gesture type - ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetGestureId() == static_cast(GestureType::GESTURE_SWIPE_UP)) { return true; } else { @@ -773,7 +774,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent008, Te event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, 1); inputEventConsumer->OnInputEvent(event); // Determine event type - bool ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; @@ -830,7 +831,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent009, Te event = CreateTouchEvent(MMI::PointerEvent::POINTER_ACTION_UP, points, 0, 0, 1); inputEventConsumer->OnInputEvent(event); // Determine event type - bool ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; @@ -881,7 +882,7 @@ HWTEST_F(AamsTouchGuideTest, AamsTouchGuideTest_Moduletest_OnPointerEvent010, Te inputEventConsumer->OnInputEvent(event); // Determine event type - bool ret = AccessibilityHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { + bool ret = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool { if (AccessibilityHelper::GetInstance().GetEventTypeOfTargetIndex(3) == EventType::TYPE_TOUCH_END) { return true; diff --git a/services/test/moduletest/aamstest/aams_accessible_ability_channel_test/aams_accessible_ability_channel_test.cpp b/services/test/moduletest/aamstest/aams_accessible_ability_channel_test/aams_accessible_ability_channel_test.cpp index b2054148..116018b3 100644 --- a/services/test/moduletest/aamstest/aams_accessible_ability_channel_test/aams_accessible_ability_channel_test.cpp +++ b/services/test/moduletest/aamstest/aams_accessible_ability_channel_test/aams_accessible_ability_channel_test.cpp @@ -14,9 +14,10 @@ */ #include +#include "accessibility_common_helper.h" #include "accessibility_display_manager.h" #include "accessibility_element_operator_stub.h" -#include "accessibility_helper.h" +#include "accessibility_mt_helper.h" #include "accessible_ability_channel.h" #include "accessible_ability_manager_service.h" #include "display_manager.h" @@ -67,7 +68,7 @@ void AamsAccessibleAbilityChannelTest::SetUp() // Start AAMS Singleton::GetInstance().OnStart(); - AccessibilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityHelper::accountId_); GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published"; } diff --git a/services/test/moduletest/aamstest/aams_common_event_registry_test/aams_common_event_registry_test.cpp b/services/test/moduletest/aamstest/aams_common_event_registry_test/aams_common_event_registry_test.cpp index 2f2c74de..b69c1ab6 100644 --- a/services/test/moduletest/aamstest/aams_common_event_registry_test/aams_common_event_registry_test.cpp +++ b/services/test/moduletest/aamstest/aams_common_event_registry_test/aams_common_event_registry_test.cpp @@ -14,7 +14,8 @@ */ #include -#include "accessibility_helper.h" +#include "accessibility_common_helper.h" +#include "accessibility_mt_helper.h" #include "accessible_ability_channel.h" #include "accessible_ability_connection.h" #include "accessible_ability_manager_service.h" @@ -62,7 +63,7 @@ void AccessibilityCommonEventRegistryTest::SetUp() // Start AAMS Singleton::GetInstance().OnStart(); - AccessibilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityHelper::accountId_); GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published"; } diff --git a/services/test/moduletest/aamstest/aams_server_test/aams_server_test.cpp b/services/test/moduletest/aamstest/aams_server_test/aams_server_test.cpp index ad27b186..b5cadea6 100644 --- a/services/test/moduletest/aamstest/aams_server_test/aams_server_test.cpp +++ b/services/test/moduletest/aamstest/aams_server_test/aams_server_test.cpp @@ -14,10 +14,11 @@ */ #include +#include "accessibility_common_helper.h" #include "accessibility_display_manager.h" #include "accessibility_element_operator_proxy.h" #include "accessibility_element_operator_stub.h" -#include "accessibility_helper.h" +#include "accessibility_mt_helper.h" #include "accessible_ability_manager_service.h" #include "accessible_ability_manager_state_observer_proxy.h" #include "accessible_ability_manager_state_observer_stub.h" @@ -64,7 +65,7 @@ void AAMSServerTest::SetUp() // Start AAMS Singleton::GetInstance().OnStart(); - AccessibilityHelper::GetInstance().WaitForServicePublish(); + AccessibilityCommonHelper::GetInstance().WaitForServicePublish(); Singleton::GetInstance().SwitchedUser(AccessibilityHelper::accountId_); GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published"; }