| OLD | NEW |
| 1 // Copyright (c) 2012 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" |
| 6 |
| 5 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 6 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 8 #include "jingle/glue/channel_socket_adapter.h" | |
| 9 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| 10 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 11 #include "net/socket/socket.h" | 12 #include "net/socket/socket.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "third_party/webrtc/p2p/base/transportchannel.h" | 15 #include "third_party/webrtc/p2p/base/transportchannel.h" |
| 15 | 16 |
| 16 using net::IOBuffer; | 17 using net::IOBuffer; |
| 17 | 18 |
| 18 using testing::_; | 19 using testing::_; |
| 19 using testing::Return; | 20 using testing::Return; |
| 20 | 21 |
| 21 namespace jingle_glue { | 22 namespace remoting { |
| 23 namespace protocol { |
| 22 | 24 |
| 23 namespace { | 25 namespace { |
| 24 const int kBufferSize = 4096; | 26 const int kBufferSize = 4096; |
| 25 const char kTestData[] = "data"; | 27 const char kTestData[] = "data"; |
| 26 const int kTestDataSize = 4; | 28 const int kTestDataSize = 4; |
| 27 const int kTestError = -32123; | 29 const int kTestError = -32123; |
| 28 } // namespace | 30 } // namespace |
| 29 | 31 |
| 30 class MockTransportChannel : public cricket::TransportChannel { | 32 class MockTransportChannel : public cricket::TransportChannel { |
| 31 public: | 33 public: |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 .Times(1) | 130 .Times(1) |
| 129 .WillOnce(Return(SOCKET_ERROR)); | 131 .WillOnce(Return(SOCKET_ERROR)); |
| 130 | 132 |
| 131 EXPECT_CALL(channel_, GetError()) | 133 EXPECT_CALL(channel_, GetError()) |
| 132 .WillOnce(Return(EWOULDBLOCK)); | 134 .WillOnce(Return(EWOULDBLOCK)); |
| 133 | 135 |
| 134 int result = target_->Write(buffer.get(), kTestDataSize, callback_); | 136 int result = target_->Write(buffer.get(), kTestDataSize, callback_); |
| 135 ASSERT_EQ(net::OK, result); | 137 ASSERT_EQ(net::OK, result); |
| 136 } | 138 } |
| 137 | 139 |
| 138 } // namespace jingle_glue | 140 } // namespace protocol |
| 141 } // namespace remoting |
| OLD | NEW |