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

Unified Diff: content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc

Issue 8771030: base::Bind: Convert ServerSocket::Accept. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test logic fix. Created 9 years 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 | « content/browser/renderer_host/p2p/socket_host_tcp_server.cc ('k') | net/socket/server_socket.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc
diff --git a/content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc b/content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc
index ba625bc79b4bb2dce110842597c1f7df50ea4899..cf3e840c6b33683d8fe39f8ee0b6b7f856fb9752 100644
--- a/content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc
+++ b/content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc
@@ -6,6 +6,7 @@
#include "content/browser/renderer_host/p2p/socket_host_tcp.h"
#include "content/browser/renderer_host/p2p/socket_host_test_utils.h"
+#include "net/base/completion_callback.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -20,22 +21,25 @@ class FakeServerSocket : public net::ServerSocket {
public:
FakeServerSocket()
: listening_(false),
- accept_socket_(NULL),
- accept_callback_(NULL) {
+ accept_socket_(NULL) {
}
- ~FakeServerSocket() { }
+ virtual ~FakeServerSocket() {}
bool listening() { return listening_; }
void AddIncoming(net::StreamSocket* socket) {
- if (accept_callback_) {
+ if (!accept_callback_.is_null()) {
DCHECK(incoming_sockets_.empty());
accept_socket_->reset(socket);
accept_socket_ = NULL;
- net::OldCompletionCallback* cb = accept_callback_;
- accept_callback_ = NULL;
- cb->Run(net::OK);
+
+ // This copy is necessary because this implementation of ServerSocket
+ // bases logic on the null-ness of |accept_callback_| in the bound
+ // callback.
+ net::CompletionCallback cb = accept_callback_;
+ accept_callback_.Reset();
+ cb.Run(net::OK);
} else {
incoming_sockets_.push_back(socket);
}
@@ -54,7 +58,7 @@ class FakeServerSocket : public net::ServerSocket {
}
virtual int Accept(scoped_ptr<net::StreamSocket>* socket,
- net::OldCompletionCallback* callback) OVERRIDE {
+ const net::CompletionCallback& callback) OVERRIDE {
DCHECK(socket);
if (!incoming_sockets_.empty()) {
socket->reset(incoming_sockets_.front());
@@ -73,7 +77,7 @@ class FakeServerSocket : public net::ServerSocket {
net::IPEndPoint local_address_;
scoped_ptr<net::StreamSocket>* accept_socket_;
- net::OldCompletionCallback* accept_callback_;
+ net::CompletionCallback accept_callback_;
std::list<net::StreamSocket*> incoming_sockets_;
};
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp_server.cc ('k') | net/socket/server_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698