Tests: add skeleton for new services kits tests

Change-Id: I759c6b91d3bf856dbbe8b8b6112d53e601798abf
This commit is contained in:
Niels Sascha Reedijk 2021-09-14 21:31:54 +01:00
parent 3d2aee7545
commit 892cbe10b6
5 changed files with 97 additions and 0 deletions

View File

@ -12,5 +12,6 @@ SimpleTest wlan_test : wlan_test.cpp : $(TARGET_NETWORK_LIBS) bnetapi be ;
SubInclude HAIKU_TOP src tests kits net cookie ;
HaikuSubInclude libnetapi ;
SubInclude HAIKU_TOP src tests kits net netservices2 ;
SubInclude HAIKU_TOP src tests kits net service ;
SubInclude HAIKU_TOP src tests kits net urlRequest ;

View File

@ -0,0 +1,33 @@
/*
* Copyright 2021 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Niels Sascha Reedijk, niels.reedijk@gmail.com
*/
#include "HttpTest.h"
#include <cppunit/TestSuite.h>
using BPrivate::Network::BHttpSession;
HttpTest::HttpTest(BHttpSession& session)
:fSession(session)
{
}
/* static */ void
HttpTest::AddTests(BTestSuite& parent)
{
CppUnit::TestSuite& suite = *new CppUnit::TestSuite("HttpTest");
BHttpSession session;
HttpTest* httpTest = new HttpTest(session);
// leak for now
parent.addTest("HttpTest", &suite);
}

View File

@ -0,0 +1,27 @@
/*
* Copyright 2021 Haiku, inc.
* Distributed under the terms of the MIT License.
*/
#ifndef HTTP_TEST_H
#define HTTP_TEST_H
#include <HttpSession.h>
#include <TestCase.h>
#include <TestSuite.h>
using BPrivate::Network::BHttpSession;
class HttpTest: public BTestCase {
public:
HttpTest(BHttpSession& session);
static void AddTests(BTestSuite& suite);
private:
BHttpSession fSession;
};
#endif

View File

@ -0,0 +1,15 @@
SubDir HAIKU_TOP src tests kits net netservices2 ;
if $(TARGET_PACKAGING_ARCH) != x86_gcc2 {
# do not target the legacy platform
UsePrivateHeaders netservices2 ;
UnitTestLib netservicekit2test.so :
ServicesKitTestAddon.cpp
HttpTest.cpp
: be libnetservices2.a $(TARGET_NETWORK_LIBS) $(HAIKU_NETAPI_LIB)
[ TargetLibstdc++ ]
;
}

View File

@ -0,0 +1,21 @@
/*
* Copyright 2021 Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#include <TestSuite.h>
#include <TestSuiteAddon.h>
#include "HttpTest.h"
BTestSuite*
getTestSuite()
{
BTestSuite* suite = new BTestSuite("NetServices2Kit");
HttpTest::AddTests(*suite);
return suite;
}