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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 test_message.set_source_id("source"); | 77 test_message.set_source_id("source"); |
78 test_message.set_destination_id("dest"); | 78 test_message.set_destination_id("dest"); |
79 test_message.set_payload_type(CastMessage::STRING); | 79 test_message.set_payload_type(CastMessage::STRING); |
80 test_message.set_payload_utf8("payload"); | 80 test_message.set_payload_utf8("payload"); |
81 return test_message; | 81 return test_message; |
82 } | 82 } |
83 | 83 |
84 class MockTCPSocket : public net::TCPClientSocket { | 84 class MockTCPSocket : public net::TCPClientSocket { |
85 public: | 85 public: |
86 explicit MockTCPSocket(const net::MockConnect& connect_data) | 86 explicit MockTCPSocket(const net::MockConnect& connect_data) |
87 : TCPClientSocket(net::AddressList(), nullptr, net::NetLog::Source()), | 87 : TCPClientSocket(net::AddressList(), |
| 88 nullptr, |
| 89 nullptr, |
| 90 net::NetLog::Source()), |
88 connect_data_(connect_data), | 91 connect_data_(connect_data), |
89 do_nothing_(false) {} | 92 do_nothing_(false) {} |
90 | 93 |
91 explicit MockTCPSocket(bool do_nothing) | 94 explicit MockTCPSocket(bool do_nothing) |
92 : TCPClientSocket(net::AddressList(), nullptr, net::NetLog::Source()) { | 95 : TCPClientSocket(net::AddressList(), |
| 96 nullptr, |
| 97 nullptr, |
| 98 net::NetLog::Source()) { |
93 CHECK(do_nothing); | 99 CHECK(do_nothing); |
94 do_nothing_ = do_nothing; | 100 do_nothing_ = do_nothing; |
95 } | 101 } |
96 | 102 |
97 virtual int Connect(const net::CompletionCallback& callback) { | 103 virtual int Connect(const net::CompletionCallback& callback) { |
98 if (do_nothing_) { | 104 if (do_nothing_) { |
99 // Stall the I/O event loop. | 105 // Stall the I/O event loop. |
100 return net::ERR_IO_PENDING; | 106 return net::ERR_IO_PENDING; |
101 } | 107 } |
102 | 108 |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 logger_, cast_channel::CastDeviceCapability::VIDEO_OUT); | 886 logger_, cast_channel::CastDeviceCapability::VIDEO_OUT); |
881 EXPECT_FALSE(socket_->audio_only()); | 887 EXPECT_FALSE(socket_->audio_only()); |
882 EXPECT_TRUE(socket_->TestVerifyChannelPolicyNone()); | 888 EXPECT_TRUE(socket_->TestVerifyChannelPolicyNone()); |
883 EXPECT_FALSE(socket_->audio_only()); | 889 EXPECT_FALSE(socket_->audio_only()); |
884 EXPECT_FALSE(socket_->TestVerifyChannelPolicyAudioOnly()); | 890 EXPECT_FALSE(socket_->TestVerifyChannelPolicyAudioOnly()); |
885 EXPECT_TRUE(socket_->audio_only()); | 891 EXPECT_TRUE(socket_->audio_only()); |
886 } | 892 } |
887 } // namespace cast_channel | 893 } // namespace cast_channel |
888 } // namespace api | 894 } // namespace api |
889 } // namespace extensions | 895 } // namespace extensions |
OLD | NEW |