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

Unified Diff: remoting/host/token_validator_factory_impl_unittest.cc

Issue 60923002: [sync] Allow FakeURLFetcher to return an arbitrary URLRequestStatus (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 1 month 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
« no previous file with comments | « net/url_request/test_url_fetcher_factory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/token_validator_factory_impl_unittest.cc
diff --git a/remoting/host/token_validator_factory_impl_unittest.cc b/remoting/host/token_validator_factory_impl_unittest.cc
index 1eb14f717943681809ca8f095c7859dc66076809..873791785544076cd76bd5cd2d31eab7a2aea973 100644
--- a/remoting/host/token_validator_factory_impl_unittest.cc
+++ b/remoting/host/token_validator_factory_impl_unittest.cc
@@ -10,6 +10,7 @@
#include "base/values.h"
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
+#include "net/url_request/url_request_status.h"
#include "net/url_request/url_request_test_util.h"
#include "remoting/base/rsa_key_pair.h"
#include "remoting/base/test_rsa_key_pair.h"
@@ -94,8 +95,10 @@ TEST_F(TokenValidatorFactoryImplTest, Success) {
net::FakeURLFetcherFactory factory(NULL);
token_validator_ = token_validator_factory_->CreateTokenValidator(
kLocalJid, kRemoteJid);
- factory.SetFakeResponse(GURL(kTokenValidationUrl), CreateResponse(
- token_validator_->token_scope()), net::HTTP_OK);
+ factory.SetFakeResponse(
+ GURL(kTokenValidationUrl),
+ CreateResponse(token_validator_->token_scope()),
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
token_validator_->ValidateThirdPartyToken(
kToken, base::Bind(&TokenValidatorFactoryImplTest::SuccessCallback,
base::Unretained(this)));
@@ -106,9 +109,9 @@ TEST_F(TokenValidatorFactoryImplTest, BadToken) {
net::FakeURLFetcherFactory factory(NULL);
token_validator_ = token_validator_factory_->CreateTokenValidator(
kLocalJid, kRemoteJid);
- factory.SetFakeResponse(GURL(kTokenValidationUrl),
- std::string(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ factory.SetFakeResponse(GURL(kTokenValidationUrl), std::string(),
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
token_validator_->ValidateThirdPartyToken(
kToken, base::Bind(&TokenValidatorFactoryImplTest::FailureCallback,
base::Unretained(this)));
@@ -120,7 +123,8 @@ TEST_F(TokenValidatorFactoryImplTest, BadScope) {
token_validator_ = token_validator_factory_->CreateTokenValidator(
kLocalJid, kRemoteJid);
factory.SetFakeResponse(
- GURL(kTokenValidationUrl), CreateResponse(kBadScope), net::HTTP_OK);
+ GURL(kTokenValidationUrl), CreateResponse(kBadScope), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
token_validator_->ValidateThirdPartyToken(
kToken, base::Bind(&TokenValidatorFactoryImplTest::FailureCallback,
base::Unretained(this)));
@@ -133,7 +137,8 @@ TEST_F(TokenValidatorFactoryImplTest, DeleteOnFailure) {
kLocalJid, kRemoteJid);
factory.SetFakeResponse(GURL(kTokenValidationUrl),
std::string(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
token_validator_->ValidateThirdPartyToken(
kToken, base::Bind(
&TokenValidatorFactoryImplTest::DeleteOnFailureCallback,
« no previous file with comments | « net/url_request/test_url_fetcher_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698