fake_auth_status_provider.cc revision effb81e5f8246d0db0270817048dc992db66e9fb
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) 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)GoogleServiceAuthError FakeAuthStatusProvider::GetAuthStatus() const { 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return auth_error_; 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 254e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void FakeAuthStatusProvider::SetAuthError(const std::string& account_id, 264e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) const GoogleServiceAuthError& error) { 274e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) account_id_ = account_id; 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) auth_error_ = error; 29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) error_provider_->AuthStatusChanged(); 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 31