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

Side by Side Diff: net/tools/quic/quic_spdy_server_stream_test.cc

Issue 1037533002: Make initialization of the QuicInMemoryCache explicit to avoid spooky action at a distance which co… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/tools/quic/quic_spdy_server_stream.h" 5 #include "net/tools/quic/quic_spdy_server_stream.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "net/quic/quic_connection.h" 9 #include "net/quic/quic_connection.h"
10 #include "net/quic/quic_protocol.h" 10 #include "net/quic/quic_protocol.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 headers_string_ = SpdyUtils::SerializeRequestHeaders(request_headers); 85 headers_string_ = SpdyUtils::SerializeRequestHeaders(request_headers);
86 86
87 // New streams rely on having the peer's flow control receive window 87 // New streams rely on having the peer's flow control receive window
88 // negotiated in the config. 88 // negotiated in the config.
89 session_.config()->SetInitialStreamFlowControlWindowToSend( 89 session_.config()->SetInitialStreamFlowControlWindowToSend(
90 kInitialStreamFlowControlWindowForTest); 90 kInitialStreamFlowControlWindowForTest);
91 session_.config()->SetInitialSessionFlowControlWindowToSend( 91 session_.config()->SetInitialSessionFlowControlWindowToSend(
92 kInitialSessionFlowControlWindowForTest); 92 kInitialSessionFlowControlWindowForTest);
93 stream_.reset(new QuicSpdyServerStreamPeer(3, &session_)); 93 stream_.reset(new QuicSpdyServerStreamPeer(3, &session_));
94 }
95 94
96 static void SetUpTestCase() {
97 QuicInMemoryCachePeer::ResetForTests();
98 }
99
100 void SetUp() override {
101 QuicInMemoryCachePeer::ResetForTests(); 95 QuicInMemoryCachePeer::ResetForTests();
102 string host = ""; 96 string host = "";
103 string path = "/foo"; 97 string path = "/foo";
104 SpdyHeaderBlock response_headers; 98 SpdyHeaderBlock response_headers;
105 StringPiece body("Yum"); 99 StringPiece body("Yum");
106 QuicInMemoryCache::GetInstance()->AddResponse(host, path, response_headers, 100 QuicInMemoryCache::GetInstance()->AddResponse(host, path, response_headers,
107 body); 101 body);
108 } 102 }
109 103
104 ~QuicSpdyServerStreamTest() override {
105 QuicInMemoryCachePeer::ResetForTests();
106 }
107
110 const string& StreamBody() { 108 const string& StreamBody() {
111 return QuicSpdyServerStreamPeer::body(stream_.get()); 109 return QuicSpdyServerStreamPeer::body(stream_.get());
112 } 110 }
113 111
114 const BalsaHeaders& StreamHeaders() { 112 const BalsaHeaders& StreamHeaders() {
115 return QuicSpdyServerStreamPeer::headers(stream_.get()); 113 return QuicSpdyServerStreamPeer::headers(stream_.get());
116 } 114 }
117 115
118 BalsaHeaders response_headers_; 116 BalsaHeaders response_headers_;
119 EpollServer eps_; 117 EpollServer eps_;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 StringPiece data(arr, arraysize(arr)); 242 StringPiece data(arr, arraysize(arr));
245 QuicStreamFrame frame(stream_->id(), true, 0, MakeIOVector(data)); 243 QuicStreamFrame frame(stream_->id(), true, 0, MakeIOVector(data));
246 // Verify that we don't crash when we get a invalid headers in stream frame. 244 // Verify that we don't crash when we get a invalid headers in stream frame.
247 stream_->OnStreamFrame(frame); 245 stream_->OnStreamFrame(frame);
248 } 246 }
249 247
250 } // namespace 248 } // namespace
251 } // namespace test 249 } // namespace test
252 } // namespace tools 250 } // namespace tools
253 } // namespace net 251 } // namespace net
OLDNEW
« net/tools/quic/quic_in_memory_cache.cc ('K') | « net/tools/quic/quic_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698