| 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 "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "jingle/glue/channel_socket_adapter.h" | 8 #include "jingle/glue/channel_socket_adapter.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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 const int kBufferSize = 4096; | 24 const int kBufferSize = 4096; |
| 25 const char kTestData[] = "data"; | 25 const char kTestData[] = "data"; |
| 26 const int kTestDataSize = 4; | 26 const int kTestDataSize = 4; |
| 27 const int kTestError = -32123; | 27 const int kTestError = -32123; |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 class MockTransportChannel : public cricket::TransportChannel { | 30 class MockTransportChannel : public cricket::TransportChannel { |
| 31 public: | 31 public: |
| 32 MockTransportChannel() | 32 MockTransportChannel() : cricket::TransportChannel(std::string(), 0) { |
| 33 : cricket::TransportChannel("", 0) { | |
| 34 set_writable(true); | 33 set_writable(true); |
| 35 set_readable(true); | 34 set_readable(true); |
| 36 } | 35 } |
| 37 | 36 |
| 38 MOCK_METHOD3(SendPacket, int(const char* data, size_t len, int flags)); | 37 MOCK_METHOD3(SendPacket, int(const char* data, size_t len, int flags)); |
| 39 MOCK_METHOD2(SetOption, int(talk_base::Socket::Option opt, int value)); | 38 MOCK_METHOD2(SetOption, int(talk_base::Socket::Option opt, int value)); |
| 40 MOCK_METHOD0(GetError, int()); | 39 MOCK_METHOD0(GetError, int()); |
| 41 MOCK_CONST_METHOD0(GetRole, cricket::TransportRole()); | 40 MOCK_CONST_METHOD0(GetRole, cricket::TransportRole()); |
| 42 }; | 41 }; |
| 43 | 42 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 .WillOnce(Return(SOCKET_ERROR)); | 111 .WillOnce(Return(SOCKET_ERROR)); |
| 113 | 112 |
| 114 EXPECT_CALL(channel_, GetError()) | 113 EXPECT_CALL(channel_, GetError()) |
| 115 .WillOnce(Return(EWOULDBLOCK)); | 114 .WillOnce(Return(EWOULDBLOCK)); |
| 116 | 115 |
| 117 int result = target_->Write(buffer, kTestDataSize, callback_); | 116 int result = target_->Write(buffer, kTestDataSize, callback_); |
| 118 ASSERT_EQ(net::OK, result); | 117 ASSERT_EQ(net::OK, result); |
| 119 } | 118 } |
| 120 | 119 |
| 121 } // namespace jingle_glue | 120 } // namespace jingle_glue |
| OLD | NEW |