Index: net/socket/ssl_server_socket_unittest.cc |
diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc |
index 92d2efcb01244ba4c677bcc2d99d3a6790d50d20..3acac8fb156c0eac0d2492bc5c7a59f88cb74a36 100644 |
--- a/net/socket/ssl_server_socket_unittest.cc |
+++ b/net/socket/ssl_server_socket_unittest.cc |
@@ -58,8 +58,7 @@ class FakeDataChannel { |
: read_buf_len_(0), |
closed_(false), |
write_called_after_close_(false), |
- weak_factory_(this) { |
- } |
+ weak_factory_(this) {} |
int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback) { |
if (closed_) |
@@ -80,14 +79,16 @@ class FakeDataChannel { |
write_called_after_close_ = true; |
write_callback_ = callback; |
base::MessageLoop::current()->PostTask( |
- FROM_HERE, base::Bind(&FakeDataChannel::DoWriteCallback, |
- weak_factory_.GetWeakPtr())); |
+ FROM_HERE, |
+ base::Bind(&FakeDataChannel::DoWriteCallback, |
+ weak_factory_.GetWeakPtr())); |
return net::ERR_IO_PENDING; |
} |
data_.push(new net::DrainableIOBuffer(buf, buf_len)); |
base::MessageLoop::current()->PostTask( |
- FROM_HERE, base::Bind(&FakeDataChannel::DoReadCallback, |
- weak_factory_.GetWeakPtr())); |
+ FROM_HERE, |
+ base::Bind(&FakeDataChannel::DoReadCallback, |
+ weak_factory_.GetWeakPtr())); |
return buf_len; |
} |
@@ -95,9 +96,7 @@ class FakeDataChannel { |
// indicating EOF, and Write() fails with ERR_CONNECTION_RESET. Note that |
// after the FakeDataChannel is closed, the first Write() call completes |
// asynchronously, which is necessary to reproduce bug 127822. |
- void Close() { |
- closed_ = true; |
- } |
+ void Close() { closed_ = true; } |
private: |
void DoReadCallback() { |
@@ -157,34 +156,29 @@ class FakeSocket : public StreamSocket { |
public: |
FakeSocket(FakeDataChannel* incoming_channel, |
FakeDataChannel* outgoing_channel) |
- : incoming_(incoming_channel), |
- outgoing_(outgoing_channel) { |
- } |
+ : incoming_(incoming_channel), outgoing_(outgoing_channel) {} |
- virtual ~FakeSocket() { |
- } |
+ virtual ~FakeSocket() {} |
- virtual int Read(IOBuffer* buf, int buf_len, |
+ virtual int Read(IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback) OVERRIDE { |
// Read random number of bytes. |
buf_len = rand() % buf_len + 1; |
return incoming_->Read(buf, buf_len, callback); |
} |
- virtual int Write(IOBuffer* buf, int buf_len, |
+ virtual int Write(IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback) OVERRIDE { |
// Write random number of bytes. |
buf_len = rand() % buf_len + 1; |
return outgoing_->Write(buf, buf_len, callback); |
} |
- virtual int SetReceiveBufferSize(int32 size) OVERRIDE { |
- return net::OK; |
- } |
+ virtual int SetReceiveBufferSize(int32 size) OVERRIDE { return net::OK; } |
- virtual int SetSendBufferSize(int32 size) OVERRIDE { |
- return net::OK; |
- } |
+ virtual int SetSendBufferSize(int32 size) OVERRIDE { return net::OK; } |
virtual int Connect(const CompletionCallback& callback) OVERRIDE { |
return net::OK; |
@@ -195,16 +189,12 @@ class FakeSocket : public StreamSocket { |
outgoing_->Close(); |
} |
- virtual bool IsConnected() const OVERRIDE { |
- return true; |
- } |
+ virtual bool IsConnected() const OVERRIDE { return true; } |
- virtual bool IsConnectedAndIdle() const OVERRIDE { |
- return true; |
- } |
+ virtual bool IsConnectedAndIdle() const OVERRIDE { return true; } |
virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE { |
- net::IPAddressNumber ip_address(net::kIPv4AddressSize); |
+ net::IPAddressNumber ip_address(net::kIPv4AddressSize); |
*address = net::IPEndPoint(ip_address, 0 /*port*/); |
return net::OK; |
} |
@@ -215,33 +205,22 @@ class FakeSocket : public StreamSocket { |
return net::OK; |
} |
- virtual const BoundNetLog& NetLog() const OVERRIDE { |
- return net_log_; |
- } |
+ virtual const BoundNetLog& NetLog() const OVERRIDE { return net_log_; } |
virtual void SetSubresourceSpeculation() OVERRIDE {} |
virtual void SetOmniboxSpeculation() OVERRIDE {} |
- virtual bool WasEverUsed() const OVERRIDE { |
- return true; |
- } |
- |
- virtual bool UsingTCPFastOpen() const OVERRIDE { |
- return false; |
- } |
+ virtual bool WasEverUsed() const OVERRIDE { return true; } |
+ virtual bool UsingTCPFastOpen() const OVERRIDE { return false; } |
- virtual bool WasNpnNegotiated() const OVERRIDE { |
- return false; |
- } |
+ virtual bool WasNpnNegotiated() const OVERRIDE { return false; } |
virtual NextProto GetNegotiatedProtocol() const OVERRIDE { |
return kProtoUnknown; |
} |
- virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { |
- return false; |
- } |
+ virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { return false; } |
private: |
net::BoundNetLog net_log_; |
@@ -344,12 +323,10 @@ class SSLServerSocketTest : public PlatformTest { |
net::SSLClientSocketContext context; |
context.cert_verifier = cert_verifier_.get(); |
context.transport_security_state = transport_security_state_.get(); |
- client_socket_ = |
- socket_factory_->CreateSSLClientSocket( |
- client_connection.Pass(), host_and_pair, ssl_config, context); |
+ client_socket_ = socket_factory_->CreateSSLClientSocket( |
+ client_connection.Pass(), host_and_pair, ssl_config, context); |
server_socket_ = net::CreateSSLServerSocket( |
- server_socket.Pass(), |
- cert.get(), private_key.get(), net::SSLConfig()); |
+ server_socket.Pass(), cert.get(), private_key.get(), net::SSLConfig()); |
} |
FakeDataChannel channel_1_; |
@@ -421,8 +398,7 @@ TEST_F(SSLServerSocketTest, DataTransfer) { |
scoped_refptr<net::StringIOBuffer> write_buf = |
new net::StringIOBuffer("testing123"); |
scoped_refptr<net::DrainableIOBuffer> read_buf = |
- new net::DrainableIOBuffer(new net::IOBuffer(kReadBufSize), |
- kReadBufSize); |
+ new net::DrainableIOBuffer(new net::IOBuffer(kReadBufSize), kReadBufSize); |
// Write then read. |
TestCompletionCallback write_callback; |
@@ -529,7 +505,8 @@ TEST_F(SSLServerSocketTest, ClientWriteAfterServerClose) { |
EXPECT_GT(client_ret, 0); |
base::MessageLoop::current()->PostDelayedTask( |
- FROM_HERE, base::MessageLoop::QuitClosure(), |
+ FROM_HERE, |
+ base::MessageLoop::QuitClosure(), |
base::TimeDelta::FromMilliseconds(10)); |
base::MessageLoop::current()->Run(); |
} |
@@ -560,23 +537,20 @@ TEST_F(SSLServerSocketTest, ExportKeyingMaterial) { |
const char* kKeyingLabel = "EXPERIMENTAL-server-socket-test"; |
const char* kKeyingContext = ""; |
unsigned char server_out[kKeyingMaterialSize]; |
- int rv = server_socket_->ExportKeyingMaterial(kKeyingLabel, |
- false, kKeyingContext, |
- server_out, sizeof(server_out)); |
+ int rv = server_socket_->ExportKeyingMaterial( |
+ kKeyingLabel, false, kKeyingContext, server_out, sizeof(server_out)); |
ASSERT_EQ(net::OK, rv); |
unsigned char client_out[kKeyingMaterialSize]; |
- rv = client_socket_->ExportKeyingMaterial(kKeyingLabel, |
- false, kKeyingContext, |
- client_out, sizeof(client_out)); |
+ rv = client_socket_->ExportKeyingMaterial( |
+ kKeyingLabel, false, kKeyingContext, client_out, sizeof(client_out)); |
ASSERT_EQ(net::OK, rv); |
EXPECT_EQ(0, memcmp(server_out, client_out, sizeof(server_out))); |
const char* kKeyingLabelBad = "EXPERIMENTAL-server-socket-test-bad"; |
unsigned char client_bad[kKeyingMaterialSize]; |
- rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad, |
- false, kKeyingContext, |
- client_bad, sizeof(client_bad)); |
+ rv = client_socket_->ExportKeyingMaterial( |
+ kKeyingLabelBad, false, kKeyingContext, client_bad, sizeof(client_bad)); |
ASSERT_EQ(rv, net::OK); |
EXPECT_NE(0, memcmp(server_out, client_bad, sizeof(server_out))); |
} |