test/data/password-protected.doc |binary test/data/password-protected.docx |binary test/httpwstest.cpp | 46 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+)
New commits: commit a8e1af8d63d7660e48f49eaccd03114df0b7edeb Author: Tomaž Vajngerl <[email protected]> Date: Mon Jan 9 11:38:08 2017 +0100 Test password protected OOXML and Binary MSO documents Change-Id: Ie871ea72f2670bcb23c25697bb669128ded851d9 Reviewed-on: https://gerrit.libreoffice.org/33110 Reviewed-by: Jan Holesovsky <[email protected]> Tested-by: Jan Holesovsky <[email protected]> diff --git a/test/data/password-protected.doc b/test/data/password-protected.doc new file mode 100644 index 0000000..0f0c853 Binary files /dev/null and b/test/data/password-protected.doc differ diff --git a/test/data/password-protected.docx b/test/data/password-protected.docx new file mode 100644 index 0000000..0e99d1b Binary files /dev/null and b/test/data/password-protected.docx differ diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp index d04724e..b875738 100644 --- a/test/httpwstest.cpp +++ b/test/httpwstest.cpp @@ -77,6 +77,8 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(testPasswordProtectedDocumentWithWrongPassword); CPPUNIT_TEST(testPasswordProtectedDocumentWithCorrectPassword); CPPUNIT_TEST(testPasswordProtectedDocumentWithCorrectPasswordAgain); + CPPUNIT_TEST(testPasswordProtectedOOXMLDocument); + CPPUNIT_TEST(testPasswordProtectedBinaryMSOfficeDocument); CPPUNIT_TEST(testInsertDelete); CPPUNIT_TEST(testSlideShow); CPPUNIT_TEST(testInactiveClient); @@ -120,6 +122,8 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture void testPasswordProtectedDocumentWithWrongPassword(); void testPasswordProtectedDocumentWithCorrectPassword(); void testPasswordProtectedDocumentWithCorrectPasswordAgain(); + void testPasswordProtectedOOXMLDocument(); + void testPasswordProtectedBinaryMSOfficeDocument(); void testInsertDelete(); void testNoExtraLoolKitsLeft(); void testSlideShow(); @@ -750,6 +754,48 @@ void HTTPWSTest::testPasswordProtectedDocumentWithCorrectPasswordAgain() testPasswordProtectedDocumentWithCorrectPassword(); } +void HTTPWSTest::testPasswordProtectedOOXMLDocument() +{ + try + { + std::string documentPath, documentURL; + getDocumentPathAndURL("password-protected.docx", documentPath, documentURL); + + Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL); + auto socket = connectLOKit(_uri, request, _response); + + // Send a load request with correct password + sendTextFrame(socket, "load url=" + documentURL + " password=abc"); + + CPPUNIT_ASSERT_MESSAGE("cannot load the document with correct password " + documentURL, isDocumentLoaded(socket)); + } + catch (const Poco::Exception& exc) + { + CPPUNIT_FAIL(exc.displayText()); + } +} + +void HTTPWSTest::testPasswordProtectedBinaryMSOfficeDocument() +{ + try + { + std::string documentPath, documentURL; + getDocumentPathAndURL("password-protected.doc", documentPath, documentURL); + + Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL); + auto socket = connectLOKit(_uri, request, _response); + + // Send a load request with correct password + sendTextFrame(socket, "load url=" + documentURL + " password=abc"); + + CPPUNIT_ASSERT_MESSAGE("cannot load the document with correct password " + documentURL, isDocumentLoaded(socket)); + } + catch (const Poco::Exception& exc) + { + CPPUNIT_FAIL(exc.displayText()); + } +} + void HTTPWSTest::testInsertDelete() { try
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
