diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-09-06 14:29:36 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-09-06 14:29:36 +0000 |
| commit | efbfe4c006cfb6e0bf3ee4ed57d0657c0cd85c19 (patch) | |
| tree | a72723a125c34220772259f051673ff88598bded /test/MockSegment.h | |
| parent | 552c753dbba55005964ad60698d803a44dac6391 (diff) | |
2010-09-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Data from remote server in HTTP/FTP download are now written to
the disk(or memory) through StreamFilter. Decoding chunked and
gziped streams are done cascading StreamFilter.
Removed inefficient 1byte read code.
* src/ChunkedDecodingStreamFilter.cc
* src/ChunkedDecodingStreamFilter.h
* src/DownloadCommand.cc
* src/DownloadCommand.h
* src/GZipDecodingStreamFilter.cc
* src/GZipDecodingStreamFilter.h
* src/HttpConnection.cc
* src/HttpDownloadCommand.cc
* src/HttpResponse.cc
* src/HttpResponse.h
* src/HttpResponseCommand.cc
* src/HttpResponseCommand.h
* src/HttpSkipResponseCommand.cc
* src/HttpSkipResponseCommand.h
* src/Makefile.am
* src/NullSinkStreamFilter.cc
* src/NullSinkStreamFilter.h
* src/RequestGroup.cc
* src/SinkStreamFilter.cc
* src/SinkStreamFilter.h
* src/StreamFilter.cc
* src/StreamFilter.h
* test/ChunkedDecodingStreamFilterTest.cc
* test/GZipDecodingStreamFilterTest.cc
* test/HttpResponseTest.cc
* test/Makefile.am
* test/MockSegment.h
Diffstat (limited to 'test/MockSegment.h')
| -rw-r--r-- | test/MockSegment.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/test/MockSegment.h b/test/MockSegment.h new file mode 100644 index 00000000..5be67fc8 --- /dev/null +++ b/test/MockSegment.h @@ -0,0 +1,80 @@ +#ifndef D_MOCK_SEGMENT_H +#define D_MOCK_SEGMENT_H + +#include "Segment.h" +#include "Piece.h" +#include "A2STR.h" + +namespace aria2 { + +class MockSegment:public Segment { +public: + virtual bool complete() const + { + return false; + } + + virtual size_t getIndex() const + { + return 0; + } + + virtual off_t getPosition() const + { + return 0; + } + + virtual off_t getPositionToWrite() const + { + return 0; + } + + virtual size_t getLength() const + { + return 0; + } + + virtual size_t getSegmentLength() const + { + return 0; + } + + virtual size_t getWrittenLength() const + { + return 0; + } + + virtual void updateWrittenLength(size_t bytes) {} + +#ifdef ENABLE_MESSAGE_DIGEST + + // `begin' is a offset inside this segment. + virtual bool updateHash + (uint32_t begin, const unsigned char* data, size_t dataLength) + { + return false; + } + + virtual bool isHashCalculated() const + { + return false; + } + + virtual std::string getHashString() + { + return A2STR::NIL; + } + +#endif // ENABLE_MESSAGE_DIGEST + + virtual void clear() {} + + virtual SharedHandle<Piece> getPiece() const + { + return SharedHandle<Piece>(); + } +}; + +} // namespace aria2 + +#endif // D_MOCK_SEGMENT_H |
