xref: /haiku/src/tests/kits/net/service/DataTest.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2014 Haiku, inc.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #ifndef DATA_TEST_H
8 #define DATA_TEST_H
9 
10 
11 #include <Url.h>
12 #include <UrlProtocolListener.h>
13 
14 #include <TestCase.h>
15 #include <TestSuite.h>
16 
17 #include <cppunit/TestSuite.h>
18 
19 
20 class DataTest: public BTestCase, BUrlProtocolListener {
21 public:
22 								DataTest();
23 	virtual						~DataTest();
24 
25 			void				SimpleTest();
26 			void				EmptyTest();
27 			void				InvalidTest();
28 			void				CharsetTest();
29 			void				Base64Test();
30 			void				UrlDecodeTest();
31 
32 			void				DataReceived(BUrlRequest*, const char* data,
33 									off_t, ssize_t size);
34 
35 	static	void				AddTests(BTestSuite& suite);
36 
37 private:
38 			void				_RunTest(BString url, const char* expected,
39 									size_t expectedLength);
40 private:
41 			std::vector<char>	fReceivedData;
42 };
43 
44 
45 #endif
46 
47