1effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// Copyright 2014 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
5effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "components/signin/core/browser/fake_auth_status_provider.h"
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)FakeAuthStatusProvider::FakeAuthStatusProvider(SigninErrorController* error)
8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  : error_provider_(error),
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    auth_error_(GoogleServiceAuthError::AuthErrorNone()) {
10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  error_provider_->AddProvider(this);
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)FakeAuthStatusProvider::~FakeAuthStatusProvider() {
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  error_provider_->RemoveProvider(this);
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
174e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)std::string FakeAuthStatusProvider::GetAccountId() const {
184e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  return account_id_;
194e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}
204e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)std::string FakeAuthStatusProvider::GetUsername() const {
22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  return username_;
23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}
24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)GoogleServiceAuthError FakeAuthStatusProvider::GetAuthStatus() const {
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  return auth_error_;
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
294e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void FakeAuthStatusProvider::SetAuthError(const std::string& account_id,
30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                                          const std::string& username,
314e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                                          const GoogleServiceAuthError& error) {
324e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  account_id_ = account_id;
33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  username_ = username;
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  auth_error_ = error;
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  error_provider_->AuthStatusChanged();
362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
37