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

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

Issue 196053: When converting between units of time or data types of different precision,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/client_socket_pool_base_unittest.cc ('k') | webkit/glue/webkitclient_impl.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/socket/socket_test_util.h" 5 #include "net/socket/socket_test_util.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "net/base/ssl_info.h" 10 #include "net/base/ssl_info.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // static 336 // static
337 const int ClientSocketPoolTest::kRequestNotFound = -2; 337 const int ClientSocketPoolTest::kRequestNotFound = -2;
338 338
339 void ClientSocketPoolTest::SetUp() { 339 void ClientSocketPoolTest::SetUp() {
340 completion_count_ = 0; 340 completion_count_ = 0;
341 } 341 }
342 342
343 void ClientSocketPoolTest::TearDown() { 343 void ClientSocketPoolTest::TearDown() {
344 // The tests often call Reset() on handles at the end which may post 344 // The tests often call Reset() on handles at the end which may post
345 // DoReleaseSocket() tasks. 345 // DoReleaseSocket() tasks.
346 // Pending tasks created by client_socket_pool_base_unittest.cc are
347 // posted two milliseconds into the future and thus won't become
348 // scheduled until that time.
349 // We wait a few milliseconds to make sure that all such future tasks
350 // are ready to run, before calling RunAllPending(). This will work
351 // correctly even if Sleep() finishes late (and it should never finish
352 // early), as all we have to ensure is that actual wall-time has progressed
353 // past the scheduled starting time of the pending task.
354 PlatformThread::Sleep(10);
346 MessageLoop::current()->RunAllPending(); 355 MessageLoop::current()->RunAllPending();
347 } 356 }
348 357
349 int ClientSocketPoolTest::GetOrderOfRequest(size_t index) { 358 int ClientSocketPoolTest::GetOrderOfRequest(size_t index) {
350 index--; 359 index--;
351 if (index < 0 || index >= requests_.size()) 360 if (index < 0 || index >= requests_.size())
352 return kIndexOutOfBounds; 361 return kIndexOutOfBounds;
353 362
354 for (size_t i = 0; i < request_order_.size(); i++) 363 for (size_t i = 0; i < request_order_.size(); i++)
355 if (requests_[index] == request_order_[i]) 364 if (requests_[index] == request_order_[i])
(...skipping 17 matching lines...) Expand all
373 } 382 }
374 383
375 void ClientSocketPoolTest::ReleaseAllConnections(KeepAlive keep_alive) { 384 void ClientSocketPoolTest::ReleaseAllConnections(KeepAlive keep_alive) {
376 bool released_one; 385 bool released_one;
377 do { 386 do {
378 released_one = ReleaseOneConnection(keep_alive); 387 released_one = ReleaseOneConnection(keep_alive);
379 } while (released_one); 388 } while (released_one);
380 } 389 }
381 390
382 } // namespace net 391 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_base_unittest.cc ('k') | webkit/glue/webkitclient_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698