aria2/test/RequestGroupManTest.cc
Tatsuhiro Tsujikawa 6b7df851d3 2007-10-30 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added ftp://USER:PASSWD@Servername automatic parsing.
	* src/Request.{h, cc}: Removed AuthResolvers. Added _username 
and
	_password. Recognize username and password in URI.
	* src/main.cc: Use AuthConfigFactory instead of RequestFactory.
	* src/RequestGroup.cc: Use AuthConfigFactory instead of 
RequestFactory.
	* src/RequestFactory.{h, cc}: Removed.
	* src/AuthConfigFactory.{h, cc}: New class.
	* src/FtpConnection.cc: Use AuthConfigFactory.
	* src/HttpRequest.cc: Use AuthConfigFactory.
	* test/HttpRequestTest.cc: Updated.
	* test/RequestTest.cc: Updated.
	* test/AuthConfigFactoryTest.cc: New class.
	* test/RequestFactoryTest.cc: Removed.
2007-10-30 12:48:01 +00:00

67 lines
1.6 KiB
C++

#include "RequestGroupMan.h"
#include "CUIDCounter.h"
#include "prefs.h"
#include "SingleFileDownloadContext.h"
#include "RequestGroup.h"
#include "Option.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
}