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 "extensions/browser/api/cast_channel/cast_socket.h" | 5 #include "extensions/browser/api/cast_channel/cast_socket.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/sys_byteorder.h" | 13 #include "base/sys_byteorder.h" |
14 #include "base/test/simple_test_tick_clock.h" | 14 #include "base/test/simple_test_tick_clock.h" |
15 #include "base/timer/mock_timer.h" | 15 #include "base/timer/mock_timer.h" |
16 #include "extensions/browser/api/cast_channel/cast_auth_util.h" | 16 #include "extensions/browser/api/cast_channel/cast_auth_util.h" |
17 #include "extensions/browser/api/cast_channel/cast_framer.h" | 17 #include "extensions/browser/api/cast_channel/cast_framer.h" |
18 #include "extensions/browser/api/cast_channel/cast_message_util.h" | 18 #include "extensions/browser/api/cast_channel/cast_message_util.h" |
19 #include "extensions/browser/api/cast_channel/cast_test_util.h" | 19 #include "extensions/browser/api/cast_channel/cast_test_util.h" |
20 #include "extensions/browser/api/cast_channel/cast_transport.h" | 20 #include "extensions/browser/api/cast_channel/cast_transport.h" |
21 #include "extensions/browser/api/cast_channel/logger.h" | 21 #include "extensions/browser/api/cast_channel/logger.h" |
22 #include "extensions/common/api/cast_channel/cast_channel.pb.h" | 22 #include "extensions/common/api/cast_channel/cast_channel.pb.h" |
23 #include "net/base/address_list.h" | 23 #include "net/base/address_list.h" |
24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
26 #include "net/log/capturing_net_log.h" | 26 #include "net/log/test_net_log.h" |
27 #include "net/socket/socket_test_util.h" | 27 #include "net/socket/socket_test_util.h" |
28 #include "net/socket/ssl_client_socket.h" | 28 #include "net/socket/ssl_client_socket.h" |
29 #include "net/socket/tcp_client_socket.h" | 29 #include "net/socket/tcp_client_socket.h" |
30 #include "net/ssl/ssl_info.h" | 30 #include "net/ssl/ssl_info.h" |
31 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
33 | 33 |
34 const int64 kDistantTimeoutMillis = 100000; // 100 seconds (never hit). | 34 const int64 kDistantTimeoutMillis = 100000; // 100 seconds (never hit). |
35 | 35 |
36 using ::testing::_; | 36 using ::testing::_; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 return extract_cert_result_; | 303 return extract_cert_result_; |
304 } | 304 } |
305 | 305 |
306 bool VerifyChallengeReply() override { | 306 bool VerifyChallengeReply() override { |
307 EXPECT_FALSE(verify_challenge_disallow_); | 307 EXPECT_FALSE(verify_challenge_disallow_); |
308 return verify_challenge_result_; | 308 return verify_challenge_result_; |
309 } | 309 } |
310 | 310 |
311 base::Timer* GetTimer() override { return mock_timer_.get(); } | 311 base::Timer* GetTimer() override { return mock_timer_.get(); } |
312 | 312 |
313 net::CapturingNetLog capturing_net_log_; | 313 net::TestNetLog capturing_net_log_; |
314 net::IPEndPoint ip_; | 314 net::IPEndPoint ip_; |
315 // Simulated connect data | 315 // Simulated connect data |
316 scoped_ptr<net::MockConnect> tcp_connect_data_[2]; | 316 scoped_ptr<net::MockConnect> tcp_connect_data_[2]; |
317 scoped_ptr<net::MockConnect> ssl_connect_data_[2]; | 317 scoped_ptr<net::MockConnect> ssl_connect_data_[2]; |
318 // Simulated read / write data | 318 // Simulated read / write data |
319 std::vector<net::MockWrite> writes_; | 319 std::vector<net::MockWrite> writes_; |
320 std::vector<net::MockRead> reads_; | 320 std::vector<net::MockRead> reads_; |
321 scoped_ptr<net::SocketDataProvider> ssl_data_; | 321 scoped_ptr<net::SocketDataProvider> ssl_data_; |
322 // Number of times Connect method is called | 322 // Number of times Connect method is called |
323 size_t connect_index_; | 323 size_t connect_index_; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 // Tests channel policy verification for device with video out capability. | 883 // Tests channel policy verification for device with video out capability. |
884 TEST_F(CastSocketTest, TestChannelPolicyVerificationCapabilitiesVideoOut) { | 884 TEST_F(CastSocketTest, TestChannelPolicyVerificationCapabilitiesVideoOut) { |
885 socket_ = TestCastSocket::Create( | 885 socket_ = TestCastSocket::Create( |
886 logger_, cast_channel::CastDeviceCapability::VIDEO_OUT); | 886 logger_, cast_channel::CastDeviceCapability::VIDEO_OUT); |
887 EXPECT_TRUE(socket_->TestVerifyChannelPolicyNone()); | 887 EXPECT_TRUE(socket_->TestVerifyChannelPolicyNone()); |
888 EXPECT_FALSE(socket_->TestVerifyChannelPolicyAudioOnly()); | 888 EXPECT_FALSE(socket_->TestVerifyChannelPolicyAudioOnly()); |
889 } | 889 } |
890 } // namespace cast_channel | 890 } // namespace cast_channel |
891 } // namespace core_api | 891 } // namespace core_api |
892 } // namespace extensions | 892 } // namespace extensions |
OLD | NEW |