1 // Copyright 2013 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 GOOGLE_APIS_DRIVE_DUMMY_AUTH_SERVICE_H_
6 #define GOOGLE_APIS_DRIVE_DUMMY_AUTH_SERVICE_H_
8 #include "base/compiler_specific.h"
9 #include "google_apis/drive/auth_service_interface.h"
11 namespace google_apis
{
13 // Dummy implementation of AuthServiceInterface that always return a dummy
15 class DummyAuthService
: public AuthServiceInterface
{
17 // The constructor presets non-empty tokens. When a test for checking auth
18 // failure case (i.e., empty tokens) is needed, explicitly clear them by the
19 // Clear{Access, Refresh}Token methods.
22 void set_access_token(const std::string
& token
) { access_token_
= token
; }
23 void set_refresh_token(const std::string
& token
) { refresh_token_
= token
; }
24 const std::string
& refresh_token() const { return refresh_token_
; }
26 // AuthServiceInterface overrides.
27 void AddObserver(AuthServiceObserver
* observer
) override
;
28 void RemoveObserver(AuthServiceObserver
* observer
) override
;
29 void StartAuthentication(const AuthStatusCallback
& callback
) override
;
30 bool HasAccessToken() const override
;
31 bool HasRefreshToken() const override
;
32 const std::string
& access_token() const override
;
33 void ClearAccessToken() override
;
34 void ClearRefreshToken() override
;
37 std::string access_token_
;
38 std::string refresh_token_
;
41 } // namespace google_apis
43 #endif // GOOGLE_APIS_DRIVE_DUMMY_AUTH_SERVICE_H_