xref: /haiku/src/tests/kits/net/netservices2/HttpProtocolTest.h (revision 71e29bbeea760848317843508c711f2a0b446fbb)
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 
14aa8ca18aSNiels 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 
20*71e29bbeSNiels Sascha Reedijk class HttpProtocolTest : public BTestCase
21*71e29bbeSNiels Sascha Reedijk {
2234522da9SNiels Sascha Reedijk public:
2334522da9SNiels Sascha Reedijk 								HttpProtocolTest();
2434522da9SNiels Sascha Reedijk 
25a8003a70SNiels Sascha Reedijk 			void				HttpFieldsTest();
26ec865cb8SNiels Sascha Reedijk 			void				HttpMethodTest();
276ce6e964SNiels Sascha Reedijk 			void				HttpRequestTest();
28cf54474eSNiels Sascha Reedijk 			void				HttpTimeTest();
291d2070c7SNiels Sascha Reedijk 
301d2070c7SNiels Sascha Reedijk 	static	void				AddTests(BTestSuite& suite);
311d2070c7SNiels Sascha Reedijk };
321d2070c7SNiels Sascha Reedijk 
331d2070c7SNiels Sascha Reedijk 
341d2070c7SNiels Sascha Reedijk class HttpIntegrationTest : public BThreadedTestCase
351d2070c7SNiels Sascha Reedijk {
361d2070c7SNiels Sascha Reedijk public:
371d2070c7SNiels Sascha Reedijk 								HttpIntegrationTest(TestServerMode mode);
381d2070c7SNiels Sascha Reedijk 
391d2070c7SNiels Sascha Reedijk 	virtual	void				setUp() override;
40aa8ca18aSNiels Sascha Reedijk 	virtual	void				tearDown() override;
411d2070c7SNiels Sascha Reedijk 
421d2070c7SNiels Sascha Reedijk 			void				HostAndNetworkFailTest();
43d482381dSNiels Sascha Reedijk 			void				GetTest();
4427196c40SNiels Sascha Reedijk 			void				GetWithBufferTest();
4559c359e5SNiels Sascha Reedijk 			void				HeadTest();
4659c359e5SNiels Sascha Reedijk 			void				NoContentTest();
4713bfff7bSNiels Sascha Reedijk 			void				AutoRedirectTest();
48f9d9d202SNiels Sascha Reedijk 			void				BasicAuthTest();
492f3b9b18SNiels Sascha Reedijk 			void				StopOnErrorTest();
506cbbd9bfSNiels Sascha Reedijk 			void				RequestCancelTest();
5192357c13SNiels Sascha Reedijk 			void				PostTest();
5234522da9SNiels Sascha Reedijk 
5334522da9SNiels Sascha Reedijk 	static	void				AddTests(BTestSuite& suite);
5434522da9SNiels Sascha Reedijk 
5534522da9SNiels Sascha Reedijk private:
561d2070c7SNiels Sascha Reedijk 			TestServer			fTestServer;
5734522da9SNiels Sascha Reedijk 			BHttpSession		fSession;
58aa8ca18aSNiels Sascha Reedijk 			HttpDebugLogger*	fLogger;
59aa8ca18aSNiels Sascha Reedijk 			BMessenger			fLoggerMessenger;
6034522da9SNiels Sascha Reedijk };
6134522da9SNiels Sascha Reedijk 
6234522da9SNiels Sascha Reedijk #endif
63