Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: net/dns/mock_mdns_socket_factory.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/dns/mdns_client_impl.cc ('k') | net/dns/mojo_host_resolver_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/dns/mock_mdns_socket_factory.h"
6
5 #include <algorithm> 7 #include <algorithm>
8 #include <utility>
6 9
7 #include "base/location.h" 10 #include "base/location.h"
8 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
9 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
10 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
11 #include "net/dns/mock_mdns_socket_factory.h"
12 14
13 using testing::_; 15 using testing::_;
14 using testing::Invoke; 16 using testing::Invoke;
15 17
16 namespace net { 18 namespace net {
17 19
18 MockMDnsDatagramServerSocket::MockMDnsDatagramServerSocket( 20 MockMDnsDatagramServerSocket::MockMDnsDatagramServerSocket(
19 AddressFamily address_family) { 21 AddressFamily address_family) {
20 local_address_ = GetMDnsIPEndPoint(address_family); 22 local_address_ = GetMDnsIPEndPoint(address_family);
21 } 23 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 ON_CALL(*new_socket, SendToInternal(_, _, _)) 81 ON_CALL(*new_socket, SendToInternal(_, _, _))
80 .WillByDefault(Invoke( 82 .WillByDefault(Invoke(
81 this, 83 this,
82 &MockMDnsSocketFactory::SendToInternal)); 84 &MockMDnsSocketFactory::SendToInternal));
83 85
84 ON_CALL(*new_socket, RecvFrom(_, _, _, _)) 86 ON_CALL(*new_socket, RecvFrom(_, _, _, _))
85 .WillByDefault(Invoke( 87 .WillByDefault(Invoke(
86 this, 88 this,
87 &MockMDnsSocketFactory::RecvFromInternal)); 89 &MockMDnsSocketFactory::RecvFromInternal));
88 90
89 sockets->push_back(new_socket.Pass()); 91 sockets->push_back(std::move(new_socket));
90 } 92 }
91 93
92 void MockMDnsSocketFactory::SimulateReceive(const uint8_t* packet, int size) { 94 void MockMDnsSocketFactory::SimulateReceive(const uint8_t* packet, int size) {
93 DCHECK(recv_buffer_size_ >= size); 95 DCHECK(recv_buffer_size_ >= size);
94 DCHECK(recv_buffer_.get()); 96 DCHECK(recv_buffer_.get());
95 DCHECK(!recv_callback_.is_null()); 97 DCHECK(!recv_callback_.is_null());
96 98
97 memcpy(recv_buffer_->data(), packet, size); 99 memcpy(recv_buffer_->data(), packet, size);
98 CompletionCallback recv_callback = recv_callback_; 100 CompletionCallback recv_callback = recv_callback_;
99 recv_callback_.Reset(); 101 recv_callback_.Reset();
(...skipping 11 matching lines...) Expand all
111 } 113 }
112 114
113 int MockMDnsSocketFactory::SendToInternal( 115 int MockMDnsSocketFactory::SendToInternal(
114 const std::string& packet, const std::string& address, 116 const std::string& packet, const std::string& address,
115 const CompletionCallback& callback) { 117 const CompletionCallback& callback) {
116 OnSendTo(packet); 118 OnSendTo(packet);
117 return packet.size(); 119 return packet.size();
118 } 120 }
119 121
120 } // namespace net 122 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/mdns_client_impl.cc ('k') | net/dns/mojo_host_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698