20#include <com/sun/star/bridge/UnoUrlResolver.hpp>
21#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
22#include <com/sun/star/connection/NoConnectException.hpp>
23#include <com/sun/star/frame/Desktop.hpp>
24#include <com/sun/star/lang/DisposedException.hpp>
25#include <com/sun/star/uno/Reference.hxx>
26#include <com/sun/star/uno/XComponentContext.hpp>
28#include <cppunit/TestAssert.h>
29#include <osl/process.h>
30#include <osl/test/uniquepipename.hxx>
43 css::uno::Reference< css::bridge::XUnoUrlResolver >
resolver(
44 css::bridge::UnoUrlResolver::create(
52 if (argSoffice.match(
"path:")) {
53 desc =
"pipe,name=" + osl::test::uniquePipeName(
"oootest");
54 OUString noquickArg(
"--quickstart=no");
55 OUString norestoreArg(
"--norestore");
56 OUString nologoArg(
"--nologo");
59 OUString headlessArg(
"--headless");
60 OUString acceptArg(
"--accept=" + desc +
";urp");
66 "-env:UNO_JAVA_JFW_ENV_JREHOME=true");
67 rtl_uString *
args[] = {
68 noquickArg.pData, norestoreArg.pData,
69 nologoArg.pData, headlessArg.pData, acceptArg.pData, userArg.pData,
71 rtl_uString ** envs =
nullptr;
82 argSoffice.copy(RTL_CONSTASCII_LENGTH(
"path:"))).
pData,
83 args, std::size(
args), 0,
nullptr,
nullptr, envs, envs ==
nullptr ? 0 : 1,
85 }
else if (argSoffice.match(
"connect:")) {
86 desc = argSoffice.copy(RTL_CONSTASCII_LENGTH(
"connect:"));
89 "\"soffice\" argument starts with neither \"path:\" nor"
95 css::uno::Reference< css::uno::XComponentContext >(
97 "uno:" + desc +
";urp;StarOffice.ComponentContext"),
98 css::uno::UNO_QUERY_THROW);
100 }
catch (css::connection::NoConnectException &) {}
102 TimeValue delay = { 1, 0 };
103 CPPUNIT_ASSERT_EQUAL(
104 osl_Process_E_TimedOut,
105 osl_joinProcessWithTimeout(
process_, &delay));
115 css::uno::Reference< css::frame::XDesktop2 >
desktop = css::frame::Desktop::create(
context_ );
118 CPPUNIT_ASSERT(
desktop->terminate());
120 }
catch (css::lang::DisposedException &) {}
124 CPPUNIT_ASSERT_EQUAL(osl_Process_E_None, osl_joinProcess(
process_));
126 info.Size =
sizeof info;
127 CPPUNIT_ASSERT_EQUAL(
129 osl_getProcessInfo(
process_, osl_Process_EXITCODE, &info));
130 CPPUNIT_ASSERT_EQUAL(oslProcessExitCode(0), info.Code);
143 TimeValue delay = { 0, 0 };
144 oslProcessError e = osl_joinProcessWithTimeout(
process_, &delay);
145 CPPUNIT_ASSERT(e == osl_Process_E_None || e == osl_Process_E_TimedOut);
146 return e == osl_Process_E_TimedOut;
css::uno::Reference< css::uno::XComponentContext > context_
bool isStillAlive() const
std::unique_ptr< sal_Int32[]> pData
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL defaultBootstrap_InitialComponentContext()
bool getArgument(std::u16string_view name, OUString *value)
OUString toAbsoluteFileUrl(OUString const &relativePathname)