1 // Copyright (c) 2012 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.
5 #include "remoting/protocol/protocol_mock_objects.h"
7 #include "base/logging.h"
8 #include "base/thread_task_runner_handle.h"
13 MockConnectionToClient::MockConnectionToClient(
16 : ConnectionToClient(session
) {
17 set_host_stub(host_stub
);
20 MockConnectionToClient::~MockConnectionToClient() {}
22 MockConnectionToClientEventHandler::MockConnectionToClientEventHandler() {}
24 MockConnectionToClientEventHandler::~MockConnectionToClientEventHandler() {}
26 MockClipboardStub::MockClipboardStub() {}
28 MockClipboardStub::~MockClipboardStub() {}
30 MockInputStub::MockInputStub() {}
32 MockInputStub::~MockInputStub() {}
34 MockHostStub::MockHostStub() {}
36 MockHostStub::~MockHostStub() {}
38 MockClientStub::MockClientStub() {}
40 MockClientStub::~MockClientStub() {}
42 MockVideoStub::MockVideoStub() {}
44 MockVideoStub::~MockVideoStub() {}
46 MockSession::MockSession() {}
48 MockSession::~MockSession() {}
50 MockSessionManager::MockSessionManager() {}
52 MockSessionManager::~MockSessionManager() {}
54 MockPairingRegistryDelegate::MockPairingRegistryDelegate() {
57 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() {
60 scoped_ptr
<base::ListValue
> MockPairingRegistryDelegate::LoadAll() {
61 scoped_ptr
<base::ListValue
> result(new base::ListValue());
62 for (Pairings::const_iterator i
= pairings_
.begin(); i
!= pairings_
.end();
64 result
->Append(i
->second
.ToValue().release());
69 bool MockPairingRegistryDelegate::DeleteAll() {
74 protocol::PairingRegistry::Pairing
MockPairingRegistryDelegate::Load(
75 const std::string
& client_id
) {
76 Pairings::const_iterator i
= pairings_
.find(client_id
);
77 if (i
!= pairings_
.end()) {
80 return protocol::PairingRegistry::Pairing();
84 bool MockPairingRegistryDelegate::Save(
85 const protocol::PairingRegistry::Pairing
& pairing
) {
86 pairings_
[pairing
.client_id()] = pairing
;
90 bool MockPairingRegistryDelegate::Delete(const std::string
& client_id
) {
91 pairings_
.erase(client_id
);
95 SynchronousPairingRegistry::SynchronousPairingRegistry(
96 scoped_ptr
<Delegate
> delegate
)
97 : PairingRegistry(base::ThreadTaskRunnerHandle::Get(), delegate
.Pass()) {
100 SynchronousPairingRegistry::~SynchronousPairingRegistry() {
103 void SynchronousPairingRegistry::PostTask(
104 const scoped_refptr
<base::SingleThreadTaskRunner
>& task_runner
,
105 const tracked_objects::Location
& from_here
,
106 const base::Closure
& task
) {
107 DCHECK(task_runner
->BelongsToCurrentThread());
111 } // namespace protocol
112 } // namespace remoting