mock_mojo_dhcp_wpad_url_client.cc 1.0 KB

12345678910111213141516171819202122232425262728293031
  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. #include "services/network/mock_mojo_dhcp_wpad_url_client.h"
  5. #include "mojo/public/cpp/bindings/remote.h"
  6. #include "mojo/public/cpp/bindings/self_owned_receiver.h"
  7. namespace network {
  8. MockMojoDhcpWpadUrlClient::MockMojoDhcpWpadUrlClient(const std::string& pac_url)
  9. : pac_url_(pac_url) {}
  10. MockMojoDhcpWpadUrlClient::~MockMojoDhcpWpadUrlClient() = default;
  11. void MockMojoDhcpWpadUrlClient::GetPacUrl(GetPacUrlCallback callback) {
  12. std::move(callback).Run(pac_url_);
  13. }
  14. mojo::PendingRemote<network::mojom::DhcpWpadUrlClient>
  15. MockMojoDhcpWpadUrlClient::CreateWithSelfOwnedReceiver(
  16. const std::string& pac_url) {
  17. mojo::PendingRemote<network::mojom::DhcpWpadUrlClient> remote;
  18. mojo::MakeSelfOwnedReceiver(
  19. std::make_unique<MockMojoDhcpWpadUrlClient>(pac_url),
  20. remote.InitWithNewPipeAndPassReceiver());
  21. return remote;
  22. }
  23. } // namespace network