修改静态告警问题

Signed-off-by: Mupceet <laiguizhong@huawei.com>
This commit is contained in:
Mupceet 2022-09-13 12:42:55 +08:00
parent cd9f3b74ec
commit 639e93eff7
53 changed files with 259 additions and 263 deletions

View File

@ -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.

View File

@ -22,9 +22,6 @@ AccessibilityElementOperatorProxy::AccessibilityElementOperatorProxy(
const sptr<IRemoteObject> &impl) : IRemoteProxy<IAccessibilityElementOperator>(impl)
{}
AccessibilityElementOperatorProxy::~AccessibilityElementOperatorProxy()
{}
bool AccessibilityElementOperatorProxy::WriteInterfaceToken(MessageParcel &data)
{
HILOG_DEBUG();

View File

@ -229,19 +229,19 @@ private:
sptr<AccessibilityEnableAbilityListsObserverImpl> 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_ = {};

View File

@ -15,8 +15,8 @@
#include <gtest/gtest.h>
#include <memory>
#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"

View File

@ -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();
}

View File

@ -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<OHOS::MMI::KeyEvent> &keyEvent) override
bool OnKeyPressEvent(const std::shared_ptr<OHOS::MMI::KeyEvent> &keyEvent) override
{
return false;
}

View File

@ -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 {

View File

@ -957,10 +957,9 @@ void StateListenerImpl::UnsubscribeObserver(napi_value observer)
std::lock_guard<std::mutex> 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 {

View File

@ -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());

View File

@ -183,7 +183,8 @@ void AccessibilityAccountData::AddAccessibilityWindowConnection(
const int32_t windowId, const sptr<AccessibilityWindowConnection>& 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));
}
}

View File

@ -142,7 +142,6 @@ bool AccessibilityMouseKey::IsMouseKey(const std::vector<int32_t> &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<int32_t> &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<int32_t> &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<int32_t> &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<int32_t> &pressedKeys,
CTRL_SHIFT_KEYCODE_V.end())) {
metaKey1 = pressedKeys[Index1];
metaKey2 = pressedKeys[Index2];
HILOG_DEBUG("metaKey1:%d, metaKey2:%d", metaKey1, metaKey2);
return true;
}
}

View File

@ -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",

View File

@ -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 <atomic>
#include <chrono>
#include <functional>
#include <mutex>
#include <thread>
#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<bool()> &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<int> sendEventTimes_ = 0;
uint32_t testSequence_ = 0;
int32_t keyCode_ = 0;
@ -379,4 +337,4 @@ private:
};
} // namespace Accessibility
} // namespace OHOS
#endif // ACCESSIBILITY_ABILILTY_HELPER_H
#endif // ACCESSIBILITY_UT_HELPER_H

View File

@ -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<IRemoteObject> &impl) : IRemoteProxy<IAccessibilityElementOperator>(impl)
{}
AccessibilityElementOperatorProxy::~AccessibilityElementOperatorProxy()
{}
bool AccessibilityElementOperatorProxy::WriteInterfaceToken(MessageParcel &data)
{
(void)data;

View File

@ -14,8 +14,8 @@
*/
#include <gtest/gtest.h>
#include "accessibility_ability_helper.h"
#include "accessibility_event_transmission.h"
#include "accessibility_ut_helper.h"
#include "hilog_wrapper.h"
namespace OHOS {

View File

@ -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"

View File

@ -14,9 +14,9 @@
*/
#include <gtest/gtest.h>
#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"

View File

@ -15,7 +15,7 @@
#include "mock_accessible_ability_client_stub_impl.h"
#include <gtest/gtest.h>
#include "accessibility_ability_helper.h"
#include "accessibility_ut_helper.h"
namespace OHOS {
namespace Accessibility {

View File

@ -15,9 +15,9 @@
#include <gtest/gtest.h>
#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"

View File

@ -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<DisplayInfo> 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

View File

@ -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 {

View File

@ -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<IRemoteObject> systemAbility)
{
printf("Publish mock start");
systemAbility.ForceSetRefPtr(nullptr);
Accessibility::AccessibilityAbilityHelper::GetInstance().SetIsServicePublished(true);
Accessibility::AccessibilityCommonHelper::GetInstance().SetIsServicePublished(true);
printf("Publish mock end");
return true;
}

View File

@ -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 {

View File

@ -14,8 +14,9 @@
*/
#include <gtest/gtest.h>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityAbilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_);
inputInterceptor_ = AccessibilityInputInterceptor::GetInstance();
}

View File

@ -16,8 +16,9 @@
#include <gtest/gtest.h>
#include <map>
#include <memory>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityAbilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_);
keyEventFilter_ = std::make_shared<KeyEventFilter>();
}

View File

@ -16,8 +16,9 @@
#include <gtest/gtest.h>
#include <map>
#include <memory>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityAbilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
mouseAutoclick_ = std::make_shared<AccessibilityMouseAutoclick>();
}

View File

@ -16,8 +16,8 @@
#include <gtest/gtest.h>
#include <map>
#include <memory>
#include "accessibility_ability_helper.h"
#include "accessibility_mouse_key.h"
#include "accessibility_ut_helper.h"
using namespace testing;
using namespace testing::ext;

View File

@ -16,8 +16,8 @@
#include <gtest/gtest.h>
#include <map>
#include <memory>
#include "accessibility_ability_helper.h"
#include "accessibility_short_key.h"
#include "accessibility_ut_helper.h"
#include "accessible_ability_manager_service.h"
using namespace testing;

View File

@ -14,8 +14,9 @@
*/
#include <gtest/gtest.h>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityAbilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_);
}

View File

@ -14,8 +14,9 @@
*/
#include <gtest/gtest.h>
#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<MMI::PointerEvent> 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<MMI::PointerEvent> 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<MMI::PointerEvent> 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<MMI::PointerEvent> 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<MMI::PointerEvent> 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<MMI::PointerEvent> 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<MMI::PointerEvent> 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<MMI::PointerEvent> 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<MMI::PointerEvent> 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<MMI::PointerEvent> 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 {

View File

@ -14,9 +14,9 @@
*/
#include <gtest/gtest.h>
#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"

View File

@ -16,7 +16,7 @@
#include <gtest/gtest.h>
#include <map>
#include <memory>
#include "accessibility_ability_helper.h"
#include "accessibility_ut_helper.h"
#include "accessibility_zoom_gesture.h"
#include "accessible_ability_manager_service.h"

View File

@ -15,9 +15,9 @@
#include <gtest/gtest.h>
#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++;
}

View File

@ -15,9 +15,10 @@
#include <cstdio>
#include <gtest/gtest.h>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityAbilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_);
// new Interaction proxy

View File

@ -15,9 +15,10 @@
#include <gtest/gtest.h>
#include <optional>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityAbilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_);
stub_ = new MockAccessibleAbilityClientStubImpl();
}

View File

@ -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",

View File

@ -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 <chrono>
#include <thread>
#include <vector>
#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<std::mutex> 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<bool()> &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
#endif // ACCESSIBILITY_MT_HELPER_H

View File

@ -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 <atomic>
#include <chrono>
#include <functional>
#include <thread>
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<bool()> &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

View File

@ -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<IAccessibilityElementOperatorCallback>& 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<IAccessibilityElementOperatorCallback>& 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<IAccessibilityElementOperatorCallback>& 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<IAccessibilityElementOperatorCallback>& 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<std::string, std::string> &actionArguments, int32_t requestId,
const sptr<IAccessibilityElementOperatorCallback>& 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<AccessibilityElementInfo>& 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<AccessibilityElementInfo>& 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_;

View File

@ -28,9 +28,6 @@ MockAccessibilityElementOperatorProxy::MockAccessibilityElementOperatorProxy(con
GTEST_LOG_(INFO) << "MockAccessibilityElementOperatorProxy";
}
MockAccessibilityElementOperatorProxy::~MockAccessibilityElementOperatorProxy()
{}
bool MockAccessibilityElementOperatorProxy::WriteInterfaceToken(MessageParcel& data)
{
return true;

View File

@ -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<IAccessibilityElementOperatorCallback>& 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<IAccessibilityElementOperatorCallback>& 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<IAccessibilityElementOperatorCallback>& 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<IAccessibilityElementOperatorCallback>& 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<std::string, std::string> &actionArguments, int32_t requestId,
const sptr<IAccessibilityElementOperatorCallback>& 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;

View File

@ -16,7 +16,7 @@
#include <gtest/gtest.h>
#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"

View File

@ -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<std::string>& 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;

View File

@ -37,7 +37,7 @@ const std::string COM_IX_HIDATA = "com.ix.hiData";
class BundleMgrStub : public IRemoteStub<IBundleMgr> {
public:
DECLARE_INTERFACE_DESCRIPTOR(u"IBundleMgr");
virtual int OnRemoteRequest(
int OnRemoteRequest(
uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
};

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
#include "accessibility_helper.h"
#include "accessibility_mt_helper.h"
#include "os_account_manager.h"
namespace OHOS {

View File

@ -14,7 +14,8 @@
*/
#include <gtest/gtest.h>
#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<IRemoteObject> systemAbility)
{
(void)systemAbility;
systemAbility.ForceSetRefPtr(nullptr);
Accessibility::AccessibilityHelper::GetInstance().SetIsServicePublished(true);
Accessibility::AccessibilityCommonHelper::GetInstance().SetIsServicePublished(true);
return true;
}

View File

@ -22,7 +22,7 @@ static int mockKeyCode = -1;
static std::vector<int32_t> mockTouchActions;
static std::function<void(std::shared_ptr<MMI::KeyEvent>)> mockKeyEventCallback = nullptr;
static std::shared_ptr<MMI::IInputEventConsumer> 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<std::mutex> lock(mtx_);
std::lock_guard<std::mutex> lock(g_mtx);
mockTouchActions.clear();
}
std::vector<int32_t> MockInputManager::GetTouchActions()
{
std::lock_guard<std::mutex> lock(mtx_);
std::lock_guard<std::mutex> lock(g_mtx);
return mockTouchActions;
}
int32_t MockInputManager::GetTouchActionOfTargetIndex(int32_t index)
{
std::lock_guard<std::mutex> lock(mtx_);
std::lock_guard<std::mutex> lock(g_mtx);
int32_t size = static_cast<int32_t>(mockTouchActions.size());
if (size > index) {
return mockTouchActions[index];
@ -80,7 +80,7 @@ void InputManager::SimulateInputEvent(std::shared_ptr<KeyEvent> keyEvent)
void InputManager::SimulateInputEvent(std::shared_ptr<PointerEvent> pointerEvent)
{
std::lock_guard<std::mutex> lock(mtx_);
std::lock_guard<std::mutex> lock(g_mtx);
int32_t touchAction = pointerEvent->GetPointerAction();
mockTouchActions.push_back(touchAction);
}

View File

@ -18,8 +18,9 @@
#include <memory>
#include <unistd.h>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityHelper::accountId_);
GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published";

View File

@ -14,10 +14,11 @@
*/
#include <gtest/gtest.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 "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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityHelper::accountId_);
GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published";

View File

@ -17,10 +17,11 @@
#include <unistd.h>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::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<int32_t>(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<int32_t>(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<int32_t>(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<int32_t>(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<int32_t>(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;

View File

@ -14,9 +14,10 @@
*/
#include <gtest/gtest.h>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityHelper::accountId_);
GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published";
}

View File

@ -14,7 +14,8 @@
*/
#include <gtest/gtest.h>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityHelper::accountId_);
GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published";
}

View File

@ -14,10 +14,11 @@
*/
#include <gtest/gtest.h>
#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<AccessibleAbilityManagerService>::GetInstance().OnStart();
AccessibilityHelper::GetInstance().WaitForServicePublish();
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityHelper::accountId_);
GTEST_LOG_(INFO) << "AccessibleAbilityManagerService is published";
}