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

Unified Diff: net/socket/tcp_client_socket_pool_unittest.cc

Issue 1696005: Add net log entries that summarize transmit and receive byte counts. (Closed)
Patch Set: More tests and address comments Created 10 years, 8 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/tcp_client_socket_pool.cc ('k') | net/socket/tcp_client_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_client_socket_pool_unittest.cc
diff --git a/net/socket/tcp_client_socket_pool_unittest.cc b/net/socket/tcp_client_socket_pool_unittest.cc
index e7c8a9fc4fcfc11bff271d30a801fa46a7fdd704..aed90528e11ee284c827018adb2ff6ddee3077a0 100644
--- a/net/socket/tcp_client_socket_pool_unittest.cc
+++ b/net/socket/tcp_client_socket_pool_unittest.cc
@@ -30,7 +30,7 @@ class MockClientSocket : public ClientSocket {
MockClientSocket() : connected_(false) {}
// ClientSocket methods:
- virtual int Connect(CompletionCallback* callback, const BoundNetLog& /* net_log */) {
+ virtual int Connect(CompletionCallback* callback) {
connected_ = true;
return OK;
}
@@ -46,6 +46,9 @@ class MockClientSocket : public ClientSocket {
virtual int GetPeerAddress(AddressList* address) const {
return ERR_UNEXPECTED;
}
+ virtual const BoundNetLog& NetLog() const {
+ return net_log_;
+ }
// Socket methods:
virtual int Read(IOBuffer* buf, int buf_len,
@@ -61,6 +64,7 @@ class MockClientSocket : public ClientSocket {
private:
bool connected_;
+ BoundNetLog net_log_;
};
class MockFailingClientSocket : public ClientSocket {
@@ -68,7 +72,7 @@ class MockFailingClientSocket : public ClientSocket {
MockFailingClientSocket() {}
// ClientSocket methods:
- virtual int Connect(CompletionCallback* callback, const BoundNetLog& /* net_log */) {
+ virtual int Connect(CompletionCallback* callback) {
return ERR_CONNECTION_FAILED;
}
@@ -83,6 +87,9 @@ class MockFailingClientSocket : public ClientSocket {
virtual int GetPeerAddress(AddressList* address) const {
return ERR_UNEXPECTED;
}
+ virtual const BoundNetLog& NetLog() const {
+ return net_log_;
+ }
// Socket methods:
virtual int Read(IOBuffer* buf, int buf_len,
@@ -96,6 +103,9 @@ class MockFailingClientSocket : public ClientSocket {
}
virtual bool SetReceiveBufferSize(int32 size) { return true; }
virtual bool SetSendBufferSize(int32 size) { return true; }
+
+ private:
+ BoundNetLog net_log_;
};
class MockPendingClientSocket : public ClientSocket {
@@ -112,7 +122,7 @@ class MockPendingClientSocket : public ClientSocket {
is_connected_(false) {}
// ClientSocket methods:
- virtual int Connect(CompletionCallback* callback, const BoundNetLog& /* net_log */) {
+ virtual int Connect(CompletionCallback* callback) {
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
method_factory_.NewRunnableMethod(
@@ -131,6 +141,9 @@ class MockPendingClientSocket : public ClientSocket {
virtual int GetPeerAddress(AddressList* address) const{
return ERR_UNEXPECTED;
}
+ virtual const BoundNetLog& NetLog() const {
+ return net_log_;
+ }
// Socket methods:
virtual int Read(IOBuffer* buf, int buf_len,
@@ -164,6 +177,7 @@ class MockPendingClientSocket : public ClientSocket {
bool should_stall_;
int delay_ms_;
bool is_connected_;
+ BoundNetLog net_log_;
};
class MockClientSocketFactory : public ClientSocketFactory {
@@ -183,7 +197,8 @@ class MockClientSocketFactory : public ClientSocketFactory {
: allocation_count_(0), client_socket_type_(MOCK_CLIENT_SOCKET),
client_socket_types_(NULL), client_socket_index_(0) {}
- virtual ClientSocket* CreateTCPClientSocket(const AddressList& addresses) {
+ virtual ClientSocket* CreateTCPClientSocket(const AddressList& addresses,
+ NetLog* /* net_log */) {
allocation_count_++;
ClientSocketType type = client_socket_type_;
« no previous file with comments | « net/socket/tcp_client_socket_pool.cc ('k') | net/socket/tcp_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698