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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return ERR_IO_PENDING; | 58 return ERR_IO_PENDING; |
59 } | 59 } |
60 | 60 |
61 MockMDnsSocketFactory::MockMDnsSocketFactory() { | 61 MockMDnsSocketFactory::MockMDnsSocketFactory() { |
62 } | 62 } |
63 | 63 |
64 MockMDnsSocketFactory::~MockMDnsSocketFactory() { | 64 MockMDnsSocketFactory::~MockMDnsSocketFactory() { |
65 } | 65 } |
66 | 66 |
67 void MockMDnsSocketFactory::CreateSockets( | 67 void MockMDnsSocketFactory::CreateSockets( |
68 ScopedVector<DatagramServerSocket>* sockets) { | 68 std::vector<scoped_ptr<DatagramServerSocket>>* sockets) { |
69 CreateSocket(ADDRESS_FAMILY_IPV4, sockets); | 69 CreateSocket(ADDRESS_FAMILY_IPV4, sockets); |
70 CreateSocket(ADDRESS_FAMILY_IPV6, sockets); | 70 CreateSocket(ADDRESS_FAMILY_IPV6, sockets); |
71 } | 71 } |
72 | 72 |
73 void MockMDnsSocketFactory::CreateSocket( | 73 void MockMDnsSocketFactory::CreateSocket( |
74 AddressFamily address_family, | 74 AddressFamily address_family, |
75 ScopedVector<DatagramServerSocket>* sockets) { | 75 std::vector<scoped_ptr<DatagramServerSocket>>* sockets) { |
76 scoped_ptr<testing::NiceMock<MockMDnsDatagramServerSocket> > new_socket( | 76 scoped_ptr<testing::NiceMock<MockMDnsDatagramServerSocket> > new_socket( |
77 new testing::NiceMock<MockMDnsDatagramServerSocket>(address_family)); | 77 new testing::NiceMock<MockMDnsDatagramServerSocket>(address_family)); |
78 | 78 |
79 ON_CALL(*new_socket, SendToInternal(_, _, _)) | 79 ON_CALL(*new_socket, SendToInternal(_, _, _)) |
80 .WillByDefault(Invoke( | 80 .WillByDefault(Invoke( |
81 this, | 81 this, |
82 &MockMDnsSocketFactory::SendToInternal)); | 82 &MockMDnsSocketFactory::SendToInternal)); |
83 | 83 |
84 ON_CALL(*new_socket, RecvFrom(_, _, _, _)) | 84 ON_CALL(*new_socket, RecvFrom(_, _, _, _)) |
85 .WillByDefault(Invoke( | 85 .WillByDefault(Invoke( |
(...skipping 25 matching lines...) Expand all Loading... |
111 } | 111 } |
112 | 112 |
113 int MockMDnsSocketFactory::SendToInternal( | 113 int MockMDnsSocketFactory::SendToInternal( |
114 const std::string& packet, const std::string& address, | 114 const std::string& packet, const std::string& address, |
115 const CompletionCallback& callback) { | 115 const CompletionCallback& callback) { |
116 OnSendTo(packet); | 116 OnSendTo(packet); |
117 return packet.size(); | 117 return packet.size(); |
118 } | 118 } |
119 | 119 |
120 } // namespace net | 120 } // namespace net |
OLD | NEW |