xref: /haiku/src/tests/kits/net/netservices2/HttpProtocolTest.h (revision aa8ca18a34c34982a061b24162119ddc75b73353)
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>
121d2070c7SNiels Sascha Reedijk #include <tools/cppunit/ThreadedTestCase.h>
131d2070c7SNiels Sascha Reedijk 
14*aa8ca18aSNiels Sascha Reedijk #include "HttpDebugLogger.h"
151d2070c7SNiels Sascha Reedijk #include "TestServer.h"
1634522da9SNiels Sascha Reedijk 
1734522da9SNiels Sascha Reedijk using BPrivate::Network::BHttpSession;
1834522da9SNiels Sascha Reedijk 
1934522da9SNiels Sascha Reedijk 
2034522da9SNiels Sascha Reedijk class HttpProtocolTest: public BTestCase {
2134522da9SNiels Sascha Reedijk public:
2234522da9SNiels Sascha Reedijk 					HttpProtocolTest();
2334522da9SNiels Sascha Reedijk 
24a8003a70SNiels Sascha Reedijk 			void	HttpFieldsTest();
25ec865cb8SNiels Sascha Reedijk 			void	HttpMethodTest();
266ce6e964SNiels Sascha Reedijk 			void	HttpRequestTest();
27cf54474eSNiels Sascha Reedijk 			void	HttpTimeTest();
281d2070c7SNiels Sascha Reedijk 
291d2070c7SNiels Sascha Reedijk 	static	void	AddTests(BTestSuite& suite);
301d2070c7SNiels Sascha Reedijk };
311d2070c7SNiels Sascha Reedijk 
321d2070c7SNiels Sascha Reedijk 
331d2070c7SNiels Sascha Reedijk class HttpIntegrationTest : public BThreadedTestCase
341d2070c7SNiels Sascha Reedijk {
351d2070c7SNiels Sascha Reedijk public:
361d2070c7SNiels Sascha Reedijk 					HttpIntegrationTest(TestServerMode mode);
371d2070c7SNiels Sascha Reedijk 
381d2070c7SNiels Sascha Reedijk 	virtual	void		setUp() override;
39*aa8ca18aSNiels Sascha Reedijk 	virtual void		tearDown() override;
401d2070c7SNiels Sascha Reedijk 
411d2070c7SNiels Sascha Reedijk 			void	HostAndNetworkFailTest();
42d482381dSNiels Sascha Reedijk 			void	GetTest();
4359c359e5SNiels Sascha Reedijk 			void	HeadTest();
4459c359e5SNiels Sascha Reedijk 			void	NoContentTest();
4513bfff7bSNiels Sascha Reedijk 			void	AutoRedirectTest();
46f9d9d202SNiels Sascha Reedijk 			void	BasicAuthTest();
472f3b9b18SNiels Sascha Reedijk 			void	StopOnErrorTest();
486cbbd9bfSNiels Sascha Reedijk 			void	RequestCancelTest();
4992357c13SNiels Sascha Reedijk 			void	PostTest();
5034522da9SNiels Sascha Reedijk 
5134522da9SNiels Sascha Reedijk 	static	void	AddTests(BTestSuite& suite);
5234522da9SNiels Sascha Reedijk 
5334522da9SNiels Sascha Reedijk private:
541d2070c7SNiels Sascha Reedijk 			TestServer			fTestServer;
5534522da9SNiels Sascha Reedijk 			BHttpSession		fSession;
56*aa8ca18aSNiels Sascha Reedijk 			HttpDebugLogger*	fLogger;
57*aa8ca18aSNiels Sascha Reedijk 			BMessenger			fLoggerMessenger;
5834522da9SNiels Sascha Reedijk };
5934522da9SNiels Sascha Reedijk 
6034522da9SNiels Sascha Reedijk #endif
61