[Libreoffice-commits] core.git: desktop/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 5 07:59:42 UTC 2018


 desktop/qa/data/certificate.der             |binary
 desktop/qa/data/certificatePrivateKey.der   |binary
 desktop/qa/data/intermediateRootCA.der      |binary
 desktop/qa/data/rootCA.der                  |binary
 desktop/qa/desktop_lib/test_desktop_lib.cxx |   66 ++++++++++++++++++++--------
 5 files changed, 49 insertions(+), 17 deletions(-)

New commits:
commit ab7fabd8b116d16def53772720f19fad4dbd6366
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Oct 24 11:19:32 2018 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Nov 5 08:58:54 2018 +0100

    lok: update the test for singing the document from LOK
    
    Change-Id: Ie34d8c26bfbf4192cd2067c8315030903edb3fb3
    Reviewed-on: https://gerrit.libreoffice.org/62274
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/desktop/qa/data/certificate.der b/desktop/qa/data/certificate.der
index 2a750ab281af..10e3ade13e3e 100644
Binary files a/desktop/qa/data/certificate.der and b/desktop/qa/data/certificate.der differ
diff --git a/desktop/qa/data/certificatePrivateKey.der b/desktop/qa/data/certificatePrivateKey.der
new file mode 100644
index 000000000000..7a5599c82521
Binary files /dev/null and b/desktop/qa/data/certificatePrivateKey.der differ
diff --git a/desktop/qa/data/intermediateRootCA.der b/desktop/qa/data/intermediateRootCA.der
new file mode 100644
index 000000000000..9adf7f82e5f6
Binary files /dev/null and b/desktop/qa/data/intermediateRootCA.der differ
diff --git a/desktop/qa/data/rootCA.der b/desktop/qa/data/rootCA.der
new file mode 100644
index 000000000000..30fc66e26f79
Binary files /dev/null and b/desktop/qa/data/rootCA.der differ
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index a225fb6ad85d..ab0e98033b55 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2274,24 +2274,56 @@ void DesktopLOKTest::testInsertCertificate()
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(mxComponent.is());
     pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
+    Scheduler::ProcessEventsToIdle();
+
+    {
+        OUString aCertificateURL;
+        createFileURL("rootCA.der", aCertificateURL);
+        SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ);
+        std::vector<unsigned char> aCertificate;
+        aCertificate.resize(aCertificateStream.remainingSize());
+        aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize());
+
+        bool bResult = pDocument->m_pDocumentClass->addCertificate(
+                            pDocument, aCertificate.data(), int(aCertificate.size()));
+        CPPUNIT_ASSERT(bResult);
+    }
+
+    {
+        OUString aCertificateURL;
+        createFileURL("intermediateRootCA.der", aCertificateURL);
+        SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ);
+        std::vector<unsigned char> aCertificate;
+        aCertificate.resize(aCertificateStream.remainingSize());
+        aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize());
 
-    OUString aCertificateURL;
-    createFileURL("certificate.der", aCertificateURL);
-    SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ);
-    std::vector<unsigned char> aCertificate;
-    aCertificate.resize(aCertificateStream.remainingSize());
-    aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize());
-
-    OUString aPrivateKeyURL;
-    createFileURL("pkey.der", aPrivateKeyURL);
-    SvFileStream aPrivateKeyStream(aPrivateKeyURL, StreamMode::READ);
-    std::vector<unsigned char> aPrivateKey;
-    aPrivateKey.resize(aPrivateKeyStream.remainingSize());
-    aPrivateKeyStream.ReadBytes(aPrivateKey.data(), aPrivateKeyStream.remainingSize());
-
-    pDocument->m_pDocumentClass->insertCertificate(pDocument,
-                        aCertificate.data(), int(aCertificate.size()),
-                        aPrivateKey.data(), int(aPrivateKey.size()));
+
+        bool bResult = pDocument->m_pDocumentClass->addCertificate(
+                            pDocument, aCertificate.data(), int(aCertificate.size()));
+        CPPUNIT_ASSERT(bResult);
+    }
+
+    {
+        OUString aCertificateURL;
+        createFileURL("certificate.der", aCertificateURL);
+        SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ);
+        std::vector<unsigned char> aCertificate;
+        aCertificate.resize(aCertificateStream.remainingSize());
+        aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize());
+
+
+        OUString aPrivateKeyURL;
+        createFileURL("certificatePrivateKey.der", aPrivateKeyURL);
+        SvFileStream aPrivateKeyStream(aPrivateKeyURL, StreamMode::READ);
+        std::vector<unsigned char> aPrivateKey;
+        aPrivateKey.resize(aPrivateKeyStream.remainingSize());
+        aPrivateKeyStream.ReadBytes(aPrivateKey.data(), aPrivateKeyStream.remainingSize());
+
+        bool bResult = pDocument->m_pDocumentClass->insertCertificate(pDocument,
+                            aCertificate.data(), int(aCertificate.size()),
+                            aPrivateKey.data(), int(aPrivateKey.size()));
+        CPPUNIT_ASSERT(bResult);
+    }
 
     comphelper::LibreOfficeKit::setActive(false);
 }


More information about the Libreoffice-commits mailing list