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

Unified Diff: net/socket/client_socket_pool_base_unittest.cc

Issue 1604042: Improve error messages for bad SocketParams. (Closed)
Patch Set: Address davidben's comments and add to gyp file. Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/client_socket_pool.h ('k') | net/socket/socks_client_socket_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/client_socket_pool_base_unittest.cc
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index 8c0e6ea379a8179fe54d319fdecf390e252cb5ec..f195d2d7b2dd37cad7ddc2a369fa6a4fdea0fce8 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -30,7 +30,7 @@ const int kDefaultMaxSockets = 4;
const int kDefaultMaxSocketsPerGroup = 2;
const net::RequestPriority kDefaultPriority = MEDIUM;
-typedef const void* TestSocketParams;
+struct TestSocketParams {};
typedef ClientSocketPoolBase<TestSocketParams> TestClientSocketPoolBase;
class MockClientSocket : public ClientSocket {
@@ -299,8 +299,10 @@ class TestClientSocketPool : public ClientSocketPool {
ClientSocketHandle* handle,
CompletionCallback* callback,
const BoundNetLog& net_log) {
+ const TestSocketParams* casted_socket_params =
+ static_cast<const TestSocketParams*>(params);
return base_.RequestSocket(
- group_name, params, priority, handle, callback, net_log);
+ group_name, *casted_socket_params, priority, handle, callback, net_log);
}
virtual void CancelRequest(
@@ -438,8 +440,9 @@ class ClientSocketPoolBaseTest : public ClientSocketPoolTest {
int StartRequest(const std::string& group_name,
net::RequestPriority priority) {
+ TestSocketParams params;
return StartRequestUsingPool<TestClientSocketPool, TestSocketParams>(
- pool_, group_name, priority, NULL);
+ pool_, group_name, priority, params);
}
virtual void TearDown() {
@@ -474,8 +477,9 @@ int InitHandle(ClientSocketHandle* handle,
CompletionCallback* callback,
const scoped_refptr<TestClientSocketPool>& pool,
const BoundNetLog& net_log) {
+ TestSocketParams params;
return handle->Init<TestSocketParams, TestClientSocketPool>(
- group_name, NULL, priority, callback, pool, net_log);
+ group_name, params, priority, callback, pool, net_log);
}
// Even though a timeout is specified, it doesn't time out on a synchronous
@@ -483,8 +487,9 @@ int InitHandle(ClientSocketHandle* handle,
TEST_F(ClientSocketPoolBaseTest, ConnectJob_NoTimeoutOnSynchronousCompletion) {
TestConnectJobDelegate delegate;
ClientSocketHandle ignored;
+ TestSocketParams params;
TestClientSocketPoolBase::Request request(
- &ignored, NULL, kDefaultPriority, NULL, BoundNetLog());
+ &ignored, NULL, kDefaultPriority, params, BoundNetLog());
scoped_ptr<TestConnectJob> job(
new TestConnectJob(TestConnectJob::kMockJob,
"a",
@@ -501,8 +506,9 @@ TEST_F(ClientSocketPoolBaseTest, ConnectJob_TimedOut) {
ClientSocketHandle ignored;
CapturingNetLog log(CapturingNetLog::kUnbounded);
+ TestSocketParams params;
TestClientSocketPoolBase::Request request(
- &ignored, NULL, kDefaultPriority, NULL, BoundNetLog());
+ &ignored, NULL, kDefaultPriority, params, BoundNetLog());
// Deleted by TestConnectJobDelegate.
TestConnectJob* job =
new TestConnectJob(TestConnectJob::kMockPendingJob,
« no previous file with comments | « net/socket/client_socket_pool.h ('k') | net/socket/socks_client_socket_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698