summaryrefslogtreecommitdiff
path: root/test/UTMetadataPostDownloadHandlerTest.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-22 01:10:38 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-22 01:10:38 +0900
commit07d270c87e6f9184aea4ca17eb26e466712e8db2 (patch)
tree2dfbaa2e0d2ad0f38cb73098608f7d67a64320f8 /test/UTMetadataPostDownloadHandlerTest.cc
parent126a4bde612eb0e6c48cf2f13ebe3eac45cc71a8 (diff)
Require -std=c++11 and use std::shared_ptr instead of SharedHandle
Diffstat (limited to 'test/UTMetadataPostDownloadHandlerTest.cc')
-rw-r--r--test/UTMetadataPostDownloadHandlerTest.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/UTMetadataPostDownloadHandlerTest.cc b/test/UTMetadataPostDownloadHandlerTest.cc
index 23966aa5..e98ce000 100644
--- a/test/UTMetadataPostDownloadHandlerTest.cc
+++ b/test/UTMetadataPostDownloadHandlerTest.cc
@@ -26,9 +26,9 @@ class UTMetadataPostDownloadHandlerTest:public CppUnit::TestFixture {
CPPUNIT_TEST(testGetNextRequestGroups);
CPPUNIT_TEST_SUITE_END();
private:
- SharedHandle<Option> option_;
- SharedHandle<DownloadContext> dctx_;
- SharedHandle<RequestGroup> requestGroup_;
+ std::shared_ptr<Option> option_;
+ std::shared_ptr<DownloadContext> dctx_;
+ std::shared_ptr<RequestGroup> requestGroup_;
public:
void setUp()
{
@@ -52,7 +52,7 @@ void UTMetadataPostDownloadHandlerTest::testCanHandle()
CPPUNIT_ASSERT(!handler.canHandle(requestGroup_.get()));
- SharedHandle<TorrentAttribute> attrs(new TorrentAttribute());
+ std::shared_ptr<TorrentAttribute> attrs(new TorrentAttribute());
dctx_->setAttribute(CTX_ATTR_BT, attrs);
CPPUNIT_ASSERT(handler.canHandle(requestGroup_.get()));
@@ -77,7 +77,7 @@ void UTMetadataPostDownloadHandlerTest::testGetNextRequestGroups()
(infoHash, sizeof(infoHash), MessageDigest::sha1(),
reinterpret_cast<const unsigned char*>(metadata.data()), metadata.size());
dctx_->getFirstFileEntry()->setLength(metadata.size());
- SharedHandle<TorrentAttribute> attrs(new TorrentAttribute());
+ std::shared_ptr<TorrentAttribute> attrs(new TorrentAttribute());
attrs->infoHash = std::string(&infoHash[0], &infoHash[20]);
std::vector<std::vector<std::string> > announceList;
std::vector<std::string> announceTier;
@@ -86,20 +86,20 @@ void UTMetadataPostDownloadHandlerTest::testGetNextRequestGroups()
attrs->announceList = announceList;
dctx_->setAttribute(CTX_ATTR_BT, attrs);
requestGroup_->setDiskWriterFactory
- (SharedHandle<DiskWriterFactory>(new ByteArrayDiskWriterFactory()));
+ (std::shared_ptr<DiskWriterFactory>(new ByteArrayDiskWriterFactory()));
requestGroup_->initPieceStorage();
requestGroup_->getPieceStorage()->getDiskAdaptor()->writeData
(reinterpret_cast<const unsigned char*>(metadata.data()), metadata.size(),
0);
UTMetadataPostDownloadHandler handler;
- std::vector<SharedHandle<RequestGroup> > results;
+ std::vector<std::shared_ptr<RequestGroup> > results;
handler.getNextRequestGroups(results, requestGroup_.get());
CPPUNIT_ASSERT_EQUAL((size_t)1, results.size());
- SharedHandle<RequestGroup> newRg = results.front();
- SharedHandle<DownloadContext> newDctx = newRg->getDownloadContext();
- SharedHandle<TorrentAttribute> newAttrs =
+ std::shared_ptr<RequestGroup> newRg = results.front();
+ std::shared_ptr<DownloadContext> newDctx = newRg->getDownloadContext();
+ std::shared_ptr<TorrentAttribute> newAttrs =
bittorrent::getTorrentAttrs(newDctx);
CPPUNIT_ASSERT_EQUAL(bittorrent::getInfoHashString(dctx_),
bittorrent::getInfoHashString(newDctx));