Update mojo sdk to rev c02a28868825edfa57ab77947b8cb15e741c5598
[chromium-blink-merge.git] / components / proximity_auth / cryptauth / mock_cryptauth_client.cc
blob05f9ac6c33befe86c2521478a02195274507b676
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"
8 namespace proximity_auth {
10 MockCryptAuthClient::MockCryptAuthClient() {
13 MockCryptAuthClient::~MockCryptAuthClient() {
16 MockCryptAuthClientFactory::MockCryptAuthClientFactory(MockType mock_type)
17 : mock_type_(mock_type) {
20 MockCryptAuthClientFactory::~MockCryptAuthClientFactory() {
23 scoped_ptr<CryptAuthClient> MockCryptAuthClientFactory::CreateInstance() {
24 scoped_ptr<MockCryptAuthClient> client;
25 if (mock_type_ == MockType::MAKE_STRICT_MOCKS)
26 client.reset(new testing::StrictMock<MockCryptAuthClient>());
27 else
28 client.reset(new testing::NiceMock<MockCryptAuthClient>());
30 FOR_EACH_OBSERVER(Observer, observer_list_,
31 OnCryptAuthClientCreated(client.get()));
32 return client.Pass();
35 void MockCryptAuthClientFactory::AddObserver(Observer* observer) {
36 observer_list_.AddObserver(observer);
39 void MockCryptAuthClientFactory::RemoveObserver(Observer* observer) {
40 observer_list_.RemoveObserver(observer);
43 } // namespace proximity_auth