summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2011-09-26 17:23:52 +0200
committerStephan Bergmann <sbergman@redhat.com>2011-09-26 17:24:52 +0200
commitc09b966f94f5a50fe537916398451339f008947d (patch)
tree44c0f4ed30fab59c552dd656a0a64629a9f5d18e /test
parentdaff51e125d1036895a5d39a7a652b3f5ff0e97e (diff)
In smoketest.cxx, also wait for connection_ going stale while waiting for result.condition.
Diffstat (limited to 'test')
-rw-r--r--test/inc/test/officeconnection.hxx3
-rw-r--r--test/source/cpp/officeconnection.cxx9
2 files changed, 12 insertions, 0 deletions
diff --git a/test/inc/test/officeconnection.hxx b/test/inc/test/officeconnection.hxx
index 4c764b1693d0..e5250ce6aedf 100644
--- a/test/inc/test/officeconnection.hxx
+++ b/test/inc/test/officeconnection.hxx
@@ -55,6 +55,9 @@ public:
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
getComponentContext() const;
+ // Must not be called before setUp or after tearDown:
+ bool isStillAlive() const;
+
private:
oslProcess process_;
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
diff --git a/test/source/cpp/officeconnection.cxx b/test/source/cpp/officeconnection.cxx
index a40451eb30ae..9c8d4d549b71 100644
--- a/test/source/cpp/officeconnection.cxx
+++ b/test/source/cpp/officeconnection.cxx
@@ -170,6 +170,7 @@ void OfficeConnection::tearDown() {
osl_getProcessInfo(process_, osl_Process_EXITCODE, &info));
CPPUNIT_ASSERT_EQUAL(oslProcessExitCode(0), info.Code);
osl_freeProcessHandle(process_);
+ process_ = 0; // guard against subsequent calls to isStillAlive
}
}
@@ -178,6 +179,14 @@ OfficeConnection::getComponentContext() const {
return context_;
}
+bool OfficeConnection::isStillAlive() const {
+ OSL_ASSERT(process_ != 0);
+ TimeValue delay = { 0, 0 }; // 0 sec
+ oslProcessError e = osl_joinProcessWithTimeout(process_, &delay);
+ CPPUNIT_ASSERT(e == osl_Process_E_None || e == osl_Process_E_TimedOut);
+ return e == osl_Process_E_TimedOut;
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */