134522da9SNiels Sascha Reedijk /* 234522da9SNiels Sascha Reedijk * Copyright 2021 Haiku, inc. 334522da9SNiels Sascha Reedijk * Distributed under the terms of the MIT License. 434522da9SNiels Sascha Reedijk */ 534522da9SNiels Sascha Reedijk #ifndef HTTP_TEST_H 634522da9SNiels Sascha Reedijk #define HTTP_TEST_H 734522da9SNiels Sascha Reedijk 834522da9SNiels Sascha Reedijk 934522da9SNiels Sascha Reedijk #include <HttpSession.h> 1034522da9SNiels Sascha Reedijk #include <TestCase.h> 1134522da9SNiels Sascha Reedijk #include <TestSuite.h> 12*1d2070c7SNiels Sascha Reedijk #include <tools/cppunit/ThreadedTestCase.h> 13*1d2070c7SNiels Sascha Reedijk 14*1d2070c7SNiels Sascha Reedijk #include "TestServer.h" 1534522da9SNiels Sascha Reedijk 1634522da9SNiels Sascha Reedijk using BPrivate::Network::BHttpSession; 1734522da9SNiels Sascha Reedijk 1834522da9SNiels Sascha Reedijk 1934522da9SNiels Sascha Reedijk class HttpProtocolTest: public BTestCase { 2034522da9SNiels Sascha Reedijk public: 2134522da9SNiels Sascha Reedijk HttpProtocolTest(); 2234522da9SNiels Sascha Reedijk 23a8003a70SNiels Sascha Reedijk void HttpFieldsTest(); 24ec865cb8SNiels Sascha Reedijk void HttpMethodTest(); 256ce6e964SNiels Sascha Reedijk void HttpRequestTest(); 2602ea57d7SNiels Sascha Reedijk void HttpRequestStreamTest(); 27*1d2070c7SNiels Sascha Reedijk 28*1d2070c7SNiels Sascha Reedijk static void AddTests(BTestSuite& suite); 29*1d2070c7SNiels Sascha Reedijk }; 30*1d2070c7SNiels Sascha Reedijk 31*1d2070c7SNiels Sascha Reedijk 32*1d2070c7SNiels Sascha Reedijk class HttpIntegrationTest : public BThreadedTestCase 33*1d2070c7SNiels Sascha Reedijk { 34*1d2070c7SNiels Sascha Reedijk public: 35*1d2070c7SNiels Sascha Reedijk HttpIntegrationTest(TestServerMode mode); 36*1d2070c7SNiels Sascha Reedijk 37*1d2070c7SNiels Sascha Reedijk virtual void setUp() override; 38*1d2070c7SNiels Sascha Reedijk 39*1d2070c7SNiels Sascha Reedijk 40*1d2070c7SNiels Sascha Reedijk void HostAndNetworkFailTest(); 4134522da9SNiels Sascha Reedijk 4234522da9SNiels Sascha Reedijk static void AddTests(BTestSuite& suite); 4334522da9SNiels Sascha Reedijk 4434522da9SNiels Sascha Reedijk private: 45*1d2070c7SNiels Sascha Reedijk TestServer fTestServer; 4634522da9SNiels Sascha Reedijk BHttpSession fSession; 4734522da9SNiels Sascha Reedijk }; 4834522da9SNiels Sascha Reedijk 4934522da9SNiels Sascha Reedijk #endif 50