| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 test_message.set_payload_utf8("payload"); | 85 test_message.set_payload_utf8("payload"); |
| 86 return test_message; | 86 return test_message; |
| 87 } | 87 } |
| 88 | 88 |
| 89 class MockTCPSocket : public net::TCPClientSocket { | 89 class MockTCPSocket : public net::TCPClientSocket { |
| 90 public: | 90 public: |
| 91 explicit MockTCPSocket(const net::MockConnect& connect_data) | 91 explicit MockTCPSocket(const net::MockConnect& connect_data) |
| 92 : TCPClientSocket(net::AddressList(), | 92 : TCPClientSocket(net::AddressList(), |
| 93 nullptr, | 93 nullptr, |
| 94 nullptr, | 94 nullptr, |
| 95 net::NetLog::Source()), | 95 net::NetLogSource()), |
| 96 connect_data_(connect_data), | 96 connect_data_(connect_data), |
| 97 do_nothing_(false) {} | 97 do_nothing_(false) {} |
| 98 | 98 |
| 99 explicit MockTCPSocket(bool do_nothing) | 99 explicit MockTCPSocket(bool do_nothing) |
| 100 : TCPClientSocket(net::AddressList(), | 100 : TCPClientSocket(net::AddressList(), |
| 101 nullptr, | 101 nullptr, |
| 102 nullptr, | 102 nullptr, |
| 103 net::NetLog::Source()) { | 103 net::NetLogSource()) { |
| 104 CHECK(do_nothing); | 104 CHECK(do_nothing); |
| 105 do_nothing_ = do_nothing; | 105 do_nothing_ = do_nothing; |
| 106 } | 106 } |
| 107 | 107 |
| 108 virtual int Connect(const net::CompletionCallback& callback) { | 108 virtual int Connect(const net::CompletionCallback& callback) { |
| 109 if (do_nothing_) { | 109 if (do_nothing_) { |
| 110 // Stall the I/O event loop. | 110 // Stall the I/O event loop. |
| 111 return net::ERR_IO_PENDING; | 111 return net::ERR_IO_PENDING; |
| 112 } | 112 } |
| 113 | 113 |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 logger_, cast_channel::CastDeviceCapability::VIDEO_OUT); | 904 logger_, cast_channel::CastDeviceCapability::VIDEO_OUT); |
| 905 EXPECT_FALSE(socket_->audio_only()); | 905 EXPECT_FALSE(socket_->audio_only()); |
| 906 EXPECT_TRUE(socket_->TestVerifyChannelPolicyNone()); | 906 EXPECT_TRUE(socket_->TestVerifyChannelPolicyNone()); |
| 907 EXPECT_FALSE(socket_->audio_only()); | 907 EXPECT_FALSE(socket_->audio_only()); |
| 908 EXPECT_FALSE(socket_->TestVerifyChannelPolicyAudioOnly()); | 908 EXPECT_FALSE(socket_->TestVerifyChannelPolicyAudioOnly()); |
| 909 EXPECT_TRUE(socket_->audio_only()); | 909 EXPECT_TRUE(socket_->audio_only()); |
| 910 } | 910 } |
| 911 } // namespace cast_channel | 911 } // namespace cast_channel |
| 912 } // namespace api | 912 } // namespace api |
| 913 } // namespace extensions | 913 } // namespace extensions |
| OLD | NEW |