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

Unified Diff: remoting/protocol/pseudotcp_adapter_unittest.cc

Issue 1197853003: Add P2PDatagramSocket and P2PStreamSocket interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « remoting/protocol/pseudotcp_adapter.cc ('k') | remoting/protocol/pseudotcp_channel_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/pseudotcp_adapter_unittest.cc
diff --git a/remoting/protocol/pseudotcp_adapter_unittest.cc b/remoting/protocol/pseudotcp_adapter_unittest.cc
index 3babfa9ee8bb11444705c18323fb04c11838cbdb..f6ea217c016d65e3ae0159da1dce3ef6893ee9d2 100644
--- a/remoting/protocol/pseudotcp_adapter_unittest.cc
+++ b/remoting/protocol/pseudotcp_adapter_unittest.cc
@@ -13,6 +13,8 @@
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
+#include "remoting/protocol/p2p_datagram_socket.h"
+#include "remoting/protocol/p2p_stream_socket.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -65,7 +67,7 @@ class LeakyBucket : public RateLimiter {
base::TimeTicks last_update_;
};
-class FakeSocket : public net::Socket {
+class FakeSocket : public P2PDatagramSocket {
public:
FakeSocket()
: rate_limiter_(NULL),
@@ -99,9 +101,8 @@ class FakeSocket : public net::Socket {
void set_latency(int latency_ms) { latency_ms_ = latency_ms; };
- // net::Socket interface.
- int Read(net::IOBuffer* buf,
- int buf_len,
+ // P2PDatagramSocket interface.
+ int Recv(const scoped_refptr<net::IOBuffer>& buf, int buf_len,
const net::CompletionCallback& callback) override {
CHECK(read_callback_.is_null());
CHECK(buf);
@@ -121,9 +122,8 @@ class FakeSocket : public net::Socket {
}
}
- int Write(net::IOBuffer* buf,
- int buf_len,
- const net::CompletionCallback& callback) override {
+ int Send(const scoped_refptr<net::IOBuffer>& buf, int buf_len,
+ const net::CompletionCallback& callback) override {
DCHECK(buf);
if (peer_socket_) {
base::MessageLoop::current()->PostDelayedTask(
@@ -137,15 +137,6 @@ class FakeSocket : public net::Socket {
return buf_len;
}
- int SetReceiveBufferSize(int32 size) override {
- NOTIMPLEMENTED();
- return net::ERR_NOT_IMPLEMENTED;
- }
- int SetSendBufferSize(int32 size) override {
- NOTIMPLEMENTED();
- return net::ERR_NOT_IMPLEMENTED;
- }
-
private:
scoped_refptr<net::IOBuffer> read_buffer_;
int read_buffer_size_;
@@ -161,8 +152,8 @@ class FakeSocket : public net::Socket {
class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> {
public:
TCPChannelTester(base::MessageLoop* message_loop,
- net::Socket* client_socket,
- net::Socket* host_socket)
+ P2PStreamSocket* client_socket,
+ P2PStreamSocket* host_socket)
: message_loop_(message_loop),
host_socket_(host_socket),
client_socket_(client_socket),
@@ -280,8 +271,8 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> {
friend class base::RefCountedThreadSafe<TCPChannelTester>;
base::MessageLoop* message_loop_;
- net::Socket* host_socket_;
- net::Socket* client_socket_;
+ P2PStreamSocket* host_socket_;
+ P2PStreamSocket* client_socket_;
bool done_;
scoped_refptr<net::DrainableIOBuffer> output_buffer_;
« no previous file with comments | « remoting/protocol/pseudotcp_adapter.cc ('k') | remoting/protocol/pseudotcp_channel_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698