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

Unified Diff: net/spdy/spdy_stream_test_util.cc

Issue 14311002: [SPDY] Avoid leaking bytes from the session flow control receive window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 months 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
« no previous file with comments | « net/spdy/spdy_stream_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_stream_test_util.cc
diff --git a/net/spdy/spdy_stream_test_util.cc b/net/spdy/spdy_stream_test_util.cc
index 0165c2046aa42c78568d5eb96164ffeb1886fe4e..4af3382228e2e389eff6f5eeb5239dd94be9de5a 100644
--- a/net/spdy/spdy_stream_test_util.cc
+++ b/net/spdy/spdy_stream_test_util.cc
@@ -4,6 +4,9 @@
#include "net/spdy/spdy_stream_test_util.h"
+#include <cstddef>
+
+#include "base/stl_util.h"
#include "net/base/completion_callback.h"
#include "net/spdy/spdy_stream.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -78,10 +81,8 @@ void StreamDelegateBase::OnHeadersSent() {
}
int StreamDelegateBase::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) {
- if (buffer) {
- received_data_ += std::string(buffer->GetRemainingData(),
- buffer->GetRemainingSize());
- }
+ if (buffer)
+ received_data_queue_.Enqueue(buffer.Pass());
return OK;
}
@@ -102,6 +103,17 @@ int StreamDelegateBase::WaitForClose() {
return result;
}
+std::string StreamDelegateBase::TakeReceivedData() {
+ size_t len = received_data_queue_.GetTotalSize();
+ std::string received_data(len, '\0');
+ if (len > 0) {
+ EXPECT_EQ(
+ len,
+ received_data_queue_.Dequeue(string_as_array(&received_data), len));
+ }
+ return received_data;
+}
+
std::string StreamDelegateBase::GetResponseHeaderValue(
const std::string& name) const {
SpdyHeaderBlock::const_iterator it = response_.find(name);
« no previous file with comments | « net/spdy/spdy_stream_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698