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(Session
* session
,
15 : ConnectionToClient(session
),
16 clipboard_stub_(nullptr),
17 host_stub_(host_stub
),
19 video_feedback_stub_(nullptr) {
22 MockConnectionToClient::~MockConnectionToClient() {}
24 MockConnectionToClientEventHandler::MockConnectionToClientEventHandler() {}
26 MockConnectionToClientEventHandler::~MockConnectionToClientEventHandler() {}
28 MockClipboardStub::MockClipboardStub() {}
30 MockClipboardStub::~MockClipboardStub() {}
32 MockInputStub::MockInputStub() {}
34 MockInputStub::~MockInputStub() {}
36 MockHostStub::MockHostStub() {}
38 MockHostStub::~MockHostStub() {}
40 MockClientStub::MockClientStub() {}
42 MockClientStub::~MockClientStub() {}
44 MockCursorShapeStub::MockCursorShapeStub() {}
46 MockCursorShapeStub::~MockCursorShapeStub() {}
48 MockVideoStub::MockVideoStub() {}
50 MockVideoStub::~MockVideoStub() {}
52 MockSession::MockSession() {}
54 MockSession::~MockSession() {}
56 MockSessionManager::MockSessionManager() {}
58 MockSessionManager::~MockSessionManager() {}
60 MockPairingRegistryDelegate::MockPairingRegistryDelegate() {
63 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() {
66 scoped_ptr
<base::ListValue
> MockPairingRegistryDelegate::LoadAll() {
67 scoped_ptr
<base::ListValue
> result(new base::ListValue());
68 for (Pairings::const_iterator i
= pairings_
.begin(); i
!= pairings_
.end();
70 result
->Append(i
->second
.ToValue().release());
75 bool MockPairingRegistryDelegate::DeleteAll() {
80 protocol::PairingRegistry::Pairing
MockPairingRegistryDelegate::Load(
81 const std::string
& client_id
) {
82 Pairings::const_iterator i
= pairings_
.find(client_id
);
83 if (i
!= pairings_
.end()) {
86 return protocol::PairingRegistry::Pairing();
90 bool MockPairingRegistryDelegate::Save(
91 const protocol::PairingRegistry::Pairing
& pairing
) {
92 pairings_
[pairing
.client_id()] = pairing
;
96 bool MockPairingRegistryDelegate::Delete(const std::string
& client_id
) {
97 pairings_
.erase(client_id
);
101 SynchronousPairingRegistry::SynchronousPairingRegistry(
102 scoped_ptr
<Delegate
> delegate
)
103 : PairingRegistry(base::ThreadTaskRunnerHandle::Get(), delegate
.Pass()) {
106 SynchronousPairingRegistry::~SynchronousPairingRegistry() {
109 void SynchronousPairingRegistry::PostTask(
110 const scoped_refptr
<base::SingleThreadTaskRunner
>& task_runner
,
111 const tracked_objects::Location
& from_here
,
112 const base::Closure
& task
) {
113 DCHECK(task_runner
->BelongsToCurrentThread());
117 } // namespace protocol
118 } // namespace remoting