diff --git a/test/unittest/cpp_test/src/ime_mirror_test.cpp b/test/unittest/cpp_test/src/ime_mirror_test.cpp index cf728bbeac318ad1642b19cc91a9ca74b899cd44..6bf7488c389b2ba6248db8d36e2bc81c61bdd866 100644 --- a/test/unittest/cpp_test/src/ime_mirror_test.cpp +++ b/test/unittest/cpp_test/src/ime_mirror_test.cpp @@ -35,6 +35,7 @@ using namespace testing::mt; namespace OHOS { namespace MiscServices { constexpr int32_t INVALID_UID = -1; +constexpr uint32_t ATTACH_WAIT_TIME = 20; class ImeMirrorTest : public testing::Test { public: static sptr imc_; @@ -402,6 +403,7 @@ HWTEST_F(ImeMirrorTest, multiThreadAttachRegisterTest_001, TestSize.Level1) SET_THREAD_NUM(1); auto attachTask = []() { auto ret = ImeMirrorTest::Attach(); + std::this_thread::sleep_for(std::chrono::milliseconds(ATTACH_WAIT_TIME)); EXPECT_EQ(ret, ErrorCode::NO_ERROR); ret = ImeMirrorTest::imc_->OnSelectionChange(u"1234567890", 1, 1); EXPECT_EQ(ret, ErrorCode::NO_ERROR); diff --git a/test/unittest/napi_test/src/InputMethodTest.js b/test/unittest/napi_test/src/InputMethodTest.js index 4b02cb45275610f9b669bfd4547c72422bd5f823..b85317fc6602f8e7c169953202e336cbfbf2a04b 100644 --- a/test/unittest/napi_test/src/InputMethodTest.js +++ b/test/unittest/napi_test/src/InputMethodTest.js @@ -1444,6 +1444,7 @@ describe('InputMethodTest', function () { let currentIme = inputMethod.getCurrentInputMethod(); inputMethod.getSetting().enableInputMethod(currentIme.name, "extName", inputMethod.EnabledState.BASIC_MODE).then(() => { console.info('Succeeded in enable inputmethod.'); + wait(WAIT_DEAL_OK); expect().assertFail(); done(); }).catch((err) => {