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

Side by Side Diff: remoting/protocol/fake_session.h

Issue 6271004: Changed MessageReader so that it doesn't read from the socket if there are (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: proper handling of empty messages Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_PROTOCOL_FAKE_SESSION_H_ 5 #ifndef REMOTING_PROTOCOL_FAKE_SESSION_H_
6 #define REMOTING_PROTOCOL_FAKE_SESSION_H_ 6 #define REMOTING_PROTOCOL_FAKE_SESSION_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 11 matching lines...) Expand all
22 // Read() reads data from another buffer that can be set with AppendInputData(). 22 // Read() reads data from another buffer that can be set with AppendInputData().
23 // Pending reads are supported, so if there is a pending read AppendInputData() 23 // Pending reads are supported, so if there is a pending read AppendInputData()
24 // calls the read callback. 24 // calls the read callback.
25 class FakeSocket : public net::Socket { 25 class FakeSocket : public net::Socket {
26 public: 26 public:
27 FakeSocket(); 27 FakeSocket();
28 virtual ~FakeSocket(); 28 virtual ~FakeSocket();
29 29
30 const std::string& written_data() { return written_data_; } 30 const std::string& written_data() { return written_data_; }
31 31
32 void AppendInputData(char* data, int data_size); 32 void AppendInputData(const char* data, int data_size);
33 int input_pos() { return input_pos_; } 33 int input_pos() { return input_pos_; }
awong 2011/01/20 20:06:38 const functions here and below?
Sergey Ulanov 2011/01/20 21:55:57 Done.
34 bool read_pending() { return read_pending_; }
34 35
35 // net::Socket interface. 36 // net::Socket interface.
36 virtual int Read(net::IOBuffer* buf, int buf_len, 37 virtual int Read(net::IOBuffer* buf, int buf_len,
37 net::CompletionCallback* callback); 38 net::CompletionCallback* callback);
38 virtual int Write(net::IOBuffer* buf, int buf_len, 39 virtual int Write(net::IOBuffer* buf, int buf_len,
39 net::CompletionCallback* callback); 40 net::CompletionCallback* callback);
40 41
41 virtual bool SetReceiveBufferSize(int32 size); 42 virtual bool SetReceiveBufferSize(int32 size);
42 virtual bool SetSendBufferSize(int32 size); 43 virtual bool SetSendBufferSize(int32 size);
43 44
(...skipping 13 matching lines...) Expand all
57 // one packet that will be returned by Read(). 58 // one packet that will be returned by Read().
58 class FakeUdpSocket : public net::Socket { 59 class FakeUdpSocket : public net::Socket {
59 public: 60 public:
60 FakeUdpSocket(); 61 FakeUdpSocket();
61 virtual ~FakeUdpSocket(); 62 virtual ~FakeUdpSocket();
62 63
63 const std::vector<std::string>& written_packets() { 64 const std::vector<std::string>& written_packets() {
64 return written_packets_; 65 return written_packets_;
65 } 66 }
66 67
67 void AppendInputPacket(char* data, int data_size); 68 void AppendInputPacket(const char* data, int data_size);
68 int input_pos() { return input_pos_; } 69 int input_pos() { return input_pos_; }
69 70
70 // net::Socket interface. 71 // net::Socket interface.
71 virtual int Read(net::IOBuffer* buf, int buf_len, 72 virtual int Read(net::IOBuffer* buf, int buf_len,
72 net::CompletionCallback* callback); 73 net::CompletionCallback* callback);
73 virtual int Write(net::IOBuffer* buf, int buf_len, 74 virtual int Write(net::IOBuffer* buf, int buf_len,
74 net::CompletionCallback* callback); 75 net::CompletionCallback* callback);
75 76
76 virtual bool SetReceiveBufferSize(int32 size); 77 virtual bool SetReceiveBufferSize(int32 size);
77 virtual bool SetSendBufferSize(int32 size); 78 virtual bool SetSendBufferSize(int32 size);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 std::string receiver_token_; 141 std::string receiver_token_;
141 142
142 std::string jid_; 143 std::string jid_;
143 bool closed_; 144 bool closed_;
144 }; 145 };
145 146
146 } // namespace protocol 147 } // namespace protocol
147 } // namespace remoting 148 } // namespace remoting
148 149
149 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ 150 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698