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

Side by Side Diff: net/http/http_network_transaction_ssl_unittest.cc

Issue 2635533002: net: fix multiple use-after-scope issues in net_unittests. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/deferred_sequenced_task_runner.h" 9 #include "base/deferred_sequenced_task_runner.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 SSLSocketDataProvider ssl_data(ASYNC, OK); 194 SSLSocketDataProvider ssl_data(ASYNC, OK);
195 ssl_data.token_binding_negotiated = true; 195 ssl_data.token_binding_negotiated = true;
196 ssl_data.token_binding_key_param = TB_PARAM_ECDSAP256; 196 ssl_data.token_binding_key_param = TB_PARAM_ECDSAP256;
197 ssl_data.next_proto = kProtoHTTP2; 197 ssl_data.next_proto = kProtoHTTP2;
198 mock_socket_factory_.AddSSLSocketDataProvider(&ssl_data); 198 mock_socket_factory_.AddSSLSocketDataProvider(&ssl_data);
199 199
200 MockRead reads[] = {MockRead(ASYNC, OK, 0)}; 200 MockRead reads[] = {MockRead(ASYNC, OK, 0)};
201 StaticSocketDataProvider data(reads, arraysize(reads), nullptr, 0); 201 StaticSocketDataProvider data(reads, arraysize(reads), nullptr, 0);
202 mock_socket_factory_.AddSocketDataProvider(&data); 202 mock_socket_factory_.AddSocketDataProvider(&data);
203 203
204 HttpNetworkSession session(session_params_);
205 HttpNetworkTransaction trans(DEFAULT_PRIORITY, &session);
206
207 HttpRequestInfo request_info; 204 HttpRequestInfo request_info;
208 request_info.url = GURL("https://www.example.com/"); 205 request_info.url = GURL("https://www.example.com/");
209 request_info.method = "GET"; 206 request_info.method = "GET";
210 request_info.token_binding_referrer = "encrypted.example.com"; 207 request_info.token_binding_referrer = "encrypted.example.com";
211 208
209 HttpNetworkSession session(session_params_);
210 HttpNetworkTransaction trans(DEFAULT_PRIORITY, &session);
211
212 TestCompletionCallback callback; 212 TestCompletionCallback callback;
213 int rv = trans.Start(&request_info, callback.callback(), NetLogWithSource()); 213 int rv = trans.Start(&request_info, callback.callback(), NetLogWithSource());
214 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); 214 EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
215 215
216 base::RunLoop().RunUntilIdle(); 216 base::RunLoop().RunUntilIdle();
217 217
218 // When ChannelIdService calls back to HttpNetworkSession, 218 // When ChannelIdService calls back to HttpNetworkSession,
219 // SpdyHttpStream should not crash. 219 // SpdyHttpStream should not crash.
220 channel_id_runner->Start(); 220 channel_id_runner->Start();
221 221
222 rv = callback.WaitForResult(); 222 rv = callback.WaitForResult();
223 EXPECT_THAT(rv, IsError(ERR_CONNECTION_CLOSED)); 223 EXPECT_THAT(rv, IsError(ERR_CONNECTION_CLOSED));
224 } 224 }
225 #endif // !defined(OS_IOS) 225 #endif // !defined(OS_IOS)
226 226
227 } // namespace net 227 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698