Mercurial > hg > orthanc
changeset 4327:9684a690ca63
fix link errors on wasm unit tests
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 24 Nov 2020 20:53:21 +0100 |
parents | 83c5bd439fcc |
children | ce9284aebd40 |
files | OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake OrthancFramework/Sources/HttpServer/HttpToolbox.cpp OrthancFramework/Sources/HttpServer/HttpToolbox.h OrthancFramework/UnitTestsSources/FrameworkTests.cpp OrthancFramework/UnitTestsSources/RestApiTests.cpp |
diffstat | 5 files changed, 21 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Tue Nov 24 19:43:10 2020 +0100 +++ b/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Tue Nov 24 20:53:21 2020 +0100 @@ -154,7 +154,6 @@ ${CMAKE_CURRENT_LIST_DIR}/../../Sources/Enumerations.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/FileStorage/MemoryStorageArea.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpContentNegociation.cpp - ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpToolbox.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/MultipartStreamReader.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/StringMatcher.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/Logging.cpp @@ -307,6 +306,7 @@ ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpOutput.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpServer.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpStreamTranscoder.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpToolbox.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/StringHttpOutput.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/RestApi/RestApi.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/RestApi/RestApiCall.cpp
--- a/OrthancFramework/Sources/HttpServer/HttpToolbox.cpp Tue Nov 24 19:43:10 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/HttpToolbox.cpp Tue Nov 24 20:53:21 2020 +0100 @@ -23,18 +23,17 @@ #include "../PrecompiledHeaders.h" #include "HttpToolbox.h" +#include "HttpOutput.h" +#include "StringHttpOutput.h" + #include <stdio.h> #include <string.h> #include <iostream> -#include "HttpOutput.h" -#include "StringHttpOutput.h" - static const char* LOCALHOST = "127.0.0.1"; - namespace Orthanc { static void SplitGETNameValue(IHttpHandler::GetArguments& result, @@ -188,7 +187,6 @@ } -#if ORTHANC_SANDBOXED != 1 bool HttpToolbox::SimpleGet(std::string& result, IHttpHandler& handler, RequestOrigin origin, @@ -213,10 +211,8 @@ return false; } } -#endif -#if ORTHANC_SANDBOXED != 1 static bool SimplePostOrPut(std::string& result, IHttpHandler& handler, RequestOrigin origin, @@ -245,10 +241,8 @@ return false; } } -#endif -#if ORTHANC_SANDBOXED != 1 bool HttpToolbox::SimplePost(std::string& result, IHttpHandler& handler, RequestOrigin origin, @@ -259,10 +253,8 @@ { return SimplePostOrPut(result, handler, origin, HttpMethod_Post, uri, bodyData, bodySize, httpHeaders); } -#endif -#if ORTHANC_SANDBOXED != 1 bool HttpToolbox::SimplePut(std::string& result, IHttpHandler& handler, RequestOrigin origin, @@ -273,10 +265,8 @@ { return SimplePostOrPut(result, handler, origin, HttpMethod_Put, uri, bodyData, bodySize, httpHeaders); } -#endif - -#if ORTHANC_SANDBOXED != 1 + bool HttpToolbox::SimpleDelete(IHttpHandler& handler, RequestOrigin origin, const std::string& uri, @@ -293,5 +283,4 @@ return handler.Handle(http, origin, LOCALHOST, "", HttpMethod_Delete, curi, httpHeaders, getArguments, NULL /* no body for DELETE */, 0); } -#endif }
--- a/OrthancFramework/Sources/HttpServer/HttpToolbox.h Tue Nov 24 19:43:10 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/HttpToolbox.h Tue Nov 24 20:53:21 2020 +0100 @@ -22,10 +22,6 @@ #pragma once -#if !defined(ORTHANC_SANDBOXED) -# error Macro ORTHANC_SANDBOXED must be defined -#endif - #include "../OrthancFramework.h" #include "IHttpHandler.h" @@ -55,7 +51,6 @@ static void CompileGetArguments(IHttpHandler::Arguments& compiled, const IHttpHandler::GetArguments& source); -#if ORTHANC_SANDBOXED != 1 static bool SimpleGet(std::string& result, IHttpHandler& handler, RequestOrigin origin, @@ -68,7 +63,7 @@ const std::string& uri, const void* bodyData, size_t bodySize, - const IHttpHandler::Arguments& httpHeaders); + const IHttpHandler::Arguments& httpHeaders); static bool SimplePut(std::string& result, IHttpHandler& handler, @@ -82,6 +77,5 @@ RequestOrigin origin, const std::string& uri, const IHttpHandler::Arguments& httpHeaders); -#endif }; }
--- a/OrthancFramework/UnitTestsSources/FrameworkTests.cpp Tue Nov 24 19:43:10 2020 +0100 +++ b/OrthancFramework/UnitTestsSources/FrameworkTests.cpp Tue Nov 24 20:53:21 2020 +0100 @@ -34,13 +34,13 @@ #include <gtest/gtest.h> #include "../Sources/DicomFormat/DicomTag.h" -#include "../Sources/HttpServer/HttpToolbox.h" #include "../Sources/Logging.h" #include "../Sources/OrthancException.h" #include "../Sources/Toolbox.h" #if ORTHANC_SANDBOXED != 1 # include "../Sources/FileBuffer.h" +# include "../Sources/HttpServer/HttpToolbox.h" # include "../Sources/MetricsRegistry.h" # include "../Sources/SystemToolbox.h" # include "../Sources/TemporaryFile.h" @@ -101,6 +101,7 @@ } +#if ORTHANC_SANDBOXED != 1 TEST(ParseGetArguments, Basic) { IHttpHandler::GetArguments b; @@ -114,7 +115,9 @@ ASSERT_EQ(a["bb"], "a"); ASSERT_EQ(a["aa"], "c"); } +#endif +#if ORTHANC_SANDBOXED != 1 TEST(ParseGetArguments, BasicEmpty) { IHttpHandler::GetArguments b; @@ -128,7 +131,9 @@ ASSERT_EQ(a["bb"], "aa"); ASSERT_EQ(a["aa"], ""); } +#endif +#if ORTHANC_SANDBOXED != 1 TEST(ParseGetArguments, Single) { IHttpHandler::GetArguments b; @@ -140,7 +145,9 @@ ASSERT_EQ(1u, a.size()); ASSERT_EQ(a["aaa"], "baaa"); } +#endif +#if ORTHANC_SANDBOXED != 1 TEST(ParseGetArguments, SingleEmpty) { IHttpHandler::GetArguments b; @@ -152,7 +159,9 @@ ASSERT_EQ(1u, a.size()); ASSERT_EQ(a["aaa"], ""); } +#endif +#if ORTHANC_SANDBOXED != 1 TEST(ParseGetQuery, Test1) { UriComponents uri; @@ -171,7 +180,9 @@ ASSERT_EQ(a["bb"], "a"); ASSERT_EQ(a["aa"], "c"); } +#endif +#if ORTHANC_SANDBOXED != 1 TEST(ParseGetQuery, Test2) { UriComponents uri; @@ -187,6 +198,7 @@ ASSERT_EQ("world", uri[2]); ASSERT_EQ(0u, a.size()); } +#endif TEST(Uri, SplitUriComponents) {
--- a/OrthancFramework/UnitTestsSources/RestApiTests.cpp Tue Nov 24 19:43:10 2020 +0100 +++ b/OrthancFramework/UnitTestsSources/RestApiTests.cpp Tue Nov 24 20:53:21 2020 +0100 @@ -179,6 +179,7 @@ } +#if ORTHANC_SANDBOXED != 1 TEST(RestApi, ParseCookies) { IHttpHandler::Arguments headers; @@ -207,6 +208,7 @@ ASSERT_EQ(1u, cookies.size()); ASSERT_EQ("v", cookies["n"]); } +#endif TEST(RestApi, RestApiPath)