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

Side by Side Diff: net/socket/socket_test_util.h

Issue 6085013: Start reordering the methods in headers in net/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 NET_SOCKET_SOCKET_TEST_UTIL_H_ 5 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_
6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_ 6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <cstring> 9 #include <cstring>
10 #include <deque> 10 #include <deque>
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 // SocketDataProvider which responds based on static tables of mock reads and 162 // SocketDataProvider which responds based on static tables of mock reads and
163 // writes. 163 // writes.
164 class StaticSocketDataProvider : public SocketDataProvider { 164 class StaticSocketDataProvider : public SocketDataProvider {
165 public: 165 public:
166 StaticSocketDataProvider(); 166 StaticSocketDataProvider();
167 StaticSocketDataProvider(MockRead* reads, size_t reads_count, 167 StaticSocketDataProvider(MockRead* reads, size_t reads_count,
168 MockWrite* writes, size_t writes_count); 168 MockWrite* writes, size_t writes_count);
169 virtual ~StaticSocketDataProvider(); 169 virtual ~StaticSocketDataProvider();
170 170
171 // SocketDataProvider methods:
172 virtual MockRead GetNextRead();
173 virtual MockWriteResult OnWrite(const std::string& data);
174 virtual void Reset();
175 virtual void CompleteRead() {}
176
177 // These functions get access to the next available read and write data. 171 // These functions get access to the next available read and write data.
178 const MockRead& PeekRead() const; 172 const MockRead& PeekRead() const;
179 const MockWrite& PeekWrite() const; 173 const MockWrite& PeekWrite() const;
180 // These functions get random access to the read and write data, for timing. 174 // These functions get random access to the read and write data, for timing.
181 const MockRead& PeekRead(size_t index) const; 175 const MockRead& PeekRead(size_t index) const;
182 const MockWrite& PeekWrite(size_t index) const; 176 const MockWrite& PeekWrite(size_t index) const;
183 size_t read_index() const { return read_index_; } 177 size_t read_index() const { return read_index_; }
184 size_t write_index() const { return write_index_; } 178 size_t write_index() const { return write_index_; }
185 size_t read_count() const { return read_count_; } 179 size_t read_count() const { return read_count_; }
186 size_t write_count() const { return write_count_; } 180 size_t write_count() const { return write_count_; }
187 181
188 bool at_read_eof() const { return read_index_ >= read_count_; } 182 bool at_read_eof() const { return read_index_ >= read_count_; }
189 bool at_write_eof() const { return write_index_ >= write_count_; } 183 bool at_write_eof() const { return write_index_ >= write_count_; }
190 184
185 // SocketDataProvider methods:
186 virtual MockRead GetNextRead();
187 virtual MockWriteResult OnWrite(const std::string& data);
188 virtual void Reset();
189 virtual void CompleteRead() {}
190
191 private: 191 private:
192 MockRead* reads_; 192 MockRead* reads_;
193 size_t read_index_; 193 size_t read_index_;
194 size_t read_count_; 194 size_t read_count_;
195 MockWrite* writes_; 195 MockWrite* writes_;
196 size_t write_index_; 196 size_t write_index_;
197 size_t write_count_; 197 size_t write_count_;
198 198
199 DISALLOW_COPY_AND_ASSIGN(StaticSocketDataProvider); 199 DISALLOW_COPY_AND_ASSIGN(StaticSocketDataProvider);
200 }; 200 };
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 940
941 extern const char kSOCKS5OkRequest[]; 941 extern const char kSOCKS5OkRequest[];
942 extern const int kSOCKS5OkRequestLength; 942 extern const int kSOCKS5OkRequestLength;
943 943
944 extern const char kSOCKS5OkResponse[]; 944 extern const char kSOCKS5OkResponse[];
945 extern const int kSOCKS5OkResponseLength; 945 extern const int kSOCKS5OkResponseLength;
946 946
947 } // namespace net 947 } // namespace net
948 948
949 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ 949 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698