Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / signin / core / browser / fake_auth_status_provider.h
blob48a03787ea1d353ff9b61ac1f0e4d5b905a00524
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 COMPONENTS_SIGNIN_CORE_BROWSER_FAKE_AUTH_STATUS_PROVIDER_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_FAKE_AUTH_STATUS_PROVIDER_H_
8 #include "components/signin/core/browser/signin_error_controller.h"
10 // Helper class that reports auth errors to SigninErrorController. Automatically
11 // registers and de-registers itself as an AuthStatusProvider in the
12 // constructor and destructor.
13 class FakeAuthStatusProvider
14 : public SigninErrorController::AuthStatusProvider {
15 public:
16 explicit FakeAuthStatusProvider(SigninErrorController* error);
17 ~FakeAuthStatusProvider() override;
19 // Sets the auth error that this provider reports to SigninErrorController.
20 // Also notifies SigninErrorController via AuthStatusChanged().
21 void SetAuthError(const std::string& account_id,
22 const GoogleServiceAuthError& error);
24 void set_error_without_status_change(const GoogleServiceAuthError& error) {
25 auth_error_ = error;
28 // AuthStatusProvider implementation.
29 std::string GetAccountId() const override;
30 GoogleServiceAuthError GetAuthStatus() const override;
32 private:
33 SigninErrorController* error_provider_;
34 std::string account_id_;
35 GoogleServiceAuthError auth_error_;
38 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_FAKE_AUTH_STATUS_PROVIDER_H_