Protocols::BitTorrent::Transfers::Testing::SessionTest Class Reference

Inherits TestFixture.

Inheritance diagram for Protocols::BitTorrent::Transfers::Testing::SessionTest:

Inheritance graph
[legend]
Collaboration diagram for Protocols::BitTorrent::Transfers::Testing::SessionTest:

Collaboration graph
[legend]
List of all members.

Detailed Description

Tests for Session.

Definition at line 36 of file SessionTest.cpp.

Public Member Functions

void setUp ()
void tearDown ()
QByteArray makeHandshakeBytes (const FileId &fileId, const PeerInfo &peerInfo)
void testEstablishSessionSucceedsDirectly ()
 Handshaking completes right after the transport is connected.
void scenarioEstablishSessionSucceedsAfterANumberOfReadyReads (int count)
void testEstablishSessionSucceedsAfterOneReadyRead ()
 Handshaking should finish after the first readyRead().
void testEstablishSessionSucceedsAfterTwoReadyRead ()
 Handshaking should finish after the second readyRead().
void testEstablishSessionSucceedsAfterThreeReadyRead ()
 Handshaking should finish after the third readyRead().
void testAcceptConnectionSucceedsDirectly ()
 An incoming session succeeds directly if the in-handshake is buffered.
void scenarioAcceptConnectionSucceedsAfterANumberOfReadyReads (int count)
 Handshaking should continue after some more data has become available.
void testAcceptConnectionSucceedsAfterOneReadyRead ()
 Handshaking should finish after the first readyRead().
void testAcceptConnectionSucceedsAfterTwoReadyReads ()
 Handshaking should finish after the second readyRead().
void testAcceptConnectionSucceedsAfterThreeReadyReads ()
 Handshaking should finish after the third readyRead().
void stateEstablished ()

Private Member Functions

 CPPUNIT_TEST_SUITE (SessionTest)
 CPPUNIT_TEST (testEstablishSessionSucceedsDirectly)
 CPPUNIT_TEST (testEstablishSessionSucceedsAfterOneReadyRead)
 CPPUNIT_TEST (testEstablishSessionSucceedsAfterTwoReadyRead)
 CPPUNIT_TEST (testEstablishSessionSucceedsAfterThreeReadyRead)
 CPPUNIT_TEST (testAcceptConnectionSucceedsDirectly)
 CPPUNIT_TEST (testAcceptConnectionSucceedsAfterOneReadyRead)
 CPPUNIT_TEST (testAcceptConnectionSucceedsAfterTwoReadyReads)
 CPPUNIT_TEST (testAcceptConnectionSucceedsAfterThreeReadyReads)
 CPPUNIT_TEST_SUITE_END ()

Private Attributes

PeerInfo myPeerInfo
PeerInfo remotePeerInfo
FileId fileId
auto_ptr< TransportMock > transport
auto_ptr< SessionStatusMock > status
auto_ptr< Sessionsession_real
auto_ptr< SessionDriver > session


Member Function Documentation

Protocols::BitTorrent::Transfers::Testing::SessionTest::CPPUNIT_TEST testAcceptConnectionSucceedsAfterThreeReadyReads   )  [private]
 

Protocols::BitTorrent::Transfers::Testing::SessionTest::CPPUNIT_TEST testAcceptConnectionSucceedsAfterTwoReadyReads   )  [private]
 

Protocols::BitTorrent::Transfers::Testing::SessionTest::CPPUNIT_TEST testAcceptConnectionSucceedsAfterOneReadyRead   )  [private]
 

Protocols::BitTorrent::Transfers::Testing::SessionTest::CPPUNIT_TEST testAcceptConnectionSucceedsDirectly   )  [private]
 

Protocols::BitTorrent::Transfers::Testing::SessionTest::CPPUNIT_TEST testEstablishSessionSucceedsAfterThreeReadyRead   )  [private]
 

Protocols::BitTorrent::Transfers::Testing::SessionTest::CPPUNIT_TEST testEstablishSessionSucceedsAfterTwoReadyRead   )  [private]
 

Protocols::BitTorrent::Transfers::Testing::SessionTest::CPPUNIT_TEST testEstablishSessionSucceedsAfterOneReadyRead   )  [private]
 

Protocols::BitTorrent::Transfers::Testing::SessionTest::CPPUNIT_TEST testEstablishSessionSucceedsDirectly   )  [private]
 

Protocols::BitTorrent::Transfers::Testing::SessionTest::CPPUNIT_TEST_SUITE SessionTest   )  [private]
 

Protocols::BitTorrent::Transfers::Testing::SessionTest::CPPUNIT_TEST_SUITE_END  )  [private]
 

QByteArray Protocols::BitTorrent::Transfers::Testing::SessionTest::makeHandshakeBytes const FileId fileId,
const PeerInfo peerInfo
[inline]
 

Definition at line 90 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::scenarioAcceptConnectionSucceedsAfterANumberOfReadyReads int  count  )  [inline]
 

Handshaking should continue after some more data has become available.

count is the number of times readyRead() is called before the handshake is read completely.

Definition at line 211 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::scenarioEstablishSessionSucceedsAfterANumberOfReadyReads int  count  )  [inline]
 

Definition at line 121 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::setUp  )  [inline]
 

Definition at line 68 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::stateEstablished  )  [inline]
 

Definition at line 273 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::tearDown  )  [inline]
 

Definition at line 82 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::testAcceptConnectionSucceedsAfterOneReadyRead  )  [inline]
 

Handshaking should finish after the first readyRead().

Definition at line 254 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::testAcceptConnectionSucceedsAfterThreeReadyReads  )  [inline]
 

Handshaking should finish after the third readyRead().

Definition at line 266 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::testAcceptConnectionSucceedsAfterTwoReadyReads  )  [inline]
 

Handshaking should finish after the second readyRead().

Definition at line 260 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::testAcceptConnectionSucceedsDirectly  )  [inline]
 

An incoming session succeeds directly if the in-handshake is buffered.

Note:
We test session->accept() separately here and in scenarioAcceptConnectionSucceedsAfterANumberOfReadyReads() because we have different transition that get triggered and we want to verify that both are done correctly.

Definition at line 180 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::testEstablishSessionSucceedsAfterOneReadyRead  )  [inline]
 

Handshaking should finish after the first readyRead().

Definition at line 156 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::testEstablishSessionSucceedsAfterThreeReadyRead  )  [inline]
 

Handshaking should finish after the third readyRead().

Definition at line 168 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::testEstablishSessionSucceedsAfterTwoReadyRead  )  [inline]
 

Handshaking should finish after the second readyRead().

Definition at line 162 of file SessionTest.cpp.

void Protocols::BitTorrent::Transfers::Testing::SessionTest::testEstablishSessionSucceedsDirectly  )  [inline]
 

Handshaking completes right after the transport is connected.

Definition at line 103 of file SessionTest.cpp.


Member Data Documentation

FileId Protocols::BitTorrent::Transfers::Testing::SessionTest::fileId [private]
 

Definition at line 61 of file SessionTest.cpp.

PeerInfo Protocols::BitTorrent::Transfers::Testing::SessionTest::myPeerInfo [private]
 

Definition at line 59 of file SessionTest.cpp.

PeerInfo Protocols::BitTorrent::Transfers::Testing::SessionTest::remotePeerInfo [private]
 

Definition at line 60 of file SessionTest.cpp.

auto_ptr<SessionDriver> Protocols::BitTorrent::Transfers::Testing::SessionTest::session [private]
 

Definition at line 65 of file SessionTest.cpp.

auto_ptr<Session> Protocols::BitTorrent::Transfers::Testing::SessionTest::session_real [private]
 

Definition at line 64 of file SessionTest.cpp.

auto_ptr<SessionStatusMock> Protocols::BitTorrent::Transfers::Testing::SessionTest::status [private]
 

Definition at line 63 of file SessionTest.cpp.

auto_ptr<TransportMock> Protocols::BitTorrent::Transfers::Testing::SessionTest::transport [private]
 

Definition at line 62 of file SessionTest.cpp.


The documentation for this class was generated from the following file: