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

Side by Side Diff: net/socket/sequenced_socket_data_unittest.cc

Issue 1580903002: Convert ignore_limits from a SocketParam to a socket request argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: RespectLimits Created 4 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 | « net/socket/client_socket_pool_manager.cc ('k') | net/socket/socket_test_util.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <string> 5 #include <string>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 SequencedSocketDataTest::SequencedSocketDataTest() 228 SequencedSocketDataTest::SequencedSocketDataTest()
229 : failing_callback_( 229 : failing_callback_(
230 base::Bind(&SequencedSocketDataTest::FailingCompletionCallback, 230 base::Bind(&SequencedSocketDataTest::FailingCompletionCallback,
231 base::Unretained(this))), 231 base::Unretained(this))),
232 sock_(nullptr), 232 sock_(nullptr),
233 connect_data_(SYNCHRONOUS, OK), 233 connect_data_(SYNCHRONOUS, OK),
234 endpoint_("www.google.com", 443), 234 endpoint_("www.google.com", 443),
235 tcp_params_(new TransportSocketParams( 235 tcp_params_(new TransportSocketParams(
236 endpoint_, 236 endpoint_,
237 false, 237 false,
238 false,
239 OnHostResolutionCallback(), 238 OnHostResolutionCallback(),
240 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT)), 239 TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT)),
241 socket_pool_(10, 10, &socket_factory_), 240 socket_pool_(10, 10, &socket_factory_),
242 expect_eof_(true) { 241 expect_eof_(true) {
243 } 242 }
244 243
245 SequencedSocketDataTest::~SequencedSocketDataTest() { 244 SequencedSocketDataTest::~SequencedSocketDataTest() {
246 // Make sure no unexpected pending tasks will cause a failure. 245 // Make sure no unexpected pending tasks will cause a failure.
247 base::RunLoop().RunUntilIdle(); 246 base::RunLoop().RunUntilIdle();
248 if (expect_eof_) { 247 if (expect_eof_) {
249 EXPECT_EQ(expect_eof_, data_->AllReadDataConsumed()); 248 EXPECT_EQ(expect_eof_, data_->AllReadDataConsumed());
250 EXPECT_EQ(expect_eof_, data_->AllWriteDataConsumed()); 249 EXPECT_EQ(expect_eof_, data_->AllWriteDataConsumed());
251 } 250 }
252 } 251 }
253 252
254 void SequencedSocketDataTest::Initialize(MockRead* reads, 253 void SequencedSocketDataTest::Initialize(MockRead* reads,
255 size_t reads_count, 254 size_t reads_count,
256 MockWrite* writes, 255 MockWrite* writes,
257 size_t writes_count) { 256 size_t writes_count) {
258 data_.reset( 257 data_.reset(
259 new SequencedSocketData(reads, reads_count, writes, writes_count)); 258 new SequencedSocketData(reads, reads_count, writes, writes_count));
260 data_->set_connect_data(connect_data_); 259 data_->set_connect_data(connect_data_);
261 socket_factory_.AddSocketDataProvider(data_.get()); 260 socket_factory_.AddSocketDataProvider(data_.get());
262 261
263 EXPECT_EQ(OK, 262 EXPECT_EQ(OK,
264 connection_.Init( 263 connection_.Init(
265 endpoint_.ToString(), tcp_params_, LOWEST, CompletionCallback(), 264 endpoint_.ToString(), tcp_params_, LOWEST,
265 ClientSocketPool::RespectLimits::ENABLED, CompletionCallback(),
266 reinterpret_cast<TransportClientSocketPool*>(&socket_pool_), 266 reinterpret_cast<TransportClientSocketPool*>(&socket_pool_),
267 BoundNetLog())); 267 BoundNetLog()));
268 sock_ = connection_.socket(); 268 sock_ = connection_.socket();
269 } 269 }
270 270
271 void SequencedSocketDataTest::AssertSyncReadEquals(const char* data, int len) { 271 void SequencedSocketDataTest::AssertSyncReadEquals(const char* data, int len) {
272 // Issue the read, which will complete immediately. 272 // Issue the read, which will complete immediately.
273 AssertReadReturns(len, len); 273 AssertReadReturns(len, len);
274 AssertReadBufferEquals(data, len); 274 AssertReadBufferEquals(data, len);
275 } 275 }
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 1241
1242 Resume(); 1242 Resume();
1243 ASSERT_FALSE(IsPaused()); 1243 ASSERT_FALSE(IsPaused());
1244 ASSERT_TRUE(write_callback_.have_result()); 1244 ASSERT_TRUE(write_callback_.have_result());
1245 ASSERT_EQ(kLen2, write_callback_.WaitForResult()); 1245 ASSERT_EQ(kLen2, write_callback_.WaitForResult());
1246 } 1246 }
1247 1247
1248 } // namespace 1248 } // namespace
1249 1249
1250 } // namespace net 1250 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_manager.cc ('k') | net/socket/socket_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698