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 MockCursorShapeStub::MockCursorShapeStub() {}
44 MockCursorShapeStub::~MockCursorShapeStub() {}
46 MockVideoStub::MockVideoStub() {}
48 MockVideoStub::~MockVideoStub() {}
50 MockSession::MockSession() {}
52 MockSession::~MockSession() {}
54 MockSessionManager::MockSessionManager() {}
56 MockSessionManager::~MockSessionManager() {}
58 MockPairingRegistryDelegate::MockPairingRegistryDelegate() {
61 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() {
64 scoped_ptr
<base::ListValue
> MockPairingRegistryDelegate::LoadAll() {
65 scoped_ptr
<base::ListValue
> result(new base::ListValue());
66 for (Pairings::const_iterator i
= pairings_
.begin(); i
!= pairings_
.end();
68 result
->Append(i
->second
.ToValue().release());
73 bool MockPairingRegistryDelegate::DeleteAll() {
78 protocol::PairingRegistry::Pairing
MockPairingRegistryDelegate::Load(
79 const std::string
& client_id
) {
80 Pairings::const_iterator i
= pairings_
.find(client_id
);
81 if (i
!= pairings_
.end()) {
84 return protocol::PairingRegistry::Pairing();
88 bool MockPairingRegistryDelegate::Save(
89 const protocol::PairingRegistry::Pairing
& pairing
) {
90 pairings_
[pairing
.client_id()] = pairing
;
94 bool MockPairingRegistryDelegate::Delete(const std::string
& client_id
) {
95 pairings_
.erase(client_id
);
99 SynchronousPairingRegistry::SynchronousPairingRegistry(
100 scoped_ptr
<Delegate
> delegate
)
101 : PairingRegistry(base::ThreadTaskRunnerHandle::Get(), delegate
.Pass()) {
104 SynchronousPairingRegistry::~SynchronousPairingRegistry() {
107 void SynchronousPairingRegistry::PostTask(
108 const scoped_refptr
<base::SingleThreadTaskRunner
>& task_runner
,
109 const tracked_objects::Location
& from_here
,
110 const base::Closure
& task
) {
111 DCHECK(task_runner
->BelongsToCurrentThread());
115 } // namespace protocol
116 } // namespace remoting