summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-10-22 01:11:01 +0200
committerJan Holesovsky <kendy@suse.cz>2011-10-22 01:14:11 +0200
commit44d5b6c595f5f3bdf4eb923289da1bb0195e29d0 (patch)
treebe70bb66ace824ec5e80455dc0233c0851a6a075 /extensions
parent8c86c64f22b0dfef3cc502f59f509e20c1f5643c (diff)
Make the update unit test compile.
It is not useful yet, so disabled.
Diffstat (limited to 'extensions')
-rw-r--r--extensions/CppunitTest_extensions_test_update.mk9
-rw-r--r--extensions/qa/update/test_update.cxx53
2 files changed, 53 insertions, 9 deletions
diff --git a/extensions/CppunitTest_extensions_test_update.mk b/extensions/CppunitTest_extensions_test_update.mk
index b5703c01cd5b..54f72ce3ba22 100644
--- a/extensions/CppunitTest_extensions_test_update.mk
+++ b/extensions/CppunitTest_extensions_test_update.mk
@@ -28,18 +28,27 @@
$(eval $(call gb_CppunitTest_CppunitTest,extensions_test_update))
$(eval $(call gb_CppunitTest_add_exception_objects,extensions_test_update, \
+ extensions/source/update/check/download \
+ extensions/source/update/check/updatecheck \
+ extensions/source/update/check/updatecheckconfig \
+ extensions/source/update/check/updatehdl \
+ extensions/source/update/check/updateprotocol \
+ \
extensions/qa/update/test_update \
))
$(eval $(call gb_CppunitTest_add_linked_libs,extensions_test_update, \
cppu \
cppuhelper \
+ curl \
sal \
$(gb_STDLIBS) \
))
$(eval $(call gb_CppunitTest_set_include,extensions_test_update,\
$$(INCLUDE) \
+ -I$(realpath $(SRCDIR)/extensions/inc) \
+ -I$(realpath $(SRCDIR)/extensions/inc/pch) \
-I$(OUTDIR)/inc \
))
diff --git a/extensions/qa/update/test_update.cxx b/extensions/qa/update/test_update.cxx
index d60e59e905dc..cf44093aae38 100644
--- a/extensions/qa/update/test_update.cxx
+++ b/extensions/qa/update/test_update.cxx
@@ -33,28 +33,63 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
+#include <cppuhelper/bootstrap.hxx>
+
+#include <com/sun/star/deployment/UpdateInformationProvider.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include "../../source/update/check/updatecheck.hxx"
+#include "../../source/update/check/updateprotocol.hxx"
+
+using namespace com::sun::star;
+
namespace testupdate {
-class test : public CppUnit::TestFixture
+class Test : public CppUnit::TestFixture
{
public:
- void setUp() {}
+ void setUp()
+ {
+ if (!m_xContext.is())
+ m_xContext = cppu::defaultBootstrap_InitialComponentContext();
+ }
- void tearDown() {}
+ void tearDown()
+ {
+ uno::Reference< lang::XComponent >( m_xContext, uno::UNO_QUERY_THROW)->dispose();
+ }
protected:
- // setup & test checkForUpdates() method
- void testUpdateCheck()
+ // test the checkForUpdates() method
+ void testCheckForUpdates()
{
- //CPPUNIT_FAIL( "This has to be populated with the real test..." );
+ UpdateState eUIState = UPDATESTATE_NO_UPDATE_AVAIL;
+
+ UpdateInfo aInfo;
+ rtl::Reference< UpdateCheck > aController( UpdateCheck::get() );
+ uno::Reference< deployment::XUpdateInformationProvider > m_xProvider( deployment::UpdateInformationProvider::create( m_xContext ) );
+
+ if ( checkForUpdates( aInfo, m_xContext, aController->getInteractionHandler(), m_xProvider ) )
+ {
+ aController->setUpdateInfo( aInfo );
+ eUIState = aController->getUIState( aInfo );
+ }
+ else
+ CPPUNIT_FAIL("Calling checkForUpdates() failed.");
}
- CPPUNIT_TEST_SUITE(test);
- CPPUNIT_TEST(testUpdateCheck);
+ CPPUNIT_TEST_SUITE(Test);
+ // FIXME CPPUNIT_TEST(testCheckForUpdates);
CPPUNIT_TEST_SUITE_END();
+
+private:
+ static uno::Reference< uno::XComponentContext > m_xContext;
};
-CPPUNIT_TEST_SUITE_REGISTRATION(testupdate::test);
+uno::Reference< uno::XComponentContext > Test::m_xContext;
+
+CPPUNIT_TEST_SUITE_REGISTRATION(testupdate::Test);
} // namespace testupdate
CPPUNIT_PLUGIN_IMPLEMENT();