mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 13:37:40 +03:00
2009-04-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten event dispatch in BtMessage. Removed BtEventListener, BtEvent. * src/AbstractBtEventListener.h: Removed. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/BtAbortOutstandingRequestEvent.h * src/BtCancelSendingPieceEvent.h * src/BtChokedEvent.h: Removed. * src/BtChokingEvent.h * src/BtEvent.h: Removed * src/BtEventListener.h: Removed. * src/BtMessage.h * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtRequestMessage.cc * src/BtRequestMessage.h * src/DefaultBtMessageDispatcher.cc * src/Makefile.am * src/a2functional.h * test/BtPieceMessageTest.cc * test/BtRequestMessageTest.cc * test/DefaultBtMessageDispatcherTest.cc * test/MockBtMessage.h
This commit is contained in:
parent
82b0d66505
commit
afdd61f9d1
23 changed files with 150 additions and 485 deletions
|
@ -236,47 +236,34 @@ void BtRequestMessageTest::testDoReceivedAction_doesntHavePieceAndFastExtensionD
|
|||
|
||||
void BtRequestMessageTest::testHandleAbortRequestEvent() {
|
||||
SharedHandle<Piece> piece(new Piece(1, 16*1024));
|
||||
SharedHandle<BtAbortOutstandingRequestEvent> event
|
||||
(new BtAbortOutstandingRequestEvent(piece));
|
||||
|
||||
CPPUNIT_ASSERT(!msg->isInvalidate());
|
||||
msg->handleEvent(event);
|
||||
|
||||
msg->onAbortOutstandingRequestEvent(BtAbortOutstandingRequestEvent(piece));
|
||||
CPPUNIT_ASSERT(msg->isInvalidate());
|
||||
}
|
||||
|
||||
void BtRequestMessageTest::testHandleAbortRequestEvent_indexNoMatch() {
|
||||
SharedHandle<Piece> piece(new Piece(2, 16*1024));
|
||||
SharedHandle<BtAbortOutstandingRequestEvent> event
|
||||
(new BtAbortOutstandingRequestEvent(piece));
|
||||
|
||||
CPPUNIT_ASSERT(!msg->isInvalidate());
|
||||
CPPUNIT_ASSERT(!msg->isSendingInProgress());
|
||||
msg->handleEvent(event);
|
||||
msg->onAbortOutstandingRequestEvent(BtAbortOutstandingRequestEvent(piece));
|
||||
CPPUNIT_ASSERT(!msg->isInvalidate());
|
||||
}
|
||||
|
||||
void BtRequestMessageTest::testHandleAbortRequestEvent_alreadyInvalidated() {
|
||||
SharedHandle<Piece> piece(new Piece(1, 16*1024));
|
||||
SharedHandle<BtAbortOutstandingRequestEvent> event
|
||||
(new BtAbortOutstandingRequestEvent(piece));
|
||||
msg->setInvalidate(true);
|
||||
|
||||
CPPUNIT_ASSERT(msg->isInvalidate());
|
||||
CPPUNIT_ASSERT(!msg->isSendingInProgress());
|
||||
msg->handleEvent(event);
|
||||
msg->onAbortOutstandingRequestEvent(BtAbortOutstandingRequestEvent(piece));
|
||||
CPPUNIT_ASSERT(msg->isInvalidate());
|
||||
}
|
||||
|
||||
void BtRequestMessageTest::testHandleAbortRequestEvent_sendingInProgress() {
|
||||
SharedHandle<Piece> piece(new Piece(1, 16*1024));
|
||||
SharedHandle<BtAbortOutstandingRequestEvent> event
|
||||
(new BtAbortOutstandingRequestEvent(piece));
|
||||
msg->setSendingInProgress(true);
|
||||
|
||||
CPPUNIT_ASSERT(!msg->isInvalidate());
|
||||
CPPUNIT_ASSERT(msg->isSendingInProgress());
|
||||
msg->handleEvent(event);
|
||||
msg->onAbortOutstandingRequestEvent(BtAbortOutstandingRequestEvent(piece));
|
||||
CPPUNIT_ASSERT(!msg->isInvalidate());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue