Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1050)

Unified Diff: net/filter/mock_source_stream.h

Issue 2604233002: Fix bug in deflate code. (Closed)
Patch Set: Cleanups Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/filter/mock_source_stream.h
diff --git a/net/filter/mock_source_stream.h b/net/filter/mock_source_stream.h
index 9c88bef7cb806a3e75147b16b1c5df257b2c0e01..4d854444c4233bf4b3cb620edfd0cc74170d7a33 100644
--- a/net/filter/mock_source_stream.h
+++ b/net/filter/mock_source_stream.h
@@ -46,6 +46,18 @@ class MockSourceStream : public SourceStream {
// pending read.
void CompleteNextRead();
+ // Affects behavior or AddReadResult. When set to true, each character in
+ // |data| passed to AddReadResult will be read as an individual byte, instead
+ // of all at once. Default to false.
+ // Note that setting it only affects future calls to AddReadResult, not
+ // previous ones.
+ void set_read_one_byte_at_a_time(bool read_one_byte_at_a_time) {
+ read_one_byte_at_a_time_ = read_one_byte_at_a_time;
+ }
+
+ // Returns true if a read is waiting to be completed.
+ bool awaiting_completion() const { return awaiting_completion_; }
+
private:
struct QueuedResult {
QueuedResult(const char* data, int len, Error error, Mode mode);
@@ -56,6 +68,7 @@ class MockSourceStream : public SourceStream {
const Mode mode;
};
+ bool read_one_byte_at_a_time_;
std::queue<QueuedResult> results_;
bool awaiting_completion_;
scoped_refptr<IOBuffer> dest_buffer_;

Powered by Google App Engine
This is Rietveld 408576698