[Libreoffice-commits] .: extensions/CppunitTest_extensions_test_update.mk extensions/qa Repository.mk

Jan Holesovsky kendy at kemper.freedesktop.org
Fri Oct 21 16:12:29 PDT 2011


 Repository.mk                                    |    1 
 extensions/CppunitTest_extensions_test_update.mk |    9 +++
 extensions/qa/update/test_update.cxx             |   53 +++++++++++++++++++----
 3 files changed, 54 insertions(+), 9 deletions(-)

New commits:
commit 44d5b6c595f5f3bdf4eb923289da1bb0195e29d0
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sat Oct 22 01:11:01 2011 +0200

    Make the update unit test compile.
    
    It is not useful yet, so disabled.

diff --git a/Repository.mk b/Repository.mk
index 01a93d9..a723436 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 b5703c0..54f72ce 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 d60e59e..cf44093 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();


More information about the Libreoffice-commits mailing list