OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <queue> | 5 #include <queue> |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "net/base/rand_callback.h" | 9 #include "net/base/rand_callback.h" |
10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 EXPECT_CALL(*socket_ipv6_, RecvFrom(_, _, _, _)) | 1156 EXPECT_CALL(*socket_ipv6_, RecvFrom(_, _, _, _)) |
1157 .WillOnce(Return(ERR_IO_PENDING)); | 1157 .WillOnce(Return(ERR_IO_PENDING)); |
1158 | 1158 |
1159 ASSERT_TRUE(InitConnection()); | 1159 ASSERT_TRUE(InitConnection()); |
1160 | 1160 |
1161 EXPECT_CALL(*socket_ipv4_, | 1161 EXPECT_CALL(*socket_ipv4_, |
1162 SendToInternal(sample_packet, "224.0.0.251:5353", _)); | 1162 SendToInternal(sample_packet, "224.0.0.251:5353", _)); |
1163 EXPECT_CALL(*socket_ipv6_, | 1163 EXPECT_CALL(*socket_ipv6_, |
1164 SendToInternal(sample_packet, "[ff02::fb]:5353", _)); | 1164 SendToInternal(sample_packet, "[ff02::fb]:5353", _)); |
1165 | 1165 |
1166 connection_.Send(buf, buf->size()); | 1166 connection_.Send(buf.get(), buf->size()); |
1167 } | 1167 } |
1168 | 1168 |
1169 TEST_F(MDnsConnectionTest, Error) { | 1169 TEST_F(MDnsConnectionTest, Error) { |
1170 CompletionCallback callback; | 1170 CompletionCallback callback; |
1171 | 1171 |
1172 EXPECT_CALL(*socket_ipv4_, RecvFrom(_, _, _, _)) | 1172 EXPECT_CALL(*socket_ipv4_, RecvFrom(_, _, _, _)) |
1173 .WillOnce(Return(ERR_IO_PENDING)); | 1173 .WillOnce(Return(ERR_IO_PENDING)); |
1174 EXPECT_CALL(*socket_ipv6_, RecvFrom(_, _, _, _)) | 1174 EXPECT_CALL(*socket_ipv6_, RecvFrom(_, _, _, _)) |
1175 .WillOnce(DoAll(SaveArg<3>(&callback), Return(ERR_IO_PENDING))); | 1175 .WillOnce(DoAll(SaveArg<3>(&callback), Return(ERR_IO_PENDING))); |
1176 | 1176 |
1177 ASSERT_TRUE(InitConnection()); | 1177 ASSERT_TRUE(InitConnection()); |
1178 | 1178 |
1179 EXPECT_CALL(delegate_, OnConnectionError(ERR_SOCKET_NOT_CONNECTED)); | 1179 EXPECT_CALL(delegate_, OnConnectionError(ERR_SOCKET_NOT_CONNECTED)); |
1180 callback.Run(ERR_SOCKET_NOT_CONNECTED); | 1180 callback.Run(ERR_SOCKET_NOT_CONNECTED); |
1181 } | 1181 } |
1182 | 1182 |
1183 } // namespace | 1183 } // namespace |
1184 | 1184 |
1185 } // namespace net | 1185 } // namespace net |
OLD | NEW |