Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / remoting / protocol / protocol_mock_objects.cc
blob90876360ca30e8c45c6959bf46ef991931c39db4
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"
10 namespace remoting {
11 namespace protocol {
13 MockConnectionToClient::MockConnectionToClient(Session* session,
14 HostStub* host_stub)
15 : ConnectionToClient(session),
16 clipboard_stub_(nullptr),
17 host_stub_(host_stub),
18 input_stub_(nullptr),
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();
69 ++i) {
70 result->Append(i->second.ToValue().release());
72 return result.Pass();
75 bool MockPairingRegistryDelegate::DeleteAll() {
76 pairings_.clear();
77 return true;
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()) {
84 return i->second;
85 } else {
86 return protocol::PairingRegistry::Pairing();
90 bool MockPairingRegistryDelegate::Save(
91 const protocol::PairingRegistry::Pairing& pairing) {
92 pairings_[pairing.client_id()] = pairing;
93 return true;
96 bool MockPairingRegistryDelegate::Delete(const std::string& client_id) {
97 pairings_.erase(client_id);
98 return true;
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());
114 task.Run();
117 } // namespace protocol
118 } // namespace remoting