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

Unified Diff: net/socket/socket_test_util.cc

Issue 23684017: [GCM] Initial work to set up directory structure and introduce socket integration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 7 years, 3 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
« net/socket/socket_test_util.h ('K') | « net/socket/socket_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_test_util.cc
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc
index 78e9e7ce9c4e2384e6c0a6412524da7c24934d1b..ce598cb3a667c3b4c73b3a2d325e5d0304555234 100644
--- a/net/socket/socket_test_util.cc
+++ b/net/socket/socket_test_util.cc
@@ -870,6 +870,9 @@ int MockTCPClientSocket::Write(IOBuffer* buf, int buf_len,
return ERR_IO_PENDING;
}
+ if (write_result.result == net::ERR_IO_PENDING)
+ pending_callback_ = callback;
+
return write_result.result;
}
@@ -950,6 +953,11 @@ void MockTCPClientSocket::OnConnectComplete(const MockConnect& data) {
RunCallback(callback, data.result);
}
+void MockTCPClientSocket::OnWriteComplete(const MockWriteResult& result) {
+ CompletionCallback callback = pending_callback_;
+ RunCallback(callback, result.result);
+}
+
int MockTCPClientSocket::CompleteRead() {
DCHECK(pending_buf_);
DCHECK(pending_buf_len_ > 0);
@@ -957,7 +965,7 @@ int MockTCPClientSocket::CompleteRead() {
was_used_to_convey_data_ = true;
// Save the pending async IO data and reset our |pending_| state.
- IOBuffer* buf = pending_buf_;
+ scoped_refptr<IOBuffer> buf = pending_buf_;
int buf_len = pending_buf_len_;
CompletionCallback callback = pending_callback_;
pending_buf_ = NULL;
@@ -1186,6 +1194,11 @@ void DeterministicMockUDPClientSocket::OnConnectComplete(
NOTIMPLEMENTED();
}
+void DeterministicMockUDPClientSocket::OnWriteComplete(
+ const MockWriteResult& result) {
+ NOTIMPLEMENTED();
+}
+
DeterministicMockTCPClientSocket::DeterministicMockTCPClientSocket(
net::NetLog* net_log,
DeterministicSocketData* data)
@@ -1278,6 +1291,9 @@ void DeterministicMockTCPClientSocket::OnReadComplete(const MockRead& data) {}
void DeterministicMockTCPClientSocket::OnConnectComplete(
const MockConnect& data) {}
+void DeterministicMockTCPClientSocket::OnWriteComplete(
+ const MockWriteResult& result) {}
+
// static
void MockSSLClientSocket::ConnectCallback(
MockSSLClientSocket* ssl_client_socket,
@@ -1428,6 +1444,10 @@ void MockSSLClientSocket::OnConnectComplete(const MockConnect& data) {
NOTIMPLEMENTED();
}
+void MockSSLClientSocket::OnWriteComplete(const MockWriteResult& result) {
+ NOTIMPLEMENTED();
+}
+
MockUDPClientSocket::MockUDPClientSocket(SocketDataProvider* data,
net::NetLog* net_log)
: connected_(false),
@@ -1551,12 +1571,16 @@ void MockUDPClientSocket::OnConnectComplete(const MockConnect& data) {
NOTIMPLEMENTED();
}
+void MockUDPClientSocket::OnWriteComplete(const MockWriteResult& result) {
+ NOTIMPLEMENTED();
+}
+
int MockUDPClientSocket::CompleteRead() {
DCHECK(pending_buf_);
DCHECK(pending_buf_len_ > 0);
// Save the pending async IO data and reset our |pending_| state.
- IOBuffer* buf = pending_buf_;
+ scoped_refptr<IOBuffer> buf = pending_buf_;
int buf_len = pending_buf_len_;
CompletionCallback callback = pending_callback_;
pending_buf_ = NULL;
« net/socket/socket_test_util.h ('K') | « net/socket/socket_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698