#include "chrome/browser/enterprise/data_protection/data_protection_clipboard_utils.h"
#include "base/test/bind.h"
#include "base/test/test_future.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/enterprise/data_controls/core/browser/features.h"
#include "components/enterprise/data_controls/core/browser/test_utils.h"
#include "content/public/browser/clipboard_types.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/clipboard/clipboard_monitor.h"
#include "ui/base/clipboard/test/test_clipboard.h"
#include "ui/base/data_transfer_policy/data_transfer_policy_controller.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image_unittest_util.h"
#include "ui/gfx/skia_util.h"
namespace enterprise_data_protection {
namespace {
class PolicyControllerTest : public ui::DataTransferPolicyController { … };
content::ClipboardMetadata CopyMetadata() { … }
content::ClipboardPasteData MakeClipboardPasteData(
std::string text,
std::string image,
std::vector<base::FilePath> file_paths) { … }
class DataProtectionClipboardTest : public testing::Test { … };
DataProtectionPasteIfAllowedByPolicyTest;
DataProtectionIsClipboardCopyAllowedByPolicyTest;
}
TEST_F(DataProtectionPasteIfAllowedByPolicyTest,
DataTransferPolicyController_NoController) { … }
TEST_F(DataProtectionPasteIfAllowedByPolicyTest,
DataTransferPolicyController_Allowed) { … }
TEST_F(DataProtectionPasteIfAllowedByPolicyTest,
DataTransferPolicyController_Blocked) { … }
TEST_F(DataProtectionPasteIfAllowedByPolicyTest,
DataProtectionPaste_NoDestinationWebContents) { … }
TEST_F(DataProtectionIsClipboardCopyAllowedByPolicyTest, Default) { … }
TEST_F(DataProtectionIsClipboardCopyAllowedByPolicyTest, StringReplacement) { … }
TEST_F(DataProtectionIsClipboardCopyAllowedByPolicyTest,
StringReplacement_NoBrowserContextSource) { … }
TEST_F(DataProtectionIsClipboardCopyAllowedByPolicyTest,
StringReplacement_MultiType) { … }
TEST_F(DataProtectionIsClipboardCopyAllowedByPolicyTest, NoStringReplacement) { … }
TEST_F(DataProtectionIsClipboardCopyAllowedByPolicyTest, BitmapReplacement) { … }
}