OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/proximity_auth/cryptauth/mock_cryptauth_client.h" |
| 6 |
| 7 #include <utility> |
| 8 |
5 #include "base/callback.h" | 9 #include "base/callback.h" |
6 #include "components/proximity_auth/cryptauth/mock_cryptauth_client.h" | |
7 | 10 |
8 namespace proximity_auth { | 11 namespace proximity_auth { |
9 | 12 |
10 MockCryptAuthClient::MockCryptAuthClient() { | 13 MockCryptAuthClient::MockCryptAuthClient() { |
11 } | 14 } |
12 | 15 |
13 MockCryptAuthClient::~MockCryptAuthClient() { | 16 MockCryptAuthClient::~MockCryptAuthClient() { |
14 } | 17 } |
15 | 18 |
16 MockCryptAuthClientFactory::MockCryptAuthClientFactory(MockType mock_type) | 19 MockCryptAuthClientFactory::MockCryptAuthClientFactory(MockType mock_type) |
17 : mock_type_(mock_type) { | 20 : mock_type_(mock_type) { |
18 } | 21 } |
19 | 22 |
20 MockCryptAuthClientFactory::~MockCryptAuthClientFactory() { | 23 MockCryptAuthClientFactory::~MockCryptAuthClientFactory() { |
21 } | 24 } |
22 | 25 |
23 scoped_ptr<CryptAuthClient> MockCryptAuthClientFactory::CreateInstance() { | 26 scoped_ptr<CryptAuthClient> MockCryptAuthClientFactory::CreateInstance() { |
24 scoped_ptr<MockCryptAuthClient> client; | 27 scoped_ptr<MockCryptAuthClient> client; |
25 if (mock_type_ == MockType::MAKE_STRICT_MOCKS) | 28 if (mock_type_ == MockType::MAKE_STRICT_MOCKS) |
26 client.reset(new testing::StrictMock<MockCryptAuthClient>()); | 29 client.reset(new testing::StrictMock<MockCryptAuthClient>()); |
27 else | 30 else |
28 client.reset(new testing::NiceMock<MockCryptAuthClient>()); | 31 client.reset(new testing::NiceMock<MockCryptAuthClient>()); |
29 | 32 |
30 FOR_EACH_OBSERVER(Observer, observer_list_, | 33 FOR_EACH_OBSERVER(Observer, observer_list_, |
31 OnCryptAuthClientCreated(client.get())); | 34 OnCryptAuthClientCreated(client.get())); |
32 return client.Pass(); | 35 return std::move(client); |
33 } | 36 } |
34 | 37 |
35 void MockCryptAuthClientFactory::AddObserver(Observer* observer) { | 38 void MockCryptAuthClientFactory::AddObserver(Observer* observer) { |
36 observer_list_.AddObserver(observer); | 39 observer_list_.AddObserver(observer); |
37 } | 40 } |
38 | 41 |
39 void MockCryptAuthClientFactory::RemoveObserver(Observer* observer) { | 42 void MockCryptAuthClientFactory::RemoveObserver(Observer* observer) { |
40 observer_list_.RemoveObserver(observer); | 43 observer_list_.RemoveObserver(observer); |
41 } | 44 } |
42 | 45 |
43 } // namespace proximity_auth | 46 } // namespace proximity_auth |
OLD | NEW |