| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/cast_channel/cast_socket.h" | 5 #include "components/cast_channel/cast_socket.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 DISALLOW_COPY_AND_ASSIGN(CompleteHandler); | 170 DISALLOW_COPY_AND_ASSIGN(CompleteHandler); |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 class TestCastSocket : public CastSocketImpl { | 173 class TestCastSocket : public CastSocketImpl { |
| 174 public: | 174 public: |
| 175 static std::unique_ptr<TestCastSocket> CreateSecure( | 175 static std::unique_ptr<TestCastSocket> CreateSecure( |
| 176 Logger* logger, | 176 Logger* logger, |
| 177 uint64_t device_capabilities = cast_channel::CastDeviceCapability::NONE) { | 177 uint64_t device_capabilities = cast_channel::CastDeviceCapability::NONE) { |
| 178 return std::unique_ptr<TestCastSocket>(new TestCastSocket( | 178 return std::unique_ptr<TestCastSocket>( |
| 179 CreateIPEndPointForTest(), ChannelAuthType::SSL_VERIFIED, | 179 new TestCastSocket(CreateIPEndPointForTest(), kDistantTimeoutMillis, |
| 180 kDistantTimeoutMillis, logger, device_capabilities)); | 180 logger, device_capabilities)); |
| 181 } | 181 } |
| 182 | 182 |
| 183 TestCastSocket(const net::IPEndPoint& ip_endpoint, | 183 TestCastSocket(const net::IPEndPoint& ip_endpoint, |
| 184 ChannelAuthType channel_auth, | |
| 185 int64_t timeout_ms, | 184 int64_t timeout_ms, |
| 186 Logger* logger, | 185 Logger* logger, |
| 187 uint64_t device_capabilities) | 186 uint64_t device_capabilities) |
| 188 : TestCastSocket(ip_endpoint, | 187 : TestCastSocket(ip_endpoint, |
| 189 channel_auth, | |
| 190 timeout_ms, | 188 timeout_ms, |
| 191 logger, | 189 logger, |
| 192 new net::TestNetLog(), | 190 new net::TestNetLog(), |
| 193 device_capabilities) {} | 191 device_capabilities) {} |
| 194 | 192 |
| 195 TestCastSocket(const net::IPEndPoint& ip_endpoint, | 193 TestCastSocket(const net::IPEndPoint& ip_endpoint, |
| 196 ChannelAuthType channel_auth, | |
| 197 int64_t timeout_ms, | 194 int64_t timeout_ms, |
| 198 Logger* logger, | 195 Logger* logger, |
| 199 net::TestNetLog* capturing_net_log, | 196 net::TestNetLog* capturing_net_log, |
| 200 uint64_t device_capabilities) | 197 uint64_t device_capabilities) |
| 201 : CastSocketImpl("some_extension_id", | 198 : CastSocketImpl(ip_endpoint, |
| 202 ip_endpoint, | |
| 203 channel_auth, | |
| 204 capturing_net_log, | 199 capturing_net_log, |
| 205 base::TimeDelta::FromMilliseconds(timeout_ms), | 200 base::TimeDelta::FromMilliseconds(timeout_ms), |
| 206 false, | 201 false, |
| 207 logger, | 202 logger, |
| 208 device_capabilities, | 203 device_capabilities, |
| 209 AuthContext::Create()), | 204 AuthContext::Create()), |
| 210 capturing_net_log_(capturing_net_log), | 205 capturing_net_log_(capturing_net_log), |
| 211 ip_(ip_endpoint), | 206 ip_(ip_endpoint), |
| 212 extract_cert_result_(true), | 207 extract_cert_result_(true), |
| 213 verify_challenge_result_(true), | 208 verify_challenge_result_(true), |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 socket_->transport()->SendMessage( | 766 socket_->transport()->SendMessage( |
| 772 test_message, base::Bind(&CompleteHandler::OnWriteComplete, | 767 test_message, base::Bind(&CompleteHandler::OnWriteComplete, |
| 773 base::Unretained(&handler_))); | 768 base::Unretained(&handler_))); |
| 774 RunPendingTasks(); | 769 RunPendingTasks(); |
| 775 | 770 |
| 776 EXPECT_EQ(ReadyState::OPEN, socket_->ready_state()); | 771 EXPECT_EQ(ReadyState::OPEN, socket_->ready_state()); |
| 777 EXPECT_EQ(ChannelError::NONE, socket_->error_state()); | 772 EXPECT_EQ(ChannelError::NONE, socket_->error_state()); |
| 778 } | 773 } |
| 779 | 774 |
| 780 } // namespace cast_channel | 775 } // namespace cast_channel |
| OLD | NEW |