diff options
-rw-r--r-- | Repository.mk | 1 | ||||
-rw-r--r-- | extensions/CppunitTest_extensions_test_update.mk | 9 | ||||
-rw-r--r-- | extensions/qa/update/test_update.cxx | 53 |
3 files changed, 54 insertions, 9 deletions
diff --git a/Repository.mk b/Repository.mk index 01a93d92a639..a723436bec60 100644 --- a/Repository.mk +++ b/Repository.mk @@ -266,6 +266,7 @@ $(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO, \ avmediagst \ avmediawin \ collator_data \ + curl \ deployment \ deploymentgui \ dict_ja \ 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(); |