OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "remoting/protocol/connection_tester.h" | 5 #include "remoting/protocol/connection_tester.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
11 #include "net/socket/stream_socket.h" | 11 #include "net/socket/stream_socket.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
15 namespace protocol { | 15 namespace protocol { |
16 | 16 |
17 StreamConnectionTester::StreamConnectionTester(net::StreamSocket* client_socket, | 17 StreamConnectionTester::StreamConnectionTester(net::StreamSocket* client_socket, |
18 net::StreamSocket* host_socket, | 18 net::StreamSocket* host_socket, |
19 int message_size, | 19 int message_size, |
20 int message_count) | 20 int message_count) |
21 : message_loop_(MessageLoop::current()), | 21 : message_loop_(MessageLoop::current()), |
22 host_socket_(host_socket), | 22 host_socket_(host_socket), |
23 client_socket_(client_socket), | 23 client_socket_(client_socket), |
24 message_size_(message_size), | 24 message_size_(message_size), |
25 message_count_(message_count), | |
26 test_data_size_(message_size * message_count), | 25 test_data_size_(message_size * message_count), |
27 done_(false), | 26 done_(false), |
28 write_errors_(0), | 27 write_errors_(0), |
29 read_errors_(0) { | 28 read_errors_(0) { |
30 } | 29 } |
31 | 30 |
32 StreamConnectionTester::~StreamConnectionTester() { | 31 StreamConnectionTester::~StreamConnectionTester() { |
33 } | 32 } |
34 | 33 |
35 void StreamConnectionTester::Start() { | 34 void StreamConnectionTester::Start() { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 if (memcmp(read_buffer_->data(), sent_packets_[packet_id]->data(), | 248 if (memcmp(read_buffer_->data(), sent_packets_[packet_id]->data(), |
250 message_size_) != 0) | 249 message_size_) != 0) |
251 bad_packets_received_++; | 250 bad_packets_received_++; |
252 } | 251 } |
253 } | 252 } |
254 } | 253 } |
255 } | 254 } |
256 | 255 |
257 } // namespace protocol | 256 } // namespace protocol |
258 } // namespace remoting | 257 } // namespace remoting |
OLD | NEW |