added wxURL test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57662 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9588640d19
commit
6799c5e283
@ -26,6 +26,8 @@
|
|||||||
#if wxUSE_SOCKETS
|
#if wxUSE_SOCKETS
|
||||||
|
|
||||||
#include "wx/socket.h"
|
#include "wx/socket.h"
|
||||||
|
#include "wx/url.h"
|
||||||
|
#include "wx/sstream.h"
|
||||||
#include "wx/evtloop.h"
|
#include "wx/evtloop.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -54,6 +56,7 @@ private:
|
|||||||
ALL_SOCKET_TESTS();
|
ALL_SOCKET_TESTS();
|
||||||
CPPUNIT_TEST( PseudoTest_SetUseEventLoop );
|
CPPUNIT_TEST( PseudoTest_SetUseEventLoop );
|
||||||
ALL_SOCKET_TESTS();
|
ALL_SOCKET_TESTS();
|
||||||
|
CPPUNIT_TEST( UrlTest );
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
// helper event loop class which sets itself as active only if we pass it
|
// helper event loop class which sets itself as active only if we pass it
|
||||||
@ -95,6 +98,8 @@ private:
|
|||||||
void ReadNowait();
|
void ReadNowait();
|
||||||
void ReadWaitall();
|
void ReadWaitall();
|
||||||
|
|
||||||
|
void UrlTest();
|
||||||
|
|
||||||
static bool ms_useLoop;
|
static bool ms_useLoop;
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(SocketTestCase)
|
DECLARE_NO_COPY_CLASS(SocketTestCase)
|
||||||
@ -233,4 +238,19 @@ void SocketTestCase::ReadWaitall()
|
|||||||
CPPUNIT_ASSERT_EQUAL( WXSIZEOF(buf), sock->LastCount() );
|
CPPUNIT_ASSERT_EQUAL( WXSIZEOF(buf), sock->LastCount() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SocketTestCase::UrlTest()
|
||||||
|
{
|
||||||
|
if ( gs_serverHost.empty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
SocketTestEventLoop loop(ms_useLoop);
|
||||||
|
|
||||||
|
wxURL url("http://" + gs_serverHost);
|
||||||
|
wxInputStream * const in = url.GetInputStream();
|
||||||
|
CPPUNIT_ASSERT( in );
|
||||||
|
|
||||||
|
wxStringOutputStream out;
|
||||||
|
CPPUNIT_ASSERT_EQUAL( wxSTREAM_EOF, in->Read(out).GetLastError() );
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_SOCKETS
|
#endif // wxUSE_SOCKETS
|
||||||
|
Loading…
Reference in New Issue
Block a user