summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/login/test_attempt_state.cc
blob: b9a00b7c3c138280a63128ca7961cef87c563d14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/login/test_attempt_state.h"

#include <string>

#include "chrome/common/net/gaia/gaia_auth_consumer.h"
#include "cros/chromeos_cryptohome.h"

namespace chromeos {

TestAttemptState::TestAttemptState(const std::string& username,
                                   const std::string& password,
                                   const std::string& ascii_hash,
                                   const std::string& login_token,
                                   const std::string& login_captcha,
                                   const bool user_is_new)
    : AuthAttemptState(username,
                       password,
                       ascii_hash,
                       login_token,
                       login_captcha,
                       user_is_new) {
}

TestAttemptState::TestAttemptState(const std::string& username,
                                   const std::string& ascii_hash)
    : AuthAttemptState(username, ascii_hash) {
}

TestAttemptState::~TestAttemptState() {}

void TestAttemptState::PresetOnlineLoginStatus(
    const GaiaAuthConsumer::ClientLoginResult& credentials,
    const LoginFailure& outcome) {
  online_complete_ = true;
  online_outcome_ = outcome;
  credentials_ = credentials;
}

void TestAttemptState::DisableHosted() {
  hosted_policy_ = GaiaAuthFetcher::HostedAccountsNotAllowed;
}

void TestAttemptState::PresetCryptohomeStatus(bool cryptohome_outcome,
                                                int cryptohome_code) {
  cryptohome_complete_ = true;
  cryptohome_outcome_ = cryptohome_outcome;
  cryptohome_code_ = cryptohome_code;
}

}  // namespace chromeos