test_attempt_state.cc revision 21d179b334e59e9a3bfcaed4c4430bef1bc5759d
1// Copyright (c) 2010 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 "chrome/browser/chromeos/login/test_attempt_state.h"
6
7#include <string>
8
9#include "chrome/common/net/gaia/gaia_auth_consumer.h"
10#include "third_party/cros/chromeos_cryptohome.h"
11
12namespace chromeos {
13
14TestAttemptState::TestAttemptState(const std::string& username,
15                                   const std::string& password,
16                                   const std::string& ascii_hash,
17                                   const std::string& login_token,
18                                   const std::string& login_captcha,
19                                   const bool user_is_new)
20    : AuthAttemptState(username,
21                       password,
22                       ascii_hash,
23                       login_token,
24                       login_captcha,
25                       user_is_new) {
26}
27
28TestAttemptState::TestAttemptState(const std::string& username,
29                                   const std::string& ascii_hash)
30    : AuthAttemptState(username, ascii_hash) {
31}
32
33TestAttemptState::~TestAttemptState() {}
34
35void TestAttemptState::PresetOnlineLoginStatus(
36    const GaiaAuthConsumer::ClientLoginResult& credentials,
37    const LoginFailure& outcome) {
38  online_complete_ = true;
39  online_outcome_ = outcome;
40  credentials_ = credentials;
41}
42
43void TestAttemptState::DisableHosted() {
44  hosted_policy_ = GaiaAuthFetcher::HostedAccountsNotAllowed;
45}
46
47void TestAttemptState::PresetCryptohomeStatus(bool cryptohome_outcome,
48                                                int cryptohome_code) {
49  cryptohome_complete_ = true;
50  cryptohome_outcome_ = cryptohome_outcome;
51  cryptohome_code_ = cryptohome_code;
52}
53
54}  // namespace chromeos
55