xref: /haiku/src/tests/kits/net/netservices2/HttpProtocolTest.h (revision 2f3b9b18ac127ca19014a8c83a9fb8df75e3ec7a)
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 
141d2070c7SNiels 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();
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;
391d2070c7SNiels Sascha Reedijk 
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();
47*2f3b9b18SNiels Sascha Reedijk 			void	StopOnErrorTest();
4834522da9SNiels Sascha Reedijk 
4934522da9SNiels Sascha Reedijk 	static	void	AddTests(BTestSuite& suite);
5034522da9SNiels Sascha Reedijk 
5134522da9SNiels Sascha Reedijk private:
521d2070c7SNiels Sascha Reedijk 			TestServer		fTestServer;
5334522da9SNiels Sascha Reedijk 			BHttpSession	fSession;
5434522da9SNiels Sascha Reedijk };
5534522da9SNiels Sascha Reedijk 
5634522da9SNiels Sascha Reedijk #endif
57