chromium/chrome/browser/webid/federated_identity_account_keyed_permission_context_unittest.cc

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

#include "chrome/browser/webid/federated_identity_account_keyed_permission_context.h"

#include <memory>

#include "base/functional/callback_helpers.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_future.h"
#include "chrome/test/base/testing_profile.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/content_settings/core/common/content_settings_utils.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_task_environment.h"
#include "net/base/schemeful_site.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features_generated.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace {

constexpr char kTestIdpOriginKey[] =;

ElementsAre;
IsEmpty;
}

class FederatedIdentityAccountKeyedPermissionContextTest
    : public testing::Test {};

// Test that the key is identical reglardless of whether the permission was
// stored using the old format (prior to the relying-party-embedder key being
// added) or the new format.
TEST_F(FederatedIdentityAccountKeyedPermissionContextTest,
       VerifyKeyRequesterAndEmbedderIdentical) {}

// Test a URL with a '<' character, which is used as a separator in
// FederatedIdentityAccountKeyedPermissionContext::GetKeyForObject().
TEST_F(FederatedIdentityAccountKeyedPermissionContextTest, VerifyKeySeparator) {}

// Test calling
// FederatedIdentityAccountKeyedPermissionContextTest::HasPermission() for
// permissions stored with the pre-relying-party-embedder-format.
TEST_F(FederatedIdentityAccountKeyedPermissionContextTest,
       CompatibleWithOldFormat) {}

namespace {

struct PermissionGrant {};

}  // anonymous namespace

void TestGrantAndRevoke(FederatedIdentityAccountKeyedPermissionContext* context,
                        const PermissionGrant& grant1,
                        const PermissionGrant& grant2) {}

// Test granting and revoking a permission.
TEST_F(FederatedIdentityAccountKeyedPermissionContextTest, GrantAndRevoke) {}

// Test that granting a permission for an account, if the permission has already
// been granted, is a noop, except for the timestamps.
TEST_F(FederatedIdentityAccountKeyedPermissionContextTest,
       GrantPermissionForSameAccount) {}

// Test that FederatedIdentityAccountKeyedPermissionContext can recover from
// crbug.com/1381130
TEST_F(FederatedIdentityAccountKeyedPermissionContextTest, RecoverFrom1381130) {}

TEST_F(FederatedIdentityAccountKeyedPermissionContextTest,
       HasPermission_SchemefulSite) {}

TEST_F(FederatedIdentityAccountKeyedPermissionContextTest, RevokeNoMatch) {}

TEST_F(FederatedIdentityAccountKeyedPermissionContextTest,
       GetSharingPermissionGrantsAsContentSettings_FeatureDisabled) {}

TEST_F(FederatedIdentityAccountKeyedPermissionContextTest,
       GetSharingPermissionGrantsAsContentSettings_FeatureEnabled) {}

TEST_F(FederatedIdentityAccountKeyedPermissionContextTest,
       PermissionWithAndWithoutTimestamp) {}