summaryrefslogtreecommitdiff
path: root/test/TestUtil.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-02-25 21:42:54 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-02-25 21:42:54 +0900
commita49397ed19f4dff0bddba555ddd715e3766c488b (patch)
treeaecfef8a76fc442548f0067eaa588ba6f070b9a3 /test/TestUtil.cc
parent2aeb7137d0b8d6d07c9250ec2dc9fbbbef26a599 (diff)
Fix infinite loop when size of downloadResults_ exceeds maxDownloadResult_
Diffstat (limited to 'test/TestUtil.cc')
-rw-r--r--test/TestUtil.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/TestUtil.cc b/test/TestUtil.cc
index e54e2aa0..0020f483 100644
--- a/test/TestUtil.cc
+++ b/test/TestUtil.cc
@@ -20,6 +20,7 @@
#include "DownloadContext.h"
#include "Option.h"
#include "FileEntry.h"
+#include "DownloadResult.h"
#ifdef ENABLE_MESSAGE_DIGEST
# include "message_digest_helper.h"
#endif // ENABLE_MESSAGE_DIGEST
@@ -144,4 +145,22 @@ SharedHandle<RequestGroup> createRequestGroup(int32_t pieceLength,
return group;
}
+SharedHandle<DownloadResult> createDownloadResult
+(error_code::Value result, const std::string& uri)
+{
+ std::vector<std::string> uris;
+ uris.push_back(uri);
+ SharedHandle<FileEntry> entry(new FileEntry("/tmp/path", 1, 0, uris));
+ std::vector<SharedHandle<FileEntry> > entries;
+ entries.push_back(entry);
+ SharedHandle<DownloadResult> dr(new DownloadResult());
+ dr->gid = GroupId::create();
+ dr->fileEntries = entries;
+ dr->result = result;
+ dr->belongsTo = 0;
+ dr->inMemoryDownload = false;
+ dr->option = SharedHandle<Option>(new Option());
+ return dr;
+}
+
} // namespace aria2