1 // Copyright 2014 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 #ifndef CHROMEOS_LOGIN_AUTH_FAKE_EXTENDED_AUTHENTICATOR_H_
6 #define CHROMEOS_LOGIN_AUTH_FAKE_EXTENDED_AUTHENTICATOR_H_
8 #include "base/macros.h"
9 #include "chromeos/chromeos_export.h"
10 #include "chromeos/login/auth/extended_authenticator.h"
11 #include "chromeos/login/auth/user_context.h"
17 class CHROMEOS_EXPORT FakeExtendedAuthenticator
: public ExtendedAuthenticator
{
19 FakeExtendedAuthenticator(NewAuthStatusConsumer
* consumer
,
20 const UserContext
& expected_user_context
);
21 FakeExtendedAuthenticator(AuthStatusConsumer
* consumer
,
22 const UserContext
& expected_user_context
);
24 // ExtendedAuthenticator:
25 void SetConsumer(AuthStatusConsumer
* consumer
) override
;
26 void AuthenticateToMount(const UserContext
& context
,
27 const ResultCallback
& success_callback
) override
;
28 void AuthenticateToCheck(const UserContext
& context
,
29 const base::Closure
& success_callback
) override
;
30 void CreateMount(const std::string
& user_id
,
31 const std::vector
<cryptohome::KeyDefinition
>& keys
,
32 const ResultCallback
& success_callback
) override
;
33 void AddKey(const UserContext
& context
,
34 const cryptohome::KeyDefinition
& key
,
35 bool replace_existing
,
36 const base::Closure
& success_callback
) override
;
37 void UpdateKeyAuthorized(const UserContext
& context
,
38 const cryptohome::KeyDefinition
& key
,
39 const std::string
& signature
,
40 const base::Closure
& success_callback
) override
;
41 void RemoveKey(const UserContext
& context
,
42 const std::string
& key_to_remove
,
43 const base::Closure
& success_callback
) override
;
44 void TransformKeyIfNeeded(const UserContext
& user_context
,
45 const ContextCallback
& callback
) override
;
48 ~FakeExtendedAuthenticator() override
;
50 void OnAuthSuccess(const UserContext
& context
);
51 void OnAuthFailure(AuthState state
, const AuthFailure
& error
);
53 NewAuthStatusConsumer
* consumer_
;
54 AuthStatusConsumer
* old_consumer_
;
56 UserContext expected_user_context_
;
58 DISALLOW_COPY_AND_ASSIGN(FakeExtendedAuthenticator
);
61 } // namespace chromeos
63 #endif // CHROMEOS_LOGIN_AUTH_FAKE_EXTENDED_AUTHENTICATOR_H_