blob: 099082fc2cace2bcffd2d0d3e3015d052c474b76 [file] [log] [blame]
tengs28cb8d62015-04-13 19:46:411// 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.
4
5#include "base/callback.h"
6#include "components/proximity_auth/cryptauth/mock_cryptauth_client.h"
7
8namespace proximity_auth {
9
10MockCryptAuthClient::MockCryptAuthClient() {
11}
12
13MockCryptAuthClient::~MockCryptAuthClient() {
14}
15
16MockCryptAuthClientFactory::MockCryptAuthClientFactory(bool is_strict)
17 : is_strict_(is_strict) {
18}
19
20MockCryptAuthClientFactory::~MockCryptAuthClientFactory() {
21}
22
23scoped_ptr<CryptAuthClient> MockCryptAuthClientFactory::CreateInstance() {
24 scoped_ptr<MockCryptAuthClient> client;
25 if (is_strict_)
26 client.reset(new testing::StrictMock<MockCryptAuthClient>());
27 else
28 client.reset(new testing::NiceMock<MockCryptAuthClient>());
29
30 FOR_EACH_OBSERVER(Observer, observer_list_,
31 OnCryptAuthClientCreated(client.get()));
32 return client.Pass();
33}
34
35void MockCryptAuthClientFactory::AddObserver(Observer* observer) {
36 observer_list_.AddObserver(observer);
37}
38
39void MockCryptAuthClientFactory::RemoveObserver(Observer* observer) {
40 observer_list_.RemoveObserver(observer);
41}
42
43} // namespace proximity_auth