OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_TEST_UTIL_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_TEST_UTIL_H_ |
| 7 |
| 8 #include "chrome/browser/signin/oauth2_token_service.h" |
| 9 |
| 10 #include <string> |
| 11 |
| 12 #include "base/stringprintf.h" |
| 13 #include "google_apis/gaia/google_service_auth_error.h" |
| 14 |
| 15 extern const char kValidTokenResponse[]; |
| 16 |
| 17 std::string GetValidTokenResponse(std::string token, int expiration); |
| 18 |
| 19 // A simple testing consumer. |
| 20 class TestingOAuth2TokenServiceConsumer : public OAuth2TokenService::Consumer { |
| 21 public: |
| 22 TestingOAuth2TokenServiceConsumer(); |
| 23 virtual ~TestingOAuth2TokenServiceConsumer(); |
| 24 |
| 25 // OAuth2TokenService::Consumer overrides. |
| 26 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 27 const std::string& token, |
| 28 const base::Time& expiration_date) OVERRIDE; |
| 29 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 30 const GoogleServiceAuthError& error) OVERRIDE; |
| 31 |
| 32 std::string last_token_; |
| 33 int number_of_successful_tokens_; |
| 34 GoogleServiceAuthError last_error_; |
| 35 int number_of_errors_; |
| 36 }; |
| 37 |
| 38 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_TEST_UTIL_H_ |
OLD | NEW |