#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "chrome/common/extensions/extension_test_util.h"
#include "chrome/common/webui_url_constants.h"
#include "components/crx_file/id_util.h"
#include "content/public/common/socket_permission_request.h"
#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/extensions_client.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permission_message_test_util.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/permissions/socket_permission.h"
#include "extensions/common/switches.h"
#include "extensions/common/url_pattern_set.h"
#include "extensions/common/user_script.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
UTF16ToUTF8;
SocketPermissionRequest;
LoadManifest;
LoadManifestStrict;
LoadManifestUnchecked;
APIPermissionID;
ManifestLocation;
namespace extensions {
namespace {
const char kAllHostsPermission[] = …;
const char kChromeUntrustedURL[] = …;
GURL GetFaviconURL(const char* path) { … }
bool CheckSocketPermission(scoped_refptr<Extension> extension,
SocketPermissionRequest::OperationType type,
const char* host,
uint16_t port) { … }
scoped_refptr<const Extension> GetExtensionWithHostPermission(
const std::string& id,
const std::string& host_permissions,
ManifestLocation location) { … }
void CheckRestrictedUrls(const Extension* extension,
bool block_chrome_urls,
bool block_chrome_untrusted_urls) { … }
}
TEST(PermissionsDataTest, EffectiveHostPermissions) { … }
TEST(PermissionsDataTest, SocketPermissions) { … }
TEST(PermissionsDataTest, IsRestrictedUrl) { … }
TEST(PermissionsDataTest, GetPermissionMessages_ManyAPIPermissions) { … }
TEST(PermissionsDataTest, GetPermissionMessages_ManyHostsPermissions) { … }
TEST(PermissionsDataTest, GetPermissionMessages_ManyHosts) { … }
TEST(PermissionsDataTest, ExtensionScheme) { … }
class ExtensionScriptAndCaptureVisibleTest : public testing::Test { … };
TEST_F(ExtensionScriptAndCaptureVisibleTest, Permissions) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest, PermissionsWithChromeURLsEnabled) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest, TabSpecific) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest, CaptureChromeURLs) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest, CaptureChromeUntrustedURLs) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest, CaptureFileURLs) { … }
TEST(PermissionsDataTest, ChromeWebstoreUrl) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest, PolicyHostRestrictionsSwap) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest, PolicyHostRestrictions) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest,
UserHostRestrictions_Restrictions) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest,
UserHostRestrictions_ExemptExtensions) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest,
UserHostRestrictions_DontGrantUnrequestedPermissions) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest,
UserHostRestrictions_ForbiddenURLs) { … }
TEST_F(ExtensionScriptAndCaptureVisibleTest,
UserHostRestrictions_FeatureDisabled) { … }
class CaptureVisiblePageTest : public testing::Test { … };
TEST_F(CaptureVisiblePageTest, URLsCapturableWithEitherActiveTabOrAllURLs) { … }
TEST_F(CaptureVisiblePageTest, URLsCapturableOnlyWithActiveTab) { … }
TEST_F(CaptureVisiblePageTest, ChromeUntrustedSchemeNotCaptured) { … }
TEST_F(CaptureVisiblePageTest, SelfExtensionURLs) { … }
TEST_F(CaptureVisiblePageTest, NoPermissions) { … }
TEST_F(CaptureVisiblePageTest, PolicyBlockedURLs) { … }
}