chromium/google_apis/gaia/gaia_oauth_client_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 GaiaOAuthClient.

#include <string>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/task_environment.h"
#include "base/time/tick_clock.h"
#include "base/values.h"
#include "google_apis/gaia/gaia_oauth_client.h"
#include "net/base/net_errors.h"
#include "net/http/http_request_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/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

_;
Eq;
HasSubstr;
Pointee;
SaveArg;

namespace {

// Simulates some number of failures, followed by an optional success.
// Does not distinguish between different URLs.
class ResponseInjector {};

const std::string kTestAccessToken =;
const std::string kTestAccessTokenHandle =;
const std::string kTestRefreshToken =;
const std::string kTestUserEmail =;
const std::string kTestUserId =;
const int kTestExpiresIn =;

const std::string kDummyGetTokensResult =;

const std::string kDummyRefreshTokenResult =;

const std::string kDummyUserInfoResult =;

const std::string kDummyUserIdResult =;

const std::string kDummyFullUserInfoResult =;

const std::string kDummyTokenInfoResult =;

const std::string kDummyTokenHandleInfoResult =;

const std::string kDummyAccountCapabilitiesResult =;

}  // namespace

namespace gaia {

class MockGaiaOAuthClientDelegate : public gaia::GaiaOAuthClient::Delegate {};

class GaiaOAuthClientTest : public testing::Test {};

TEST_F(GaiaOAuthClientTest, NetworkFailure) {}

TEST_F(GaiaOAuthClientTest, NetworkFailureRecover) {}

TEST_F(GaiaOAuthClientTest, NetworkFailureRecoverBackoff) {}

TEST_F(GaiaOAuthClientTest, OAuthFailure) {}


TEST_F(GaiaOAuthClientTest, GetTokensSuccess) {}

TEST_F(GaiaOAuthClientTest, GetTokensAfterNetworkFailure) {}

TEST_F(GaiaOAuthClientTest, RefreshTokenSuccess) {}

TEST_F(GaiaOAuthClientTest, RefreshTokenDownscopingSuccess) {}

TEST_F(GaiaOAuthClientTest, GetUserEmail) {}

TEST_F(GaiaOAuthClientTest, GetUserId) {}

TEST_F(GaiaOAuthClientTest, GetUserInfo) {}

TEST_F(GaiaOAuthClientTest, GetTokenInfo) {}

TEST_F(GaiaOAuthClientTest, GetTokenHandleInfo) {}

TEST_F(GaiaOAuthClientTest, GetAccountCapabilities) {}

TEST_F(GaiaOAuthClientTest,
       GetAccountCapabilities_UploadData_OneCapabilityName) {}

TEST_F(GaiaOAuthClientTest,
       GetAccountCapabilities_UploadData_MultipleCapabilityNames) {}

}  // namespace gaia