OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/channel_socket_adapter.h" | 5 #include "remoting/protocol/channel_socket_adapter.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 const int kBufferSize = 4096; | 26 const int kBufferSize = 4096; |
27 const char kTestData[] = "data"; | 27 const char kTestData[] = "data"; |
28 const int kTestDataSize = 4; | 28 const int kTestDataSize = 4; |
29 const int kTestError = -32123; | 29 const int kTestError = -32123; |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 class MockTransportChannel : public cricket::TransportChannel { | 32 class MockTransportChannel : public cricket::TransportChannel { |
33 public: | 33 public: |
34 MockTransportChannel() : cricket::TransportChannel(std::string(), 0) { | 34 MockTransportChannel() : cricket::TransportChannel(std::string(), 0) { |
35 set_writable(true); | 35 set_writable(true); |
36 set_readable(true); | |
37 } | 36 } |
38 | 37 |
39 MOCK_METHOD4(SendPacket, int(const char* data, | 38 MOCK_METHOD4(SendPacket, int(const char* data, |
40 size_t len, | 39 size_t len, |
41 const rtc::PacketOptions& options, | 40 const rtc::PacketOptions& options, |
42 int flags)); | 41 int flags)); |
43 MOCK_METHOD2(SetOption, int(rtc::Socket::Option opt, int value)); | 42 MOCK_METHOD2(SetOption, int(rtc::Socket::Option opt, int value)); |
44 MOCK_METHOD0(GetError, int()); | 43 MOCK_METHOD0(GetError, int()); |
45 MOCK_CONST_METHOD0(GetIceRole, cricket::IceRole()); | 44 MOCK_CONST_METHOD0(GetIceRole, cricket::IceRole()); |
46 MOCK_METHOD1(GetStats, bool(cricket::ConnectionInfos* infos)); | 45 MOCK_METHOD1(GetStats, bool(cricket::ConnectionInfos* infos)); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 132 |
134 EXPECT_CALL(channel_, GetError()) | 133 EXPECT_CALL(channel_, GetError()) |
135 .WillOnce(Return(EWOULDBLOCK)); | 134 .WillOnce(Return(EWOULDBLOCK)); |
136 | 135 |
137 int result = target_->Send(buffer.get(), kTestDataSize, callback_); | 136 int result = target_->Send(buffer.get(), kTestDataSize, callback_); |
138 ASSERT_EQ(net::OK, result); | 137 ASSERT_EQ(net::OK, result); |
139 } | 138 } |
140 | 139 |
141 } // namespace protocol | 140 } // namespace protocol |
142 } // namespace remoting | 141 } // namespace remoting |
OLD | NEW |