Add Download.ShowDangerousDownloadConfirmationPrompt for Windows/CrOS
[chromium-blink-merge.git] / remoting / protocol / protocol_mock_objects.cc
blob93f6e342ac4b122c7a4f2e479466f8e0df754265
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(
14 Session* session,
15 HostStub* host_stub)
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();
63 ++i) {
64 result->Append(i->second.ToValue().release());
66 return result.Pass();
69 bool MockPairingRegistryDelegate::DeleteAll() {
70 pairings_.clear();
71 return true;
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()) {
78 return i->second;
79 } else {
80 return protocol::PairingRegistry::Pairing();
84 bool MockPairingRegistryDelegate::Save(
85 const protocol::PairingRegistry::Pairing& pairing) {
86 pairings_[pairing.client_id()] = pairing;
87 return true;
90 bool MockPairingRegistryDelegate::Delete(const std::string& client_id) {
91 pairings_.erase(client_id);
92 return true;
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());
108 task.Run();
111 } // namespace protocol
112 } // namespace remoting