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
3 // found in the LICENSE file.
5 #include "base/callback.h"
6 #include "components/proximity_auth/cryptauth/mock_cryptauth_client.h"
7 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
9 namespace proximity_auth
{
11 MockCryptAuthClient::MockCryptAuthClient() {
14 MockCryptAuthClient::~MockCryptAuthClient() {
17 MockCryptAuthClientFactory::MockCryptAuthClientFactory(MockType mock_type
)
18 : mock_type_(mock_type
) {
21 MockCryptAuthClientFactory::~MockCryptAuthClientFactory() {
24 scoped_ptr
<CryptAuthClient
> MockCryptAuthClientFactory::CreateInstance() {
25 scoped_ptr
<MockCryptAuthClient
> client
;
26 if (mock_type_
== MockType::MAKE_STRICT_MOCKS
)
27 client
.reset(new testing::StrictMock
<MockCryptAuthClient
>());
29 client
.reset(new testing::NiceMock
<MockCryptAuthClient
>());
31 FOR_EACH_OBSERVER(Observer
, observer_list_
,
32 OnCryptAuthClientCreated(client
.get()));
36 void MockCryptAuthClientFactory::AddObserver(Observer
* observer
) {
37 observer_list_
.AddObserver(observer
);
40 void MockCryptAuthClientFactory::RemoveObserver(Observer
* observer
) {
41 observer_list_
.RemoveObserver(observer
);
44 } // namespace proximity_auth