Inheritance diagram for Protocols::Generics::Testing::SocketTransportTest:


Definition at line 38 of file SocketTransportTest.cpp.
Public Member Functions | |
| SocketTransportTest () | |
| void | setUp () |
| void | tearDown () |
| void | stateDisconnected () |
| void | testStartConnecting () |
| Initiate a connection attempt (competes asynchronously). | |
| void | stateConnecting () |
| void | testConnectionEstablished () |
| A connection attempt succeeds. | |
| void | stateConnected () |
| void | testConnectionRejected () |
| The remote node rejects the incoming connection or attempt fails. | |
| void | testAbortConnectionAttempt () |
| We abort a connection attempt before it has either succeeded or failed. | |
| void | refStartDisconnecting () |
| void | testStartDisconnecting () |
| Initiate a disconnection (completes asynchronously). | |
| void | stateDisconnecting () |
| void | testDisconnectingCompletes () |
| A disconnection initiated with disconnectFromNode() completes. | |
| void | testAbortWhileDisconnecting () |
| Calling abort() while still disconnecting disconnects immediately. | |
| void | testConnectionDisconnectedBySocket () |
| A disconnected socket results in a disconnected transport. | |
| void | testAbortDueToSocketError () |
| Verify that socket is aborted upon a socket error. | |
| void | testSocketConnectedTwice () |
| Test correct behavior in case socketConnected() is called twice. | |
| void | testSocketDisconnectedTwice () |
| Test correct behavior in case socketDisconnected() is called twice. | |
| void | testSocketErrorTwice () |
| Test correct behavior in case socketError() is called twice. | |
| void | testSocketErrorSocketDisconnected () |
| QAbstractSocket emits error() and disconnected() in sequence. | |
| void | testSocketDisconnectedSocketError () |
| Test correct behavior in socketDisconnected(), socketError() sequence. | |
| void | refWriteBytes (const QByteArray &bytes, bool flush, bool succeeds) |
| Helper that verfies the expectations of transport->write(). | |
| void | testWriteDelegatesToSocketBufferAndTriesToWriteToSocket () |
| Verify that write() just delegates the call to buffer. | |
| void | refReadsDelegateToBuffer () |
| void | testReadsDelegateToSocketBufferThenTriesToReadMoreFromSocket () |
| Verify that all read functions just delegate the call to buffer. | |
| void | refPeedsDelegateToSocketBuffer () |
| void | testPeeksDelegateToSocketBuffer () |
| Verify that all peek functions just delegate the call to buffer. | |
| void | refCanReadDelegatesToBuffer (int count, bool canRead) |
| void | refCanWriteDelegatesToBuffer (int count, bool canWrite) |
| void | testCanReadCanWriteDelegateToSocketBuffer () |
| Should delegate canRead() and canWrite() to the SocketBuffer object. | |
| void | testSocketReadMakesBufferToReadFromSocketAndEmitsReadyRead () |
| Socket can read bytes, have the buffer read them and send readyRead(). | |
| void | testSocketWrittenMakesBufferToWriteToSocketAndEmitsReadyWrite () |
| Socket can write bytes, flush the buffer and send readyWrite(). | |
| void | testSocketWrittenReadyWriteNotCalledRecursively () |
| readyWrite() must not be called recursively even if socketWritten() is. | |
| void | testReadyWriteNotCalledFromWrite () |
| readyWrite() must not be called from withing a write() call. | |
| void | testSocketWrittenDoesNotCallTryWriteToRecursively () |
| socketWritten() might be called recursively, second call should return. | |
| void | testSocketReadReadyReadNofCalledRecursively () |
| readRead() must never be called recursovely. | |
| void | testReadyReadNotCalledFromRead () |
| readyRead() must not be send from read(). | |
| void | testSocketReadDoesNotCallTryReadFromRecursively () |
| socketRead() might be called recursively, second call should return. | |
Private Member Functions | |
| CPPUNIT_TEST_SUITE (SocketTransportTest) | |
| CPPUNIT_TEST (testStartConnecting) | |
| CPPUNIT_TEST (testConnectionEstablished) | |
| CPPUNIT_TEST (testConnectionRejected) | |
| CPPUNIT_TEST (testAbortConnectionAttempt) | |
| CPPUNIT_TEST (testStartDisconnecting) | |
| CPPUNIT_TEST (testDisconnectingCompletes) | |
| CPPUNIT_TEST (testAbortWhileDisconnecting) | |
| CPPUNIT_TEST (testConnectionDisconnectedBySocket) | |
| CPPUNIT_TEST (testAbortDueToSocketError) | |
| CPPUNIT_TEST (testSocketConnectedTwice) | |
| CPPUNIT_TEST (testSocketDisconnectedTwice) | |
| CPPUNIT_TEST (testSocketErrorTwice) | |
| CPPUNIT_TEST (testSocketErrorSocketDisconnected) | |
| CPPUNIT_TEST (testSocketDisconnectedSocketError) | |
| CPPUNIT_TEST (testWriteDelegatesToSocketBufferAndTriesToWriteToSocket) | |
| CPPUNIT_TEST (testReadsDelegateToSocketBufferThenTriesToReadMoreFromSocket) | |
| CPPUNIT_TEST (testPeeksDelegateToSocketBuffer) | |
| CPPUNIT_TEST (testCanReadCanWriteDelegateToSocketBuffer) | |
| CPPUNIT_TEST (testSocketReadMakesBufferToReadFromSocketAndEmitsReadyRead) | |
| CPPUNIT_TEST (testSocketWrittenMakesBufferToWriteToSocketAndEmitsReadyWrite) | |
| CPPUNIT_TEST (testSocketWrittenReadyWriteNotCalledRecursively) | |
| CPPUNIT_TEST (testReadyWriteNotCalledFromWrite) | |
| CPPUNIT_TEST (testSocketWrittenDoesNotCallTryWriteToRecursively) | |
| CPPUNIT_TEST (testSocketReadReadyReadNofCalledRecursively) | |
| CPPUNIT_TEST (testReadyReadNotCalledFromRead) | |
| CPPUNIT_TEST (testSocketReadDoesNotCallTryReadFromRecursively) | |
| CPPUNIT_TEST_SUITE_END () | |
Private Attributes | |
| auto_ptr< SocketMock > | socket |
| auto_ptr< SocketBufferMock > | buffer |
| auto_ptr< TransportStatusMock > | status |
| auto_ptr< SocketTransport > | transport_real |
| auto_ptr< SocketTransportDriver > | transport |
|
|
Definition at line 76 of file SocketTransportTest.cpp. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 414 of file SocketTransportTest.cpp. |
|
||||||||||||
|
Definition at line 422 of file SocketTransportTest.cpp. |
|
|
Definition at line 377 of file SocketTransportTest.cpp. |
|
|
Definition at line 328 of file SocketTransportTest.cpp. |
|
|
Definition at line 178 of file SocketTransportTest.cpp. |
|
||||||||||||||||
|
Helper that verfies the expectations of transport->write(). It is important that buffer->tryWriteTo() is called to make sure that any data already buffered can be passed to the OS. It could have happened that a socketWritten() notification was received but the write buffer was empty so we had nothing to write. In this case we should retry right after some new data has been written to the write buffer. Definition at line 303 of file SocketTransportTest.cpp. |
|
|
Definition at line 81 of file SocketTransportTest.cpp. |
|
|
Definition at line 135 of file SocketTransportTest.cpp. |
|
|
Definition at line 119 of file SocketTransportTest.cpp. |
|
|
This one just uses the normal setUp(), the idea is to have functions representing a state invariant. Definition at line 103 of file SocketTransportTest.cpp. |
|
|
Definition at line 193 of file SocketTransportTest.cpp. |
|
|
Definition at line 90 of file SocketTransportTest.cpp. |
|
|
We abort a connection attempt before it has either succeeded or failed.
Definition at line 164 of file SocketTransportTest.cpp. |
|
|
Verify that socket is aborted upon a socket error.
Definition at line 236 of file SocketTransportTest.cpp. |
|
|
Calling abort() while still disconnecting disconnects immediately.
Definition at line 210 of file SocketTransportTest.cpp. |
|
|
Should delegate canRead() and canWrite() to the SocketBuffer object. While in "disconnecting" state we are allowed to try to read bytes but we are not allowed to try to write bytes. Definition at line 435 of file SocketTransportTest.cpp. |
|
|
A disconnected socket results in a disconnected transport.
Definition at line 225 of file SocketTransportTest.cpp. |
|
|
A connection attempt succeeds.
Definition at line 125 of file SocketTransportTest.cpp. |
|
|
The remote node rejects the incoming connection or attempt fails. We simulate a socket error by directly invoking the socketError() slot of TcpTransport. We assume that QTcpConnection behaves the same way in simulation. Definition at line 146 of file SocketTransportTest.cpp. |
|
|
A disconnection initiated with disconnectFromNode() completes.
Definition at line 199 of file SocketTransportTest.cpp. |
|
|
Verify that all peek functions just delegate the call to buffer. Just test all different read variants once. Peeking data should be possible even while in "disconnecting" state. Definition at line 406 of file SocketTransportTest.cpp. |
|
|
Verify that all read functions just delegate the call to buffer. Just test all different read variants once. It is important that buffer->tryReadFrom() is called to make sure that any data already buffered by the OS could be read. It could have happened that a socketRead() notification was received but the read buffer was full so we could read nothing. In this case we should retry right after some space in the read buffer is available. Definition at line 369 of file SocketTransportTest.cpp. |
|
|
readyRead() must not be send from read(). If readyRead() is called from withing read(), the result could be a recursive call of read() from the client code and we do not want that. Definition at line 572 of file SocketTransportTest.cpp. |
|
|
readyWrite() must not be called from withing a write() call. Because write() will try to write the bytes to the socket, the socket might call socketWritten(), which should not try to write to the socket again. Definition at line 509 of file SocketTransportTest.cpp. |
|
|
Test correct behavior in case socketConnected() is called twice.
Definition at line 251 of file SocketTransportTest.cpp. |
|
|
Test correct behavior in socketDisconnected(), socketError() sequence.
Definition at line 287 of file SocketTransportTest.cpp. |
|
|
Test correct behavior in case socketDisconnected() is called twice.
Definition at line 260 of file SocketTransportTest.cpp. |
|
|
QAbstractSocket emits error() and disconnected() in sequence.
Definition at line 278 of file SocketTransportTest.cpp. |
|
|
Test correct behavior in case socketError() is called twice.
Definition at line 269 of file SocketTransportTest.cpp. |
|
|
socketRead() might be called recursively, second call should return.
Definition at line 585 of file SocketTransportTest.cpp. |
|
|
Socket can read bytes, have the buffer read them and send readyRead().
Definition at line 452 of file SocketTransportTest.cpp. |
|
|
readRead() must never be called recursovely. The client code could read() in response to readyRead(), which would trigger a call to tryReadFrom() which might emit socketRead() again. The second time sockerRead() is entered it should return right away.
Definition at line 547 of file SocketTransportTest.cpp. |
|
|
socketWritten() might be called recursively, second call should return.
Definition at line 524 of file SocketTransportTest.cpp. |
|
|
Socket can write bytes, flush the buffer and send readyWrite().
Definition at line 465 of file SocketTransportTest.cpp. |
|
|
readyWrite() must not be called recursively even if socketWritten() is. socketWritten() emits readyWrite(), from which the client code could call write() to srite bytes to socket, which might send socketWritten() again. We should handle the case to avoid recursion. Definition at line 483 of file SocketTransportTest.cpp. |
|
|
Initiate a connection attempt (competes asynchronously).
Definition at line 108 of file SocketTransportTest.cpp. |
|
|
Initiate a disconnection (completes asynchronously).
Definition at line 187 of file SocketTransportTest.cpp. |
|
|
Verify that write() just delegates the call to buffer. Just try the different permutations of the parameters to make sure all parameters are simply passed through. Definition at line 318 of file SocketTransportTest.cpp. |
|
|
Definition at line 70 of file SocketTransportTest.cpp. |
|
|
Definition at line 69 of file SocketTransportTest.cpp. |
|
|
Definition at line 71 of file SocketTransportTest.cpp. |
|
|
Definition at line 73 of file SocketTransportTest.cpp. |
|
|
Definition at line 72 of file SocketTransportTest.cpp. |