#include "DefaultExtensionMessageFactory.h" #include #include #include "Peer.h" #include "MockPeerStorage.h" #include "bittorrent_helper.h" #include "HandshakeExtensionMessage.h" #include "UTPexExtensionMessage.h" #include "Exception.h" #include "FileEntry.h" #include "ExtensionMessageRegistry.h" #include "DownloadContext.h" #include "MockBtMessageDispatcher.h" #include "MockBtMessageFactory.h" #include "DownloadContext.h" #include "BtHandshakeMessage.h" #include "StringFormat.h" #include "UTMetadataRequestExtensionMessage.h" #include "UTMetadataDataExtensionMessage.h" #include "UTMetadataRejectExtensionMessage.h" #include "BtRuntime.h" #include "PieceStorage.h" #include "RequestGroup.h" #include "Option.h" namespace aria2 { class DefaultExtensionMessageFactoryTest:public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(DefaultExtensionMessageFactoryTest); CPPUNIT_TEST(testCreateMessage_unknown); CPPUNIT_TEST(testCreateMessage_Handshake); CPPUNIT_TEST(testCreateMessage_UTPex); CPPUNIT_TEST(testCreateMessage_UTMetadataRequest); CPPUNIT_TEST(testCreateMessage_UTMetadataData); CPPUNIT_TEST(testCreateMessage_UTMetadataReject); CPPUNIT_TEST_SUITE_END(); private: SharedHandle _peerStorage; SharedHandle _peer; SharedHandle _factory; SharedHandle _registry; SharedHandle _dispatcher; SharedHandle _messageFactory; SharedHandle _dctx; SharedHandle _requestGroup; public: void setUp() { _peerStorage.reset(new MockPeerStorage()); _peer.reset(new Peer("192.168.0.1", 6969)); _peer->allocateSessionResource(1024, 1024*1024); _peer->setExtension("ut_pex", 1); _registry.reset(new ExtensionMessageRegistry()); _dispatcher.reset(new MockBtMessageDispatcher()); _messageFactory.reset(new MockBtMessageFactory()); _dctx.reset(new DownloadContext()); SharedHandle