chromium/content/browser/webid/federated_auth_user_info_request_unittest.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/webid/federated_auth_user_info_request.h"

#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>

#include "base/functional/callback_forward.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "content/browser/webid/fedcm_metrics.h"
#include "content/browser/webid/test/mock_api_permission_delegate.h"
#include "content/browser/webid/test/mock_idp_network_request_manager.h"
#include "content/browser/webid/test/mock_permission_delegate.h"
#include "content/public/test/navigation_simulator.h"
#include "content/test/test_render_frame_host.h"
#include "content/test/test_web_contents.h"
#include "net/http/http_status_code.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/webid/federated_auth_request.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"

ApiPermissionStatus;
FetchStatus;
LoginState;
ParseStatus;
RequestUserInfoStatus;
_;
NiceMock;
Return;

namespace content {
namespace {

constexpr char kRpUrl[] =;
constexpr char kPersonalizedButtonFrameUrl[] =;
constexpr char kProviderUrl[] =;
constexpr char kAccountsEndpoint[] =;
constexpr char kTokenEndpoint[] =;
constexpr char kLoginUrl[] =;
constexpr char kClientId[] =;

constexpr char kAccountEmailFormat[] =;
constexpr char kAccountName[] =;
constexpr char kAccountGivenName[] =;
constexpr char kAccountPicture[] =;

struct AccountConfig {};

struct Config {};

Config kValidConfig =;

std::string GenerateEmailForUserId(const std::string& user_id) {}

// Helper class for blocking till RequestUserInfoCallback is called.
class UserInfoCallbackHelper {};

class TestIdpNetworkRequestManager : public MockIdpNetworkRequestManager {};

class TestApiPermissionDelegate : public MockApiPermissionDelegate {};

class TestPermissionDelegate : public MockPermissionDelegate {};

}  // namespace

class FederatedAuthUserInfoRequestTest : public RenderViewHostImplTestHarness {};

TEST_F(FederatedAuthUserInfoRequestTest, PreviouslySignedIn) {}

TEST_F(FederatedAuthUserInfoRequestTest, NoSignedInAccount) {}

TEST_F(FederatedAuthUserInfoRequestTest, NotInApprovedClientsList) {}

TEST_F(FederatedAuthUserInfoRequestTest, InApprovedClientsList) {}

TEST_F(FederatedAuthUserInfoRequestTest,
       NoSharingPermissionButIdpHasThirdPartyCookiesAccessAndClaimsSignin) {}

TEST_F(FederatedAuthUserInfoRequestTest,
       NoSharingPermissionButIdpHasThirdPartyCookiesAccessButNotSignin) {}

TEST_F(FederatedAuthUserInfoRequestTest, ConfigFetchFailed) {}

TEST_F(FederatedAuthUserInfoRequestTest,
       IdpSigninStatusClearedWhenAccountsRequestFails) {}

// Tests that returning accounts are returned first in the user info response.
TEST_F(FederatedAuthUserInfoRequestTest, ReturningAccountsFirst) {}

}  // namespace content