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

Side by Side Diff: net/spdy/spdy_http_stream_unittest.cc

Issue 2298823002: Resetting the HttpRequestInfo pointers in HttpNetworkTransaction and streams (Closed)
Patch Set: Rebased, removed upload progress plumbing, feedback. (Rebased till refs/heads/master@{#417381}) Created 4 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/spdy/spdy_http_stream.h" 5 #include "net/spdy/spdy_http_stream.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 const HostPortPair host_port_pair_; 161 const HostPortPair host_port_pair_;
162 const SpdySessionKey key_; 162 const SpdySessionKey key_;
163 std::unique_ptr<SequencedSocketData> sequenced_data_; 163 std::unique_ptr<SequencedSocketData> sequenced_data_;
164 std::unique_ptr<HttpNetworkSession> http_session_; 164 std::unique_ptr<HttpNetworkSession> http_session_;
165 base::WeakPtr<SpdySession> session_; 165 base::WeakPtr<SpdySession> session_;
166 166
167 private: 167 private:
168 MockECSignatureCreatorFactory ec_signature_creator_factory_; 168 MockECSignatureCreatorFactory ec_signature_creator_factory_;
169 }; 169 };
170 170
171 // SpdyHttpStream::GetUploadProgress() should still work even before the
172 // stream is initialized.
173 TEST_F(SpdyHttpStreamTest, GetUploadProgressBeforeInitialization) {
174 MockRead reads[] = {
175 MockRead(ASYNC, 0, 0) // EOF
176 };
177
178 InitSession(reads, arraysize(reads), nullptr, 0);
179
180 SpdyHttpStream stream(session_, false);
181 UploadProgress progress = stream.GetUploadProgress();
182 EXPECT_EQ(0u, progress.size());
183 EXPECT_EQ(0u, progress.position());
184
185 // Pump the event loop so |reads| is consumed before the function returns.
186 base::RunLoop().RunUntilIdle();
187 }
188
189 TEST_F(SpdyHttpStreamTest, SendRequest) { 171 TEST_F(SpdyHttpStreamTest, SendRequest) {
190 SpdySerializedFrame req( 172 SpdySerializedFrame req(
191 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true)); 173 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true));
192 MockWrite writes[] = { 174 MockWrite writes[] = {
193 CreateMockWrite(req, 0), 175 CreateMockWrite(req, 0),
194 }; 176 };
195 SpdySerializedFrame resp(spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1)); 177 SpdySerializedFrame resp(spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
196 MockRead reads[] = { 178 MockRead reads[] = {
197 CreateMockRead(resp, 1), MockRead(SYNCHRONOUS, 0, 2) // EOF 179 CreateMockRead(resp, 1), MockRead(SYNCHRONOUS, 0, 2) // EOF
198 }; 180 };
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 // The callback cancels |http_stream|. 1026 // The callback cancels |http_stream|.
1045 EXPECT_THAT(callback.WaitForResult(), IsOk()); 1027 EXPECT_THAT(callback.WaitForResult(), IsOk());
1046 1028
1047 EXPECT_FALSE(HasSpdySession(http_session_->spdy_session_pool(), key_)); 1029 EXPECT_FALSE(HasSpdySession(http_session_->spdy_session_pool(), key_));
1048 } 1030 }
1049 1031
1050 // TODO(willchan): Write a longer test for SpdyStream that exercises all 1032 // TODO(willchan): Write a longer test for SpdyStream that exercises all
1051 // methods. 1033 // methods.
1052 1034
1053 } // namespace net 1035 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698