| 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 <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 10 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 11 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 12 #include "net/socket/socket.h" | 15 #include "net/socket/socket.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "third_party/webrtc/p2p/base/transportchannel.h" | 18 #include "third_party/webrtc/p2p/base/transportchannel.h" |
| 16 | 19 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 45 MOCK_METHOD1(GetStats, bool(cricket::ConnectionInfos* infos)); | 48 MOCK_METHOD1(GetStats, bool(cricket::ConnectionInfos* infos)); |
| 46 MOCK_CONST_METHOD0(IsDtlsActive, bool()); | 49 MOCK_CONST_METHOD0(IsDtlsActive, bool()); |
| 47 MOCK_CONST_METHOD1(GetSslRole, bool(rtc::SSLRole* role)); | 50 MOCK_CONST_METHOD1(GetSslRole, bool(rtc::SSLRole* role)); |
| 48 MOCK_METHOD1(SetSrtpCiphers, bool(const std::vector<std::string>& ciphers)); | 51 MOCK_METHOD1(SetSrtpCiphers, bool(const std::vector<std::string>& ciphers)); |
| 49 MOCK_METHOD1(GetSrtpCipher, bool(std::string* cipher)); | 52 MOCK_METHOD1(GetSrtpCipher, bool(std::string* cipher)); |
| 50 MOCK_METHOD1(GetSslCipher, bool(std::string* cipher)); | 53 MOCK_METHOD1(GetSslCipher, bool(std::string* cipher)); |
| 51 MOCK_CONST_METHOD0(GetLocalCertificate, | 54 MOCK_CONST_METHOD0(GetLocalCertificate, |
| 52 rtc::scoped_refptr<rtc::RTCCertificate>()); | 55 rtc::scoped_refptr<rtc::RTCCertificate>()); |
| 53 MOCK_CONST_METHOD1(GetRemoteSSLCertificate, | 56 MOCK_CONST_METHOD1(GetRemoteSSLCertificate, |
| 54 bool(rtc::SSLCertificate** cert)); | 57 bool(rtc::SSLCertificate** cert)); |
| 55 MOCK_METHOD6(ExportKeyingMaterial, bool(const std::string& label, | 58 MOCK_METHOD6(ExportKeyingMaterial, |
| 56 const uint8* context, | 59 bool(const std::string& label, |
| 57 size_t context_len, | 60 const uint8_t* context, |
| 58 bool use_context, | 61 size_t context_len, |
| 59 uint8* result, | 62 bool use_context, |
| 60 size_t result_len)); | 63 uint8_t* result, |
| 64 size_t result_len)); |
| 61 }; | 65 }; |
| 62 | 66 |
| 63 class TransportChannelSocketAdapterTest : public testing::Test { | 67 class TransportChannelSocketAdapterTest : public testing::Test { |
| 64 public: | 68 public: |
| 65 TransportChannelSocketAdapterTest() | 69 TransportChannelSocketAdapterTest() |
| 66 : callback_(base::Bind(&TransportChannelSocketAdapterTest::Callback, | 70 : callback_(base::Bind(&TransportChannelSocketAdapterTest::Callback, |
| 67 base::Unretained(this))), | 71 base::Unretained(this))), |
| 68 callback_result_(0) { | 72 callback_result_(0) { |
| 69 } | 73 } |
| 70 | 74 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 136 |
| 133 EXPECT_CALL(channel_, GetError()) | 137 EXPECT_CALL(channel_, GetError()) |
| 134 .WillOnce(Return(EWOULDBLOCK)); | 138 .WillOnce(Return(EWOULDBLOCK)); |
| 135 | 139 |
| 136 int result = target_->Send(buffer.get(), kTestDataSize, callback_); | 140 int result = target_->Send(buffer.get(), kTestDataSize, callback_); |
| 137 ASSERT_EQ(net::OK, result); | 141 ASSERT_EQ(net::OK, result); |
| 138 } | 142 } |
| 139 | 143 |
| 140 } // namespace protocol | 144 } // namespace protocol |
| 141 } // namespace remoting | 145 } // namespace remoting |
| OLD | NEW |