| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/protocol/protocol_mock_objects.h" | 5 #include "remoting/protocol/protocol_mock_objects.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 MockSessionManager::MockSessionManager() {} | 48 MockSessionManager::MockSessionManager() {} |
| 49 | 49 |
| 50 MockSessionManager::~MockSessionManager() {} | 50 MockSessionManager::~MockSessionManager() {} |
| 51 | 51 |
| 52 MockPairingRegistryDelegate::MockPairingRegistryDelegate() { | 52 MockPairingRegistryDelegate::MockPairingRegistryDelegate() { |
| 53 } | 53 } |
| 54 | 54 |
| 55 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() { | 55 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() { |
| 56 } | 56 } |
| 57 | 57 |
| 58 scoped_ptr<base::ListValue> MockPairingRegistryDelegate::LoadAll() { | 58 std::unique_ptr<base::ListValue> MockPairingRegistryDelegate::LoadAll() { |
| 59 scoped_ptr<base::ListValue> result(new base::ListValue()); | 59 std::unique_ptr<base::ListValue> result(new base::ListValue()); |
| 60 for (Pairings::const_iterator i = pairings_.begin(); i != pairings_.end(); | 60 for (Pairings::const_iterator i = pairings_.begin(); i != pairings_.end(); |
| 61 ++i) { | 61 ++i) { |
| 62 result->Append(i->second.ToValue().release()); | 62 result->Append(i->second.ToValue().release()); |
| 63 } | 63 } |
| 64 return result; | 64 return result; |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool MockPairingRegistryDelegate::DeleteAll() { | 67 bool MockPairingRegistryDelegate::DeleteAll() { |
| 68 pairings_.clear(); | 68 pairings_.clear(); |
| 69 return true; | 69 return true; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 84 pairings_[pairing.client_id()] = pairing; | 84 pairings_[pairing.client_id()] = pairing; |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 bool MockPairingRegistryDelegate::Delete(const std::string& client_id) { | 88 bool MockPairingRegistryDelegate::Delete(const std::string& client_id) { |
| 89 pairings_.erase(client_id); | 89 pairings_.erase(client_id); |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 SynchronousPairingRegistry::SynchronousPairingRegistry( | 93 SynchronousPairingRegistry::SynchronousPairingRegistry( |
| 94 scoped_ptr<Delegate> delegate) | 94 std::unique_ptr<Delegate> delegate) |
| 95 : PairingRegistry(base::ThreadTaskRunnerHandle::Get(), | 95 : PairingRegistry(base::ThreadTaskRunnerHandle::Get(), |
| 96 std::move(delegate)) {} | 96 std::move(delegate)) {} |
| 97 SynchronousPairingRegistry::~SynchronousPairingRegistry() {} | 97 SynchronousPairingRegistry::~SynchronousPairingRegistry() {} |
| 98 | 98 |
| 99 void SynchronousPairingRegistry::PostTask( | 99 void SynchronousPairingRegistry::PostTask( |
| 100 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 100 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 101 const tracked_objects::Location& from_here, | 101 const tracked_objects::Location& from_here, |
| 102 const base::Closure& task) { | 102 const base::Closure& task) { |
| 103 DCHECK(task_runner->BelongsToCurrentThread()); | 103 DCHECK(task_runner->BelongsToCurrentThread()); |
| 104 task.Run(); | 104 task.Run(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace protocol | 107 } // namespace protocol |
| 108 } // namespace remoting | 108 } // namespace remoting |
| OLD | NEW |