mirror of
https://github.com/aria2/aria2.git
synced 2025-04-04 21:17:41 +03:00
Rewritten to add content-type support. * src/DownloadHandler.{h, cc} * src/BtPostDownloadHandler.{h, cc} * test/BtPostDownloadHandlerTest.cc * src/MetalinkPostDownloadHandler.{h, cc} * test/MetalinkPostDownloadHandlerTest.cc * src/PostDownloadHandler.{h, cc} * src/DownloadHandlerConstants.{h, cc} * src/RequestGroup.cc * src/HttpResponseCommand.cc * src/FtpNegotiationCommand.cc * src/SingleFileDownloadContext.{h, cc} * src/RequestGroup.h * src/RequestGroupCriteria.h * src/ContentTypeRequestGroupCriteria.h Added 'mem' option value for --follow-metalink, --follow-torrent. If it is give, metalink/torrent file is not written to the disk, but just is kept in memory. Parsing is occurred on memory. * src/MetalinkHelper.{h, cc} * src/MetalinkProcessor.h * src/Xml2MetalinkProcessor.{h, cc} * test/Xml2MetalinkProcessorTest.cc * src/DownloadHandlerFactory.{h, cc} * test/DownloadHandlerFactoryTest.cc * src/PreDownloadHandler.{h, cc} * src/OptionHandlerFactory.cc * src/DefaultBtContext.{h, cc} * test/DefaultBtContextTest.cc * src/version_usage.cc * src/Metalink2RequestGroup.{h, cc} * src/RequestGroup.{h, cc} * src/a2functional.h * test/a2functionalTest.cc * src/MemoryBufferPreDownloadHandler.{h, cc} * src/OptionHandlerImpl.h * src/prefs.h * src/Util.{h, cc} * test/UtilTest.cc Keep DownloadResult rather than RequestGroup after downloads to reduce memory usage. * src/RequestGroupMan.{h, cc} * src/DownloadEngine.cc * src/BtDependency.{h, cc}: Changed the type of dependee from WeakHandle to SharedHandle because WeakHandle could be null. * src/RequestGroup.{h, cc} * src/DownloadEngineFactory.cc * src/DownloadResult.h Set totalLength after download finished * src/UnknownLengthPieceStorage.{h, cc} Keep torrent file specified in metalink in memory. * src/Metalink2RequestGroup.cc * src/BtDependency.cc * src/TrueRequestGroupCriteria.h Fixed the bug: seekg is used where seekp should be used. * src/ByteArrayDiskWriter.cc * test/ByteArraydiskWriterTest.cc
68 lines
1.6 KiB
C++
68 lines
1.6 KiB
C++
#include "RequestGroupMan.h"
|
|
#include "CUIDCounter.h"
|
|
#include "prefs.h"
|
|
#include "SingleFileDownloadContext.h"
|
|
#include "RequestGroup.h"
|
|
#include "Option.h"
|
|
#include "DownloadResult.h"
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
using namespace std;
|
|
|
|
class RequestGroupManTest : public CppUnit::TestFixture {
|
|
|
|
CPPUNIT_TEST_SUITE(RequestGroupManTest);
|
|
CPPUNIT_TEST(testIsSameFileBeingDownloaded);
|
|
CPPUNIT_TEST(testGetInitialCommands);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
private:
|
|
|
|
public:
|
|
void setUp()
|
|
{
|
|
CUIDCounterHandle counter = new CUIDCounter();
|
|
CUIDCounterSingletonHolder::instance(counter);
|
|
}
|
|
|
|
void testIsSameFileBeingDownloaded();
|
|
void testGetInitialCommands();
|
|
};
|
|
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION( RequestGroupManTest );
|
|
|
|
void RequestGroupManTest::testIsSameFileBeingDownloaded()
|
|
{
|
|
Option option;
|
|
|
|
Strings uris;
|
|
uris.push_back("http://localhost/aria2.tar.bz2");
|
|
RequestGroupHandle rg1 = new RequestGroup(&option, uris);
|
|
RequestGroupHandle rg2 = new RequestGroup(&option, uris);
|
|
|
|
SingleFileDownloadContextHandle dctx1 =
|
|
new SingleFileDownloadContext(0, 0, "aria2.tar.bz2");
|
|
SingleFileDownloadContextHandle dctx2 =
|
|
new SingleFileDownloadContext(0, 0, "aria2.tar.bz2");
|
|
|
|
rg1->setDownloadContext(dctx1);
|
|
rg2->setDownloadContext(dctx2);
|
|
|
|
RequestGroups rgs;
|
|
rgs.push_back(rg1);
|
|
rgs.push_back(rg2);
|
|
|
|
RequestGroupMan gm(rgs, 1);
|
|
|
|
CPPUNIT_ASSERT(gm.isSameFileBeingDownloaded(rg1.get()));
|
|
|
|
dctx2->setFilename("aria2.tar.gz");
|
|
|
|
CPPUNIT_ASSERT(!gm.isSameFileBeingDownloaded(rg1.get()));
|
|
|
|
}
|
|
|
|
void RequestGroupManTest::testGetInitialCommands()
|
|
{
|
|
// TODO implement later
|
|
}
|