summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-07-07 16:25:37 +0200
committersb <sb@openoffice.org>2010-07-07 16:25:37 +0200
commit4699a135a27314e126ddbaa6d7d8e010d39c8aa5 (patch)
treef8ce2f86419e02982f00d8079d8876c4d3333bc9 /test
parent721b8bb191c6180db1dafcef15492b3bdd063dae (diff)
sb126: #i111184# introduced test::uniquePipeName
Diffstat (limited to 'test')
-rw-r--r--test/inc/test/uniquepipename.hxx44
-rw-r--r--test/prj/d.lst1
-rw-r--r--test/source/cpp/makefile.mk3
-rw-r--r--test/source/cpp/officeconnection.cxx11
-rw-r--r--test/source/cpp/uniquepipename.cxx48
5 files changed, 99 insertions, 8 deletions
diff --git a/test/inc/test/uniquepipename.hxx b/test/inc/test/uniquepipename.hxx
new file mode 100644
index 000000000000..4b96586a0299
--- /dev/null
+++ b/test/inc/test/uniquepipename.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_TEST_UNIQUEPIPENAME_HXX
+#define INCLUDED_TEST_UNIQUEPIPENAME_HXX
+
+#include "sal/config.h"
+
+#include "test/detail/testdllapi.hxx"
+
+namespace rtl { class OUString; }
+
+namespace test {
+
+// Create a system-wide unique name (for use with osl::Pipe):
+OOO_DLLPUBLIC_TEST rtl::OUString uniquePipeName(rtl::OUString const & name);
+
+}
+
+#endif
diff --git a/test/prj/d.lst b/test/prj/d.lst
index bcea8bee46fe..6a3827d90309 100644
--- a/test/prj/d.lst
+++ b/test/prj/d.lst
@@ -9,4 +9,5 @@ mkdir: %_DEST%\inc%_EXT%\test\detail
..\inc\test\officeconnection.hxx %_DEST%\inc%_EXT%\test\officeconnection.hxx
..\inc\test\oustringostreaminserter.hxx %_DEST%\inc%_EXT%\test\oustringostreaminserter.hxx
..\inc\test\toabsolutefileurl.hxx %_DEST%\inc%_EXT%\test\toabsolutefileurl.hxx
+..\inc\test\uniquepipename.hxx %_DEST%\inc%_EXT%\test\uniquepipename.hxx
..\%__SRC%\class\test.jar %_DEST%\bin%_EXT%\test.jar
diff --git a/test/source/cpp/makefile.mk b/test/source/cpp/makefile.mk
index 8494bd4aaa05..bb570cd2cc97 100644
--- a/test/source/cpp/makefile.mk
+++ b/test/source/cpp/makefile.mk
@@ -38,7 +38,8 @@ CFLAGSCXX += $(CPPUNIT_CFLAGS)
SLOFILES = \
$(SLO)/getargument.obj \
$(SLO)/officeconnection.obj \
- $(SLO)/toabsolutefileurl.obj
+ $(SLO)/toabsolutefileurl.obj \
+ $(SLO)/uniquepipename.obj
SHL1IMPLIB = i$(SHL1TARGET)
SHL1OBJS = $(SLOFILES)
diff --git a/test/source/cpp/officeconnection.cxx b/test/source/cpp/officeconnection.cxx
index ccfd2cd0a069..abf1d88fedb9 100644
--- a/test/source/cpp/officeconnection.cxx
+++ b/test/source/cpp/officeconnection.cxx
@@ -40,6 +40,7 @@
#include "test/getargument.hxx"
#include "test/officeconnection.hxx"
#include "test/toabsolutefileurl.hxx"
+#include "test/uniquepipename.hxx"
namespace {
@@ -61,13 +62,9 @@ void OfficeConnection::setUp() {
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("soffice")),
&argSoffice));
if (argSoffice.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("path:"))) {
- oslProcessInfo info;
- info.Size = sizeof info;
- CPPUNIT_ASSERT_EQUAL(
- osl_Process_E_None,
- osl_getProcessInfo(0, osl_Process_IDENTIFIER, &info));
- desc = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pipe,name=oootest")) +
- rtl::OUString::valueOf(static_cast< sal_Int64 >(info.Ident));
+ desc = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pipe,name=")) +
+ uniquePipeName(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("oootest")));
rtl::OUString noquickArg(
RTL_CONSTASCII_USTRINGPARAM("-quickstart=no"));
rtl::OUString nofirstArg(
diff --git a/test/source/cpp/uniquepipename.cxx b/test/source/cpp/uniquepipename.cxx
new file mode 100644
index 000000000000..c7614f4f3216
--- /dev/null
+++ b/test/source/cpp/uniquepipename.cxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include "cppunit/TestAssert.h"
+#include "osl/process.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "test/uniquepipename.hxx"
+
+namespace test {
+
+rtl::OUString uniquePipeName(rtl::OUString const & name) {
+ oslProcessInfo info;
+ info.Size = sizeof info;
+ CPPUNIT_ASSERT_EQUAL(
+ osl_Process_E_None,
+ osl_getProcessInfo(0, osl_Process_IDENTIFIER, &info));
+ return name + rtl::OUString::valueOf(static_cast< sal_Int64 >(info.Ident));
+}
+
+}