1 // Copyright 2019 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef TESTING_INVALID_SEEKABLE_READ_STREAM_H_ 6 #define TESTING_INVALID_SEEKABLE_READ_STREAM_H_ 7 8 #include "core/fxcrt/fx_stream.h" 9 10 // A stream used for testing where reads always fail. 11 class InvalidSeekableReadStream final : public IFX_SeekableReadStream { 12 public: 13 template <typename T, typename... Args> 14 friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); 15 16 // IFX_SeekableReadStream overrides: 17 bool ReadBlockAtOffset(void* buffer, 18 FX_FILESIZE offset, 19 size_t size) override; 20 FX_FILESIZE GetSize() override; 21 22 private: 23 explicit InvalidSeekableReadStream(FX_FILESIZE data_size); 24 ~InvalidSeekableReadStream() override; 25 26 const FX_FILESIZE data_size_; 27 }; 28 29 #endif // TESTING_INVALID_SEEKABLE_READ_STREAM_H_ 30