| Index: chrome/common/net/gaia/gaia_oauth_client_unittest.cc
|
| diff --git a/chrome/common/net/gaia/gaia_oauth_client_unittest.cc b/chrome/common/net/gaia/gaia_oauth_client_unittest.cc
|
| index 6e1f20ad60c00ed044e54d562a7d8d218f327fc8..e29527b4c95b9806fbfe9c914eb31274ec7f7b43 100644
|
| --- a/chrome/common/net/gaia/gaia_oauth_client_unittest.cc
|
| +++ b/chrome/common/net/gaia/gaia_oauth_client_unittest.cc
|
| @@ -12,8 +12,8 @@
|
| #include "chrome/common/net/gaia/gaia_oauth_client.h"
|
| #include "chrome/common/net/http_return.h"
|
| #include "chrome/test/testing_profile.h"
|
| -#include "content/common/test_url_fetcher_factory.h"
|
| #include "content/common/url_fetcher.h"
|
| +#include "content/test/test_url_fetcher_factory.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "net/base/net_errors.h"
|
| #include "net/url_request/url_request_status.h"
|
| @@ -69,10 +69,13 @@ class MockOAuthFetcher : public URLFetcher {
|
| DISALLOW_COPY_AND_ASSIGN(MockOAuthFetcher);
|
| };
|
|
|
| -class MockOAuthFetcherFactory : public URLFetcher::Factory {
|
| +class MockOAuthFetcherFactory : public URLFetcher::Factory,
|
| + public ScopedURLFetcherFactory {
|
| public:
|
| MockOAuthFetcherFactory()
|
| - : response_code_(RC_REQUEST_OK) {}
|
| + : ScopedURLFetcherFactory(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
|
| + response_code_(RC_REQUEST_OK) {
|
| + }
|
| ~MockOAuthFetcherFactory() {}
|
| virtual URLFetcher* CreateURLFetcher(
|
| int id,
|
| @@ -152,7 +155,6 @@ TEST_F(GaiaOAuthClientTest, NetworkFailure) {
|
| TestingProfile profile;
|
|
|
| MockOAuthFetcherFactory factory;
|
| - URLFetcher::set_factory(&factory);
|
| factory.set_response_code(response_code);
|
| factory.set_max_failure_count(4);
|
|
|
| @@ -162,7 +164,6 @@ TEST_F(GaiaOAuthClientTest, NetworkFailure) {
|
| GaiaOAuthClient auth(kGaiaOAuth2Url,
|
| profile_.GetRequestContext());
|
| auth.GetTokensFromAuthCode(client_info, "auth_code", 2, &delegate);
|
| - URLFetcher::set_factory(NULL);
|
| }
|
|
|
| TEST_F(GaiaOAuthClientTest, NetworkFailureRecover) {
|
| @@ -175,7 +176,6 @@ TEST_F(GaiaOAuthClientTest, NetworkFailureRecover) {
|
| TestingProfile profile;
|
|
|
| MockOAuthFetcherFactory factory;
|
| - URLFetcher::set_factory(&factory);
|
| factory.set_response_code(response_code);
|
| factory.set_max_failure_count(4);
|
| factory.set_results(kDummyGetTokensResult);
|
| @@ -186,7 +186,6 @@ TEST_F(GaiaOAuthClientTest, NetworkFailureRecover) {
|
| GaiaOAuthClient auth(kGaiaOAuth2Url,
|
| profile_.GetRequestContext());
|
| auth.GetTokensFromAuthCode(client_info, "auth_code", -1, &delegate);
|
| - URLFetcher::set_factory(NULL);
|
| }
|
|
|
| TEST_F(GaiaOAuthClientTest, OAuthFailure) {
|
| @@ -198,7 +197,6 @@ TEST_F(GaiaOAuthClientTest, OAuthFailure) {
|
| TestingProfile profile;
|
|
|
| MockOAuthFetcherFactory factory;
|
| - URLFetcher::set_factory(&factory);
|
| factory.set_response_code(response_code);
|
| factory.set_max_failure_count(-1);
|
| factory.set_results(kDummyGetTokensResult);
|
| @@ -209,7 +207,6 @@ TEST_F(GaiaOAuthClientTest, OAuthFailure) {
|
| GaiaOAuthClient auth(kGaiaOAuth2Url,
|
| profile_.GetRequestContext());
|
| auth.GetTokensFromAuthCode(client_info, "auth_code", -1, &delegate);
|
| - URLFetcher::set_factory(NULL);
|
| }
|
|
|
|
|
| @@ -221,7 +218,6 @@ TEST_F(GaiaOAuthClientTest, GetTokensSuccess) {
|
| TestingProfile profile;
|
|
|
| MockOAuthFetcherFactory factory;
|
| - URLFetcher::set_factory(&factory);
|
| factory.set_results(kDummyGetTokensResult);
|
|
|
| OAuthClientInfo client_info;
|
| @@ -230,7 +226,6 @@ TEST_F(GaiaOAuthClientTest, GetTokensSuccess) {
|
| GaiaOAuthClient auth(kGaiaOAuth2Url,
|
| profile_.GetRequestContext());
|
| auth.GetTokensFromAuthCode(client_info, "auth_code", -1, &delegate);
|
| - URLFetcher::set_factory(NULL);
|
| }
|
|
|
| TEST_F(GaiaOAuthClientTest, RefreshTokenSuccess) {
|
| @@ -241,7 +236,6 @@ TEST_F(GaiaOAuthClientTest, RefreshTokenSuccess) {
|
| TestingProfile profile;
|
|
|
| MockOAuthFetcherFactory factory;
|
| - URLFetcher::set_factory(&factory);
|
| factory.set_results(kDummyRefreshTokenResult);
|
|
|
| OAuthClientInfo client_info;
|
| @@ -250,6 +244,5 @@ TEST_F(GaiaOAuthClientTest, RefreshTokenSuccess) {
|
| GaiaOAuthClient auth(kGaiaOAuth2Url,
|
| profile_.GetRequestContext());
|
| auth.GetTokensFromAuthCode(client_info, "auth_code", -1, &delegate);
|
| - URLFetcher::set_factory(NULL);
|
| }
|
| } // namespace gaia
|
|
|