1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "services/network/mock_mojo_dhcp_wpad_url_client.h"
6 
7 #include "mojo/public/cpp/bindings/remote.h"
8 #include "mojo/public/cpp/bindings/self_owned_receiver.h"
9 
10 namespace network {
11 
MockMojoDhcpWpadUrlClient(const std::string & pac_url)12 MockMojoDhcpWpadUrlClient::MockMojoDhcpWpadUrlClient(const std::string& pac_url)
13     : pac_url_(pac_url) {}
14 
15 MockMojoDhcpWpadUrlClient::~MockMojoDhcpWpadUrlClient() = default;
16 
GetPacUrl(GetPacUrlCallback callback)17 void MockMojoDhcpWpadUrlClient::GetPacUrl(GetPacUrlCallback callback) {
18   std::move(callback).Run(pac_url_);
19 }
20 
21 mojo::PendingRemote<network::mojom::DhcpWpadUrlClient>
CreateWithSelfOwnedReceiver(const std::string & pac_url)22 MockMojoDhcpWpadUrlClient::CreateWithSelfOwnedReceiver(
23     const std::string& pac_url) {
24   mojo::PendingRemote<network::mojom::DhcpWpadUrlClient> remote;
25   mojo::MakeSelfOwnedReceiver(
26       std::make_unique<MockMojoDhcpWpadUrlClient>(pac_url),
27       remote.InitWithNewPipeAndPassReceiver());
28   return remote;
29 }
30 
31 }  // namespace network
32