chromium/google_apis/gaia/gaia_auth_fetcher_unittest.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// A complete set of unit tests for GaiaAuthFetcher.
// Originally ported from GoogleAuthenticator tests.
#include "google_apis/gaia/gaia_auth_fetcher.h"

#include <string>
#include <vector>

#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "build/build_config.h"
#include "google_apis/credentials_mode.h"
#include "google_apis/gaia/gaia_auth_consumer.h"
#include "google_apis/gaia/gaia_constants.h"
#include "google_apis/gaia/gaia_urls.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "google_apis/gaia/oauth_multilogin_result.h"
#include "google_apis/google_api_keys.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

Invoke;
_;

namespace {

constexpr char kVersionListHeader[] =;

const char kGetTokenPairValidResponse[] =;

const char kGetTokenPairValidBoundKeyResponse[] =;

std::string GetRequestBodyAsString(const network::ResourceRequest* request) {}

}  // namespace

class GaiaAuthFetcherTest : public testing::Test {};

class MockGaiaConsumer : public GaiaAuthConsumer {};

#if BUILDFLAG(IS_WIN)
#define MAYBE_ErrorComparator
#else
#define MAYBE_ErrorComparator
#endif

TEST_F(GaiaAuthFetcherTest, MAYBE_ErrorComparator) {}

// A version of GaiaAuthFetcher that exposes some of the protected methods.
class TestGaiaAuthFetcher : public GaiaAuthFetcher {};

TEST_F(GaiaAuthFetcherTest, ParseErrorRequest) {}

TEST_F(GaiaAuthFetcherTest, BadAuthenticationError) {}

TEST_F(GaiaAuthFetcherTest, BadAuthenticationShortError) {}

TEST_F(GaiaAuthFetcherTest, IncomprehensibleError) {}

TEST_F(GaiaAuthFetcherTest, ServiceUnavailableError) {}

TEST_F(GaiaAuthFetcherTest, ServiceUnavailableShortError) {}

TEST_F(GaiaAuthFetcherTest, StartAuthCodeForOAuth2TokenExchangeSuccess) {}

TEST_F(GaiaAuthFetcherTest, StartAuthCodeForOAuth2TokenExchangeDeviceId) {}

TEST_F(GaiaAuthFetcherTest,
       StartAuthCodeForOAuth2TokenExchangeBindingRegistrationToken) {}

TEST_F(
    GaiaAuthFetcherTest,
    StartAuthCodeForOAuth2TokenExchangeBindingRegistrationTokenNoVersionHeader) {}

TEST_F(GaiaAuthFetcherTest, StartAuthCodeForOAuth2TokenExchangeFailure) {}

TEST_F(GaiaAuthFetcherTest, MultiloginRequestFormat) {}

TEST_F(GaiaAuthFetcherTest, MultiloginSuccess) {}

TEST_F(GaiaAuthFetcherTest, MultiloginFailureNetError) {}

TEST_F(GaiaAuthFetcherTest, MultiloginFailureServerError) {}

TEST_F(GaiaAuthFetcherTest, ListAccounts) {}

TEST_F(GaiaAuthFetcherTest, LogOutSuccess) {}

TEST_F(GaiaAuthFetcherTest, LogOutFailure) {}

TEST_F(GaiaAuthFetcherTest, GetCheckConnectionInfo) {}

TEST_F(GaiaAuthFetcherTest, RevokeOAuth2TokenSuccess) {}

TEST_F(GaiaAuthFetcherTest, RevokeOAuth2TokenCanceled) {}

TEST_F(GaiaAuthFetcherTest, RevokeOAuth2TokenFailed) {}

TEST_F(GaiaAuthFetcherTest, RevokeOAuth2TokenTimeout) {}

TEST_F(GaiaAuthFetcherTest, RevokeOAuth2TokenInvalidToken) {}

TEST_F(GaiaAuthFetcherTest, RevokeOAuth2TokenInvalidRequest) {}

TEST_F(GaiaAuthFetcherTest, RevokeOAuth2TokenServerError) {}

TEST_F(GaiaAuthFetcherTest, ReAuthTokenSuccess) {}

TEST_F(GaiaAuthFetcherTest, ReAuthTokenInvalidRequest) {}

TEST_F(GaiaAuthFetcherTest, ReAuthTokenInvalidGrant) {}

TEST_F(GaiaAuthFetcherTest, ReAuthTokenUnauthorizedClient) {}

TEST_F(GaiaAuthFetcherTest, ReAuthTokenInsufficientScope) {}

TEST_F(GaiaAuthFetcherTest, ReAuthTokenCredentialNotSet) {}