| Index: chrome/browser/signin/oauth2_token_service_test_util.h
|
| diff --git a/chrome/browser/signin/oauth2_token_service_test_util.h b/chrome/browser/signin/oauth2_token_service_test_util.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6a1152016bd3083ef262971cfadd5d5fdc92d731
|
| --- /dev/null
|
| +++ b/chrome/browser/signin/oauth2_token_service_test_util.h
|
| @@ -0,0 +1,43 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_TEST_UTIL_H_
|
| +#define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_TEST_UTIL_H_
|
| +
|
| +#include "chrome/browser/signin/oauth2_token_service.h"
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/stringprintf.h"
|
| +#include "google_apis/gaia/google_service_auth_error.h"
|
| +
|
| +static const char kValidTokenResponse[] =
|
| + "{"
|
| + " \"access_token\": \"%s\","
|
| + " \"expires_in\": %d,"
|
| + " \"token_type\": \"Bearer\""
|
| + "}";
|
| +
|
| +std::string GetValidTokenResponse(std::string token, int expiration);
|
| +
|
| +// A simple testing consumer.
|
| +class TestingOAuth2TokenServiceConsumer : public OAuth2TokenService::Consumer {
|
| + public:
|
| + TestingOAuth2TokenServiceConsumer();
|
| + virtual ~TestingOAuth2TokenServiceConsumer();
|
| +
|
| + virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
|
| + const std::string& token,
|
| + const base::Time& expiration_date) OVERRIDE;
|
| +
|
| + virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
|
| + const GoogleServiceAuthError& error) OVERRIDE;
|
| +
|
| + std::string last_token_;
|
| + int number_of_correct_tokens_;
|
| + GoogleServiceAuthError last_error_;
|
| + int number_of_errors_;
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_TEST_UTIL_H_
|
|
|