fake_ipc_server.cc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2021 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 "remoting/host/mojo_ipc/fake_ipc_server.h"
  5. namespace remoting {
  6. FakeIpcServer::TestState::TestState() = default;
  7. FakeIpcServer::TestState::~TestState() = default;
  8. FakeIpcServer::FakeIpcServer(TestState* test_state) : test_state_(test_state) {}
  9. FakeIpcServer::~FakeIpcServer() = default;
  10. void FakeIpcServer::StartServer() {
  11. test_state_->is_server_started = true;
  12. }
  13. void FakeIpcServer::StopServer() {
  14. test_state_->is_server_started = false;
  15. }
  16. void FakeIpcServer::Close(mojo::ReceiverId id) {
  17. test_state_->last_closed_receiver = id;
  18. }
  19. void FakeIpcServer::set_disconnect_handler(base::RepeatingClosure handler) {
  20. test_state_->disconnect_handler = handler;
  21. }
  22. mojo::ReceiverId FakeIpcServer::current_receiver() const {
  23. return test_state_->current_receiver;
  24. }
  25. base::ProcessId FakeIpcServer::current_peer_pid() const {
  26. return test_state_->current_peer_pid;
  27. }
  28. } // namespace remoting