make the test really use the event loop in its second half (this already was the intention before but it didn't work correctly)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57582 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-27 11:12:47 +00:00
parent 564c7fc412
commit 8d8087fc9b

View File

@@ -37,7 +37,7 @@ static wxString gs_serverHost(wxGetenv("WX_TEST_SERVER"));
class SocketTestCase : public CppUnit::TestCase class SocketTestCase : public CppUnit::TestCase
{ {
public: public:
SocketTestCase() { m_useLoop = false; } SocketTestCase() { }
private: private:
// we need to repeat the tests twice as the sockets behave differently when // we need to repeat the tests twice as the sockets behave differently when
@@ -86,7 +86,7 @@ private:
// disabled // disabled
wxSocketClientPtr GetHTTPSocket(int flags = wxSOCKET_NONE) const; wxSocketClientPtr GetHTTPSocket(int flags = wxSOCKET_NONE) const;
void PseudoTest_SetUseEventLoop() { m_useLoop = true; } void PseudoTest_SetUseEventLoop() { ms_useLoop = true; }
void BlockingConnect(); void BlockingConnect();
void NonblockingConnect(); void NonblockingConnect();
@@ -95,11 +95,13 @@ private:
void ReadNowait(); void ReadNowait();
void ReadWaitall(); void ReadWaitall();
bool m_useLoop; static bool ms_useLoop;
DECLARE_NO_COPY_CLASS(SocketTestCase) DECLARE_NO_COPY_CLASS(SocketTestCase)
}; };
bool SocketTestCase::ms_useLoop = false;
CPPUNIT_TEST_SUITE_REGISTRATION( SocketTestCase ); CPPUNIT_TEST_SUITE_REGISTRATION( SocketTestCase );
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SocketTestCase, "SocketTestCase" ); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SocketTestCase, "SocketTestCase" );
@@ -151,7 +153,7 @@ void SocketTestCase::NonblockingConnect()
if ( !addr.get() ) if ( !addr.get() )
return; return;
SocketTestEventLoop loop(m_useLoop); SocketTestEventLoop loop(ms_useLoop);
wxSocketClient sock; wxSocketClient sock;
sock.Connect(*addr, false); sock.Connect(*addr, false);
@@ -162,7 +164,7 @@ void SocketTestCase::NonblockingConnect()
void SocketTestCase::ReadNormal() void SocketTestCase::ReadNormal()
{ {
SocketTestEventLoop loop(m_useLoop); SocketTestEventLoop loop(ms_useLoop);
wxSocketClientPtr sock(GetHTTPSocket()); wxSocketClientPtr sock(GetHTTPSocket());
if ( !sock.get() ) if ( !sock.get() )
@@ -218,7 +220,7 @@ void SocketTestCase::ReadNowait()
void SocketTestCase::ReadWaitall() void SocketTestCase::ReadWaitall()
{ {
SocketTestEventLoop loop(m_useLoop); SocketTestEventLoop loop(ms_useLoop);
wxSocketClientPtr sock(GetHTTPSocket(wxSOCKET_WAITALL)); wxSocketClientPtr sock(GetHTTPSocket(wxSOCKET_WAITALL));
if ( !sock.get() ) if ( !sock.get() )