summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2018-01-12 14:49:59 +0100
committerMichael Stahl <mstahl@redhat.com>2018-01-12 23:31:43 +0100
commit64592a19e5d512fb5cd09bf0a1726b9c78481e65 (patch)
tree40a20e1c061ca3c1c404a5dbd4f9f3396cd075a8
parent0b7c3b7d9fa71f59eed75c3e80e5e12245c5e1c5 (diff)
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
-rw-r--r--include/test/testinteractionhandler.hxx11
1 files changed, 10 insertions, 1 deletions
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<css::task::XInteractionAbort> const xAbort(rContinuations[i], css::uno::UNO_QUERY);
+ if (xAbort.is())
+ xAbort->select();
+ }
+ else if (bIsRequestPasswordToModify)
{
css::uno::Reference<css::task::XInteractionPassword2> const xIPW2(rContinuations[i], css::uno::UNO_QUERY);
xIPW2->setPasswordToModify(msPassword);