Commit 2d13d015 authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Fix consumers using net::URLRequestStatus::SUCCESS incorrectly.

URLLoaderInterceptors take net error codes, not URLRequestStatuses
(which is deprecated, and shouldn't be used anywhere).

Both, unfortunately have values of 0.

Bug: 651119
Change-Id: Ic0bc52c1f1c338b18449f2c684ad481f526d72e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1955904Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Reviewed-by: default avatarTim Schumann <tschumann@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723338}
parent f7a5daff
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
#include "content/public/common/previews_state.h" #include "content/public/common/previews_state.h"
#include "content/public/common/resource_type.h" #include "content/public/common/resource_type.h"
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
#include "net/base/net_errors.h"
#include "net/http/http_status_code.h" #include "net/http/http_status_code.h"
#include "net/http/http_util.h" #include "net/http/http_util.h"
#include "net/url_request/url_request_status.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h" #include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h" #include "services/network/test/test_utils.h"
...@@ -135,8 +135,7 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest, ...@@ -135,8 +135,7 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest,
request.resource_type = static_cast<int>(content::ResourceType::kMainFrame); request.resource_type = static_cast<int>(content::ResourceType::kMainFrame);
request.method = "GET"; request.method = "GET";
SetFakeResponse(request.url, "Fake Body", net::HTTP_OK, SetFakeResponse(request.url, "Fake Body", net::HTTP_OK, net::OK);
net::URLRequestStatus::SUCCESS);
request.previews_state = content::PREVIEWS_OFF; request.previews_state = content::PREVIEWS_OFF;
interceptor().MaybeCreateLoader( interceptor().MaybeCreateLoader(
...@@ -165,9 +164,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest, ...@@ -165,9 +164,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest,
request.method = "GET"; request.method = "GET";
SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body", SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body",
net::HTTP_OK, net::URLRequestStatus::SUCCESS); net::HTTP_OK, net::OK);
SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, net::OK);
net::URLRequestStatus::SUCCESS);
request.previews_state = content::LITE_PAGE_REDIRECT_ON; request.previews_state = content::LITE_PAGE_REDIRECT_ON;
interceptor().MaybeCreateLoader( interceptor().MaybeCreateLoader(
...@@ -196,9 +194,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest, ...@@ -196,9 +194,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest,
request.method = "GET"; request.method = "GET";
SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body", SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body",
net::HTTP_OK, net::URLRequestStatus::SUCCESS); net::HTTP_OK, net::OK);
SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, net::ERR_FAILED);
net::URLRequestStatus::FAILED);
request.previews_state = content::LITE_PAGE_REDIRECT_ON; request.previews_state = content::LITE_PAGE_REDIRECT_ON;
interceptor().MaybeCreateLoader( interceptor().MaybeCreateLoader(
...@@ -225,9 +222,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest, ...@@ -225,9 +222,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest,
request.method = "GET"; request.method = "GET";
request.previews_state = content::LITE_PAGE_REDIRECT_ON; request.previews_state = content::LITE_PAGE_REDIRECT_ON;
SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body", SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body",
net::HTTP_TEMPORARY_REDIRECT, net::URLRequestStatus::SUCCESS); net::HTTP_TEMPORARY_REDIRECT, net::OK);
SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, net::OK);
net::URLRequestStatus::SUCCESS);
interceptor().MaybeCreateLoader( interceptor().MaybeCreateLoader(
request, nullptr, request, nullptr,
...@@ -251,10 +247,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest, ...@@ -251,10 +247,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest,
request.method = "GET"; request.method = "GET";
request.previews_state = content::LITE_PAGE_REDIRECT_ON; request.previews_state = content::LITE_PAGE_REDIRECT_ON;
SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body", SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body",
net::HTTP_SERVICE_UNAVAILABLE, net::HTTP_SERVICE_UNAVAILABLE, net::OK);
net::URLRequestStatus::SUCCESS); SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, net::OK);
SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK,
net::URLRequestStatus::SUCCESS);
interceptor().MaybeCreateLoader( interceptor().MaybeCreateLoader(
request, nullptr, request, nullptr,
...@@ -279,9 +273,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest, ...@@ -279,9 +273,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest,
request.method = "GET"; request.method = "GET";
request.previews_state = content::LITE_PAGE_REDIRECT_ON; request.previews_state = content::LITE_PAGE_REDIRECT_ON;
SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body", SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body",
net::HTTP_FORBIDDEN, net::URLRequestStatus::SUCCESS); net::HTTP_FORBIDDEN, net::OK);
SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, net::OK);
net::URLRequestStatus::SUCCESS);
interceptor().MaybeCreateLoader( interceptor().MaybeCreateLoader(
request, nullptr, request, nullptr,
...@@ -305,9 +298,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest, NetStackError) { ...@@ -305,9 +298,8 @@ TEST_F(PreviewsLitePageRedirectURLLoaderInterceptorTest, NetStackError) {
request.method = "GET"; request.method = "GET";
request.previews_state = content::LITE_PAGE_REDIRECT_ON; request.previews_state = content::LITE_PAGE_REDIRECT_ON;
SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body", SetFakeResponse(GetLitePageRedirectURLForURL(request.url), "Fake Body",
net::HTTP_OK, net::URLRequestStatus::FAILED); net::HTTP_OK, net::ERR_FAILED);
SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, SetProbeResponse(request.url.GetOrigin(), net::HTTP_OK, net::OK);
net::URLRequestStatus::SUCCESS);
interceptor().MaybeCreateLoader( interceptor().MaybeCreateLoader(
request, nullptr, request, nullptr,
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_driver_switches.h"
#include "components/sync/driver/sync_token_status.h" #include "components/sync/driver/sync_token_status.h"
#include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/google_service_auth_error.h"
#include "net/base/net_errors.h"
#include "net/http/http_status_code.h" #include "net/http/http_status_code.h"
#include "net/url_request/url_request_status.h"
namespace { namespace {
...@@ -142,9 +142,7 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, Sanity) { ...@@ -142,9 +142,7 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, Sanity) {
ASSERT_TRUE(SetupSync()); ASSERT_TRUE(SetupSync());
GetFakeServer()->ClearHttpError(); GetFakeServer()->ClearHttpError();
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kValidOAuth2Token, SetOAuth2TokenResponse(kValidOAuth2Token, net::HTTP_OK, net::OK);
net::HTTP_OK,
net::URLRequestStatus::SUCCESS);
ASSERT_FALSE(AttemptToTriggerAuthError()); ASSERT_FALSE(AttemptToTriggerAuthError());
} }
...@@ -156,9 +154,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryOnInternalServerError500) { ...@@ -156,9 +154,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryOnInternalServerError500) {
ASSERT_FALSE(AttemptToTriggerAuthError()); ASSERT_FALSE(AttemptToTriggerAuthError());
GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED);
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kValidOAuth2Token, SetOAuth2TokenResponse(kValidOAuth2Token, net::HTTP_INTERNAL_SERVER_ERROR,
net::HTTP_INTERNAL_SERVER_ERROR, net::OK);
net::URLRequestStatus::SUCCESS);
ASSERT_TRUE(AttemptToTriggerAuthError()); ASSERT_TRUE(AttemptToTriggerAuthError());
ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest()); ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest());
} }
...@@ -171,9 +168,7 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryOnHttpForbidden403) { ...@@ -171,9 +168,7 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryOnHttpForbidden403) {
ASSERT_FALSE(AttemptToTriggerAuthError()); ASSERT_FALSE(AttemptToTriggerAuthError());
GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED);
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kEmptyOAuth2Token, SetOAuth2TokenResponse(kEmptyOAuth2Token, net::HTTP_FORBIDDEN, net::OK);
net::HTTP_FORBIDDEN,
net::URLRequestStatus::SUCCESS);
ASSERT_TRUE(AttemptToTriggerAuthError()); ASSERT_TRUE(AttemptToTriggerAuthError());
ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest()); ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest());
} }
...@@ -185,9 +180,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryOnRequestFailed) { ...@@ -185,9 +180,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryOnRequestFailed) {
ASSERT_FALSE(AttemptToTriggerAuthError()); ASSERT_FALSE(AttemptToTriggerAuthError());
GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED);
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kEmptyOAuth2Token, SetOAuth2TokenResponse(kEmptyOAuth2Token, net::HTTP_INTERNAL_SERVER_ERROR,
net::HTTP_INTERNAL_SERVER_ERROR, net::ERR_FAILED);
net::URLRequestStatus::FAILED);
ASSERT_TRUE(AttemptToTriggerAuthError()); ASSERT_TRUE(AttemptToTriggerAuthError());
ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest()); ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest());
} }
...@@ -199,9 +193,7 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryOnMalformedToken) { ...@@ -199,9 +193,7 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryOnMalformedToken) {
ASSERT_FALSE(AttemptToTriggerAuthError()); ASSERT_FALSE(AttemptToTriggerAuthError());
GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED);
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kMalformedOAuth2Token, SetOAuth2TokenResponse(kMalformedOAuth2Token, net::HTTP_OK, net::OK);
net::HTTP_OK,
net::URLRequestStatus::SUCCESS);
ASSERT_TRUE(AttemptToTriggerAuthError()); ASSERT_TRUE(AttemptToTriggerAuthError());
ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest()); ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest());
} }
...@@ -214,9 +206,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, InvalidGrant) { ...@@ -214,9 +206,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, InvalidGrant) {
ASSERT_FALSE(AttemptToTriggerAuthError()); ASSERT_FALSE(AttemptToTriggerAuthError());
GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED);
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kInvalidGrantOAuth2Token, SetOAuth2TokenResponse(kInvalidGrantOAuth2Token, net::HTTP_BAD_REQUEST,
net::HTTP_BAD_REQUEST, net::OK);
net::URLRequestStatus::SUCCESS);
ASSERT_TRUE(AttemptToTriggerAuthError()); ASSERT_TRUE(AttemptToTriggerAuthError());
ASSERT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, ASSERT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS,
GetSyncService(0)->GetAuthError().state()); GetSyncService(0)->GetAuthError().state());
...@@ -230,9 +221,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryInvalidClient) { ...@@ -230,9 +221,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryInvalidClient) {
ASSERT_FALSE(AttemptToTriggerAuthError()); ASSERT_FALSE(AttemptToTriggerAuthError());
GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED);
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kInvalidClientOAuth2Token, SetOAuth2TokenResponse(kInvalidClientOAuth2Token, net::HTTP_BAD_REQUEST,
net::HTTP_BAD_REQUEST, net::OK);
net::URLRequestStatus::SUCCESS);
ASSERT_TRUE(AttemptToTriggerAuthError()); ASSERT_TRUE(AttemptToTriggerAuthError());
ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest()); ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest());
} }
...@@ -245,9 +235,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryRequestCanceled) { ...@@ -245,9 +235,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryRequestCanceled) {
ASSERT_FALSE(AttemptToTriggerAuthError()); ASSERT_FALSE(AttemptToTriggerAuthError());
GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED);
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kEmptyOAuth2Token, SetOAuth2TokenResponse(kEmptyOAuth2Token, net::HTTP_INTERNAL_SERVER_ERROR,
net::HTTP_INTERNAL_SERVER_ERROR, net::ERR_ABORTED);
net::URLRequestStatus::CANCELED);
ASSERT_TRUE(AttemptToTriggerAuthError()); ASSERT_TRUE(AttemptToTriggerAuthError());
ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest()); ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest());
} }
...@@ -260,9 +249,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, FailInitialSetupWithPersistentError) { ...@@ -260,9 +249,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, FailInitialSetupWithPersistentError) {
ASSERT_TRUE(SetupClients()); ASSERT_TRUE(SetupClients());
GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED);
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kInvalidGrantOAuth2Token, SetOAuth2TokenResponse(kInvalidGrantOAuth2Token, net::HTTP_BAD_REQUEST,
net::HTTP_BAD_REQUEST, net::OK);
net::URLRequestStatus::SUCCESS);
ASSERT_FALSE(GetClient(0)->SetupSync()); ASSERT_FALSE(GetClient(0)->SetupSync());
ASSERT_FALSE(GetSyncService(0)->IsSyncFeatureActive()); ASSERT_FALSE(GetSyncService(0)->IsSyncFeatureActive());
ASSERT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, ASSERT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS,
...@@ -277,9 +265,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryInitialSetupWithTransientError) { ...@@ -277,9 +265,8 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, RetryInitialSetupWithTransientError) {
ASSERT_TRUE(SetupClients()); ASSERT_TRUE(SetupClients());
GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED);
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kEmptyOAuth2Token, SetOAuth2TokenResponse(kEmptyOAuth2Token, net::HTTP_INTERNAL_SERVER_ERROR,
net::HTTP_INTERNAL_SERVER_ERROR, net::OK);
net::URLRequestStatus::SUCCESS);
ASSERT_FALSE(GetClient(0)->SetupSync()); ASSERT_FALSE(GetClient(0)->SetupSync());
ASSERT_FALSE(GetSyncService(0)->IsSyncFeatureActive()); ASSERT_FALSE(GetSyncService(0)->IsSyncFeatureActive());
ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest()); ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest());
...@@ -292,9 +279,7 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, DISABLED_TokenExpiry) { ...@@ -292,9 +279,7 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, DISABLED_TokenExpiry) {
ASSERT_TRUE(SetupClients()); ASSERT_TRUE(SetupClients());
GetFakeServer()->ClearHttpError(); GetFakeServer()->ClearHttpError();
DisableTokenFetchRetries(); DisableTokenFetchRetries();
SetOAuth2TokenResponse(kShortLivedOAuth2Token, SetOAuth2TokenResponse(kShortLivedOAuth2Token, net::HTTP_OK, net::OK);
net::HTTP_OK,
net::URLRequestStatus::SUCCESS);
ASSERT_TRUE(GetClient(0)->SetupSync()); ASSERT_TRUE(GetClient(0)->SetupSync());
std::string old_token = GetSyncService(0)->GetAccessTokenForTest(); std::string old_token = GetSyncService(0)->GetAccessTokenForTest();
...@@ -304,17 +289,14 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, DISABLED_TokenExpiry) { ...@@ -304,17 +289,14 @@ IN_PROC_BROWSER_TEST_F(SyncAuthTest, DISABLED_TokenExpiry) {
// Trigger an auth error on the server so PSS requests OA2TS for a new token // Trigger an auth error on the server so PSS requests OA2TS for a new token
// during the next sync cycle. // during the next sync cycle.
GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED);
SetOAuth2TokenResponse(kEmptyOAuth2Token, SetOAuth2TokenResponse(kEmptyOAuth2Token, net::HTTP_INTERNAL_SERVER_ERROR,
net::HTTP_INTERNAL_SERVER_ERROR, net::OK);
net::URLRequestStatus::SUCCESS);
ASSERT_TRUE(AttemptToTriggerAuthError()); ASSERT_TRUE(AttemptToTriggerAuthError());
ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest()); ASSERT_TRUE(GetSyncService(0)->IsRetryingAccessTokenFetchForTest());
// Trigger an auth success state and set up a new valid OAuth2 token. // Trigger an auth success state and set up a new valid OAuth2 token.
GetFakeServer()->ClearHttpError(); GetFakeServer()->ClearHttpError();
SetOAuth2TokenResponse(kValidOAuth2Token, SetOAuth2TokenResponse(kValidOAuth2Token, net::HTTP_OK, net::OK);
net::HTTP_OK,
net::URLRequestStatus::SUCCESS);
// Verify that the next sync cycle is successful, and uses the new auth token. // Verify that the next sync cycle is successful, and uses the new auth token.
ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait());
......
...@@ -1061,8 +1061,8 @@ void SyncTest::SetupMockGaiaResponses() { ...@@ -1061,8 +1061,8 @@ void SyncTest::SetupMockGaiaResponses() {
void SyncTest::SetOAuth2TokenResponse(const std::string& response_data, void SyncTest::SetOAuth2TokenResponse(const std::string& response_data,
net::HttpStatusCode status_code, net::HttpStatusCode status_code,
net::URLRequestStatus::Status status) { net::Error net_error) {
network::URLLoaderCompletionStatus completion_status(status); network::URLLoaderCompletionStatus completion_status(net_error);
completion_status.decoded_body_length = response_data.size(); completion_status.decoded_body_length = response_data.size();
std::string response = base::StringPrintf("HTTP/1.1 %d %s\r\n", status_code, std::string response = base::StringPrintf("HTTP/1.1 %d %s\r\n", status_code,
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
#include "components/sync/base/model_type.h" #include "components/sync/base/model_type.h"
#include "components/sync/base/user_selectable_type.h" #include "components/sync/base/user_selectable_type.h"
#include "components/sync/test/fake_server/fake_server.h" #include "components/sync/test/fake_server/fake_server.h"
#include "net/base/net_errors.h"
#include "net/http/http_status_code.h" #include "net/http/http_status_code.h"
#include "net/url_request/url_request_status.h"
#include "services/network/test/test_url_loader_factory.h" #include "services/network/test/test_url_loader_factory.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -257,7 +257,7 @@ class SyncTest : public InProcessBrowserTest { ...@@ -257,7 +257,7 @@ class SyncTest : public InProcessBrowserTest {
// Each call to this method will overwrite responses that were previously set. // Each call to this method will overwrite responses that were previously set.
void SetOAuth2TokenResponse(const std::string& response_data, void SetOAuth2TokenResponse(const std::string& response_data,
net::HttpStatusCode response_code, net::HttpStatusCode response_code,
net::URLRequestStatus::Status status); net::Error net_error);
// Triggers a migration for one or more datatypes, and waits // Triggers a migration for one or more datatypes, and waits
// for the server to complete it. This operation is available // for the server to complete it. This operation is available
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment