xref: /haiku/src/tests/kits/net/netservices2/HttpProtocolTest.h (revision c237c4ce593ee823d9867fd997e51e4c447f5623)
1 /*
2  * Copyright 2021 Haiku, inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef HTTP_TEST_H
6 #define HTTP_TEST_H
7 
8 
9 #include <HttpSession.h>
10 #include <TestCase.h>
11 #include <TestSuite.h>
12 #include <tools/cppunit/ThreadedTestCase.h>
13 
14 #include "HttpDebugLogger.h"
15 #include "TestServer.h"
16 
17 using BPrivate::Network::BHttpSession;
18 
19 
20 class HttpProtocolTest : public BTestCase
21 {
22 public:
23 								HttpProtocolTest();
24 
25 			void				HttpFieldsTest();
26 			void				HttpMethodTest();
27 			void				HttpRequestTest();
28 			void				HttpTimeTest();
29 
30 	static	void				AddTests(BTestSuite& suite);
31 };
32 
33 
34 class HttpIntegrationTest : public BThreadedTestCase
35 {
36 public:
37 								HttpIntegrationTest(TestServerMode mode);
38 
39 	virtual	void				setUp() override;
40 	virtual	void				tearDown() override;
41 
42 			void				HostAndNetworkFailTest();
43 			void				GetTest();
44 			void				GetWithBufferTest();
45 			void				HeadTest();
46 			void				NoContentTest();
47 			void				AutoRedirectTest();
48 			void				BasicAuthTest();
49 			void				StopOnErrorTest();
50 			void				RequestCancelTest();
51 			void				PostTest();
52 
53 	static	void				AddTests(BTestSuite& suite);
54 
55 private:
56 			TestServer			fTestServer;
57 			BHttpSession		fSession;
58 			HttpDebugLogger*	fLogger;
59 			BMessenger			fLoggerMessenger;
60 };
61 
62 #endif
63