Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7692)

Unified Diff: chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc

Issue 7524033: Add a scoper object for URLFetcher::Factory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
diff --git a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
index 26160e9894be6a5c14d256345e4a8961c4e7fdad..bb65598ed1b68c2c4a3e9436f27641e8441aac35 100644
--- a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
+++ b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
@@ -17,8 +17,8 @@
#include "chrome/common/net/gaia/google_service_auth_error.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"
@@ -386,7 +386,6 @@ TEST_F(GaiaAuthFetcherTest, FullLogin) {
TestingProfile profile;
MockFactory<MockFetcher> factory;
- URLFetcher::set_factory(&factory);
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
@@ -396,8 +395,6 @@ TEST_F(GaiaAuthFetcherTest, FullLogin) {
std::string(),
std::string(),
GaiaAuthFetcher::HostedAccountsAllowed);
-
- URLFetcher::set_factory(NULL);
}
TEST_F(GaiaAuthFetcherTest, FullLoginFailure) {
@@ -408,7 +405,6 @@ TEST_F(GaiaAuthFetcherTest, FullLoginFailure) {
TestingProfile profile;
MockFactory<MockFetcher> factory;
- URLFetcher::set_factory(&factory);
factory.set_success(false);
GaiaAuthFetcher auth(&consumer, std::string(),
@@ -419,8 +415,6 @@ TEST_F(GaiaAuthFetcherTest, FullLoginFailure) {
std::string(),
std::string(),
GaiaAuthFetcher::HostedAccountsAllowed);
-
- URLFetcher::set_factory(NULL);
}
TEST_F(GaiaAuthFetcherTest, ClientFetchPending) {
@@ -430,7 +424,6 @@ TEST_F(GaiaAuthFetcherTest, ClientFetchPending) {
TestingProfile profile;
TestURLFetcherFactory factory;
- URLFetcher::set_factory(&factory);
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
@@ -441,7 +434,6 @@ TEST_F(GaiaAuthFetcherTest, ClientFetchPending) {
std::string(),
GaiaAuthFetcher::HostedAccountsAllowed);
- URLFetcher::set_factory(NULL);
EXPECT_TRUE(auth.HasPendingFetch());
auth.OnURLFetchComplete(
NULL,
@@ -459,14 +451,12 @@ TEST_F(GaiaAuthFetcherTest, FullTokenSuccess) {
.Times(1);
TestingProfile profile;
- TestURLFetcherFactory factory;
- URLFetcher::set_factory(&factory);
+ TestURLFetcherFactory factory;
GaiaAuthFetcher auth(&consumer, std::string(),
- profile_.GetRequestContext());
+ profile_.GetRequestContext());
auth.StartIssueAuthToken("sid", "lsid", "service");
- URLFetcher::set_factory(NULL);
EXPECT_TRUE(auth.HasPendingFetch());
auth.OnURLFetchComplete(
NULL,
@@ -485,13 +475,11 @@ TEST_F(GaiaAuthFetcherTest, FullTokenFailure) {
TestingProfile profile;
TestURLFetcherFactory factory;
- URLFetcher::set_factory(&factory);
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
auth.StartIssueAuthToken("sid", "lsid", "service");
- URLFetcher::set_factory(NULL);
EXPECT_TRUE(auth.HasPendingFetch());
auth.OnURLFetchComplete(
NULL,
@@ -510,13 +498,11 @@ TEST_F(GaiaAuthFetcherTest, TokenAuthSuccess) {
TestingProfile profile;
TestURLFetcherFactory factory;
- URLFetcher::set_factory(&factory);
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
auth.StartTokenAuth("myubertoken");
- URLFetcher::set_factory(NULL);
EXPECT_TRUE(auth.HasPendingFetch());
auth.OnURLFetchComplete(
NULL,
@@ -535,13 +521,11 @@ TEST_F(GaiaAuthFetcherTest, TokenAuthUnauthorizedFailure) {
TestingProfile profile;
TestURLFetcherFactory factory;
- URLFetcher::set_factory(&factory);
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
auth.StartTokenAuth("badubertoken");
- URLFetcher::set_factory(NULL);
EXPECT_TRUE(auth.HasPendingFetch());
auth.OnURLFetchComplete(
NULL,
@@ -560,13 +544,11 @@ TEST_F(GaiaAuthFetcherTest, TokenAuthNetFailure) {
TestingProfile profile;
TestURLFetcherFactory factory;
- URLFetcher::set_factory(&factory);
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
auth.StartTokenAuth("badubertoken");
- URLFetcher::set_factory(NULL);
EXPECT_TRUE(auth.HasPendingFetch());
auth.OnURLFetchComplete(
NULL,
« no previous file with comments | « chrome/common/net/gaia/gaia_auth_fetcher_unittest.h ('k') | chrome/common/net/gaia/gaia_oauth_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698