diff options
author | tbansal <tbansal@chromium.org> | 2015-10-14 13:05:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-14 20:06:22 +0000 |
commit | f82cc8ee24bbeb7b27c57874dfe787a5c10c47a1 (patch) | |
tree | 08092f6e17e98cd146c2e9b80078310d2d641233 /jingle | |
parent | 52714f745469ba255297d0144775535cbecdcb93 (diff) | |
download | chromium_src-f82cc8ee24bbeb7b27c57874dfe787a5c10c47a1.zip chromium_src-f82cc8ee24bbeb7b27c57874dfe787a5c10c47a1.tar.gz chromium_src-f82cc8ee24bbeb7b27c57874dfe787a5c10c47a1.tar.bz2 |
Implement GetTotalReceivedBytes() for StreamSocket
GetTotalReceivedBytes() returns the number of bytes
read from the network. Currently, only TCPClientSocket
implements GetTotalReceivedBytes().
Tests are in ssl_client_socket_unittest.cc.
Right now GetTotalReceivedBytes() is not plumbed to the
higher layers. Once that's done, this will help us in
precisely computing the network bytes used by a request.
BUG=537754
Review URL: https://codereview.chromium.org/1343563002
Cr-Commit-Position: refs/heads/master@{#354092}
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/glue/fake_ssl_client_socket.cc | 5 | ||||
-rw-r--r-- | jingle/glue/fake_ssl_client_socket.h | 3 | ||||
-rw-r--r-- | jingle/glue/fake_ssl_client_socket_unittest.cc | 1 | ||||
-rw-r--r-- | jingle/glue/proxy_resolving_client_socket.cc | 5 | ||||
-rw-r--r-- | jingle/glue/proxy_resolving_client_socket.h | 3 |
5 files changed, 17 insertions, 0 deletions
diff --git a/jingle/glue/fake_ssl_client_socket.cc b/jingle/glue/fake_ssl_client_socket.cc index 657bd76..58f1164 100644 --- a/jingle/glue/fake_ssl_client_socket.cc +++ b/jingle/glue/fake_ssl_client_socket.cc @@ -349,4 +349,9 @@ void FakeSSLClientSocket::GetConnectionAttempts( out->clear(); } +int64_t FakeSSLClientSocket::GetTotalReceivedBytes() const { + NOTIMPLEMENTED(); + return 0; +} + } // namespace jingle_glue diff --git a/jingle/glue/fake_ssl_client_socket.h b/jingle/glue/fake_ssl_client_socket.h index 8f90429..c6a41c2 100644 --- a/jingle/glue/fake_ssl_client_socket.h +++ b/jingle/glue/fake_ssl_client_socket.h @@ -16,6 +16,8 @@ #ifndef JINGLE_GLUE_FAKE_SSL_CLIENT_SOCKET_H_ #define JINGLE_GLUE_FAKE_SSL_CLIENT_SOCKET_H_ +#include <stdint.h> + #include <cstddef> #include "base/basictypes.h" @@ -71,6 +73,7 @@ class FakeSSLClientSocket : public net::StreamSocket { void ClearConnectionAttempts() override {} void AddConnectionAttempts(const net::ConnectionAttempts& attempts) override { } + int64_t GetTotalReceivedBytes() const override; private: enum HandshakeState { diff --git a/jingle/glue/fake_ssl_client_socket_unittest.cc b/jingle/glue/fake_ssl_client_socket_unittest.cc index 0f81127..4d7165d 100644 --- a/jingle/glue/fake_ssl_client_socket_unittest.cc +++ b/jingle/glue/fake_ssl_client_socket_unittest.cc @@ -71,6 +71,7 @@ class MockClientSocket : public net::StreamSocket { MOCK_CONST_METHOD1(GetConnectionAttempts, void(net::ConnectionAttempts*)); MOCK_METHOD0(ClearConnectionAttempts, void()); MOCK_METHOD1(AddConnectionAttempts, void(const net::ConnectionAttempts&)); + MOCK_CONST_METHOD0(GetTotalReceivedBytes, int64_t()); }; // Break up |data| into a bunch of chunked MockReads/Writes and push diff --git a/jingle/glue/proxy_resolving_client_socket.cc b/jingle/glue/proxy_resolving_client_socket.cc index e71f362..dc5608b 100644 --- a/jingle/glue/proxy_resolving_client_socket.cc +++ b/jingle/glue/proxy_resolving_client_socket.cc @@ -425,6 +425,11 @@ void ProxyResolvingClientSocket::GetConnectionAttempts( out->clear(); } +int64_t ProxyResolvingClientSocket::GetTotalReceivedBytes() const { + NOTIMPLEMENTED(); + return 0; +} + void ProxyResolvingClientSocket::CloseTransportSocket() { if (transport_.get() && transport_->socket()) transport_->socket()->Disconnect(); diff --git a/jingle/glue/proxy_resolving_client_socket.h b/jingle/glue/proxy_resolving_client_socket.h index 14c8e24..7d76778 100644 --- a/jingle/glue/proxy_resolving_client_socket.h +++ b/jingle/glue/proxy_resolving_client_socket.h @@ -8,6 +8,8 @@ #ifndef JINGLE_GLUE_PROXY_RESOLVING_CLIENT_SOCKET_H_ #define JINGLE_GLUE_PROXY_RESOLVING_CLIENT_SOCKET_H_ +#include <stdint.h> + #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" @@ -74,6 +76,7 @@ class ProxyResolvingClientSocket : public net::StreamSocket { void ClearConnectionAttempts() override {} void AddConnectionAttempts(const net::ConnectionAttempts& attempts) override { } + int64_t GetTotalReceivedBytes() const override; private: // Proxy resolution and connection functions. |