chromium/extensions/browser/permissions_manager_unittest.cc

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

#include "extensions/browser/permissions_manager.h"
#include "base/memory/raw_ptr.h"
#include "base/test/gtest_util.h"
#include "base/test/scoped_feature_list.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/extensions_test.h"
#include "extensions/browser/pref_types.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/url_pattern_set.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"

namespace {

std::unique_ptr<KeyedService> SetTestingPermissionsManager(
    content::BrowserContext* browser_context) {}

}  // namespace

namespace extensions {

UserSiteSetting;
UserSiteAccess;

class PermissionsManagerUnittest : public ExtensionsTest {};

void PermissionsManagerUnittest::SetUp() {}

scoped_refptr<const Extension> PermissionsManagerUnittest::AddExtension(
    const std::string& name) {}

scoped_refptr<const Extension>
PermissionsManagerUnittest::AddExtensionWithAPIPermission(
    const std::string& name,
    const std::string& permission,
    extensions::mojom::ManifestLocation location) {}

scoped_refptr<const Extension>
PermissionsManagerUnittest::AddExtensionWithHostPermission(
    const std::string& name,
    const std::string& host_permission) {}

scoped_refptr<const Extension>
PermissionsManagerUnittest::AddExtensionWithActiveTab(
    const std::string& name,
    extensions::mojom::ManifestLocation location) {}

const base::Value* PermissionsManagerUnittest::GetRestrictedSitesFromPrefs() {}

const base::Value* PermissionsManagerUnittest::GetPermittedSitesFromPrefs() {}

std::set<url::Origin>
PermissionsManagerUnittest::GetRestrictedSitesFromManager() {}

std::set<url::Origin>
PermissionsManagerUnittest::GetPermittedSitesFromManager() {}

std::set<std::string>
PermissionsManagerUnittest::GetRestrictedSitesFromPermissionsData() {}

std::set<std::string>
PermissionsManagerUnittest::GetPermittedSitesFromPermissionsData() {}

TEST_F(PermissionsManagerUnittest, AddAndRemoveRestrictedSite) {}

TEST_F(PermissionsManagerUnittest, AddAndRemovePermittedSite) {}

TEST_F(PermissionsManagerUnittest, UpdateUserSiteSetting) {}

TEST_F(PermissionsManagerUnittest, GetSiteAccess_AllUrls) {}

TEST_F(PermissionsManagerUnittest, GetSiteAccess_RequestedUrl) {}

// Tests that for the purposes of displaying an extension's site access to the
// user (or granting/revoking permissions), we ignore paths in the URL. We
// always strip the path from host permissions directly, but we don't strip the
// path from content scripts.
TEST_F(PermissionsManagerUnittest,
       GetSiteAccess_ContentScript_RequestedUrlWithPath) {}

TEST_F(PermissionsManagerUnittest, GetSiteAccess_ActiveTab) {}

TEST_F(PermissionsManagerUnittest, GetSiteAccess_NoHostPermissions) {}

TEST_F(PermissionsManagerUnittest, CanAffectExtension_ByLocation) {}

TEST_F(PermissionsManagerUnittest, CanUserSelectSiteAccess_AllUrls) {}

TEST_F(PermissionsManagerUnittest, CanUserSelectSiteAccess_SpecificUrl) {}

TEST_F(PermissionsManagerUnittest, CanUserSelectSiteAccess_NoHostPermissions) {}

TEST_F(PermissionsManagerUnittest, CanUserSelectSiteAccess_ActiveTab) {}

TEST_F(PermissionsManagerUnittest, HasActiveTabAndCanAccess_PolicyUrl) {}

TEST_F(PermissionsManagerUnittest,
       ExtensionRequestsHostPermissionsOrActiveTab) {}

class PermissionsManagerWithPermittedSitesUnitTest
    : public PermissionsManagerUnittest {};

PermissionsManagerWithPermittedSitesUnitTest::
    PermissionsManagerWithPermittedSitesUnitTest() {}

TEST_F(PermissionsManagerWithPermittedSitesUnitTest,
       AddAndRemovePermittedSite) {}

TEST_F(PermissionsManagerWithPermittedSitesUnitTest, GrantAllExtensionsAccess) {}

TEST_F(PermissionsManagerWithPermittedSitesUnitTest,
       RestrictedAndPermittedSitesAreMutuallyExclusive) {}

}  // namespace extensions