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