summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/protocol_mock_objects.cc
blob: 1902d83acc9a65d1990e351e0c74d4433affc951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/protocol/protocol_mock_objects.h"

namespace remoting {
namespace protocol {

MockConnectionToClient::MockConnectionToClient(
    Session* session,
    HostStub* host_stub)
    : ConnectionToClient(session) {
  set_host_stub(host_stub);
}

MockConnectionToClient::~MockConnectionToClient() {}

MockConnectionToClientEventHandler::MockConnectionToClientEventHandler() {}

MockConnectionToClientEventHandler::~MockConnectionToClientEventHandler() {}

MockClipboardStub::MockClipboardStub() {}

MockClipboardStub::~MockClipboardStub() {}

MockInputStub::MockInputStub() {}

MockInputStub::~MockInputStub() {}

MockHostStub::MockHostStub() {}

MockHostStub::~MockHostStub() {}

MockClientStub::MockClientStub() {}

MockClientStub::~MockClientStub() {}

MockVideoStub::MockVideoStub() {}

MockVideoStub::~MockVideoStub() {}

MockSession::MockSession() {}

MockSession::~MockSession() {}

MockSessionManager::MockSessionManager() {}

MockSessionManager::~MockSessionManager() {}

MockPairingRegistryDelegate::MockPairingRegistryDelegate() {
}

MockPairingRegistryDelegate::~MockPairingRegistryDelegate() {
}

void MockPairingRegistryDelegate::AddPairing(
    const PairingRegistry::Pairing& new_paired_client,
    const PairingRegistry::AddPairingCallback& callback) {
  paired_clients_[new_paired_client.client_id()] = new_paired_client;
  if (!callback.is_null()) {
    callback.Run(true);
  }
}

void MockPairingRegistryDelegate::GetPairing(
    const std::string& client_id,
    const PairingRegistry::GetPairingCallback& callback) {
  PairingRegistry::Pairing result;
  PairingRegistry::PairedClients::const_iterator i =
      paired_clients_.find(client_id);
  if (i != paired_clients_.end()) {
    result = i->second;
  }
  saved_callback_ = base::Bind(base::Bind(callback), result);
}

void MockPairingRegistryDelegate::RunCallback() {
  DCHECK(!saved_callback_.is_null());
  saved_callback_.Run();
  saved_callback_.Reset();
}

}  // namespace protocol
}  // namespace remoting