blob: 5086dd4c5410fe6bea16246c1cde5caca4109a3c [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
tengs28cb8d62015-04-13 19:46:415#include "components/proximity_auth/cryptauth/mock_cryptauth_client.h"
tengs28cb8d62015-04-13 19:46:416
dcheng51ace48a2015-12-26 22:45:177#include <utility>
8
9#include "base/callback.h"
10
tengs28cb8d62015-04-13 19:46:4111namespace proximity_auth {
12
13MockCryptAuthClient::MockCryptAuthClient() {
14}
15
16MockCryptAuthClient::~MockCryptAuthClient() {
17}
18
tengsa23e01d2015-07-06 21:24:5719MockCryptAuthClientFactory::MockCryptAuthClientFactory(MockType mock_type)
20 : mock_type_(mock_type) {
tengs28cb8d62015-04-13 19:46:4121}
22
23MockCryptAuthClientFactory::~MockCryptAuthClientFactory() {
24}
25
26scoped_ptr<CryptAuthClient> MockCryptAuthClientFactory::CreateInstance() {
27 scoped_ptr<MockCryptAuthClient> client;
tengsa23e01d2015-07-06 21:24:5728 if (mock_type_ == MockType::MAKE_STRICT_MOCKS)
tengs28cb8d62015-04-13 19:46:4129 client.reset(new testing::StrictMock<MockCryptAuthClient>());
30 else
31 client.reset(new testing::NiceMock<MockCryptAuthClient>());
32
33 FOR_EACH_OBSERVER(Observer, observer_list_,
34 OnCryptAuthClientCreated(client.get()));
dcheng51ace48a2015-12-26 22:45:1735 return std::move(client);
tengs28cb8d62015-04-13 19:46:4136}
37
38void MockCryptAuthClientFactory::AddObserver(Observer* observer) {
39 observer_list_.AddObserver(observer);
40}
41
42void MockCryptAuthClientFactory::RemoveObserver(Observer* observer) {
43 observer_list_.RemoveObserver(observer);
44}
45
46} // namespace proximity_auth