From 64592a19e5d512fb5cd09bf0a1726b9c78481e65 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 12 Jan 2018 14:49:59 +0100 Subject: test: cancel interaction on password *re-entry* If the password was wrong the first time, it's not going to be right if we return it a second time. Avoid infinite loops in tests. Change-Id: Ie4bf92853d0789b0114250f6c8ded1b2c3ab184d --- include/test/testinteractionhandler.hxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/test/testinteractionhandler.hxx b/include/test/testinteractionhandler.hxx index df4316c18ef0..805d72ba0d0b 100644 --- a/include/test/testinteractionhandler.hxx +++ b/include/test/testinteractionhandler.hxx @@ -100,6 +100,7 @@ public: { bool bPasswordRequestFound = false; bool bIsRequestPasswordToModify = false; + css::task::PasswordRequestMode mode{}; OString sUrl; @@ -108,6 +109,7 @@ public: { bIsRequestPasswordToModify = passwordRequest2.IsRequestPasswordToModify; sUrl = passwordRequest2.Name.toUtf8(); + mode = passwordRequest2.Mode; bPasswordRequestFound = true; } css::task::DocumentMSPasswordRequest2 passwordMSRequest2; @@ -115,6 +117,7 @@ public: { bIsRequestPasswordToModify = passwordMSRequest2.IsRequestPasswordToModify; sUrl = passwordMSRequest2.Name.toUtf8(); + mode = passwordMSRequest2.Mode; bPasswordRequestFound = true; } @@ -127,7 +130,13 @@ public: for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i) { - if (bIsRequestPasswordToModify) + if (mode == css::task::PasswordRequestMode_PASSWORD_REENTER) + { // cancel re-enter of wrong password, to avoid infinite loop + css::uno::Reference const xAbort(rContinuations[i], css::uno::UNO_QUERY); + if (xAbort.is()) + xAbort->select(); + } + else if (bIsRequestPasswordToModify) { css::uno::Reference const xIPW2(rContinuations[i], css::uno::UNO_QUERY); xIPW2->setPasswordToModify(msPassword); -- cgit