#include "chrome/browser/enterprise/data_protection/data_protection_clipboard_utils.h"
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/test_future.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/enterprise/connectors/test/deep_scanning_test_utils.h"
#include "chrome/browser/enterprise/data_controls/desktop_data_controls_dialog.h"
#include "chrome/browser/enterprise/data_controls/desktop_data_controls_dialog_test_helper.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/enterprise/data_controls/core/browser/features.h"
#include "components/enterprise/data_controls/core/browser/test_utils.h"
#include "content/public/test/browser_test.h"
#include "ui/views/widget/widget_delegate.h"
namespace enterprise_data_protection {
namespace {
constexpr char kGoogleUrl[] = …;
constexpr char kUserName[] = …;
content::ClipboardPasteData MakeClipboardPasteData(
std::string text,
std::string image,
std::vector<base::FilePath> file_paths) { … }
class DataControlsClipboardUtilsBrowserTest
: public InProcessBrowserTest,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
}
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
PasteAllowed_NoSource) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
PasteAllowed_SameSource) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
PasteBlockedByDataControls_DestinationRule) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
PasteWarnedByDataControls_BypassedDestinationRule) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
PasteWarnedByDataControls_CanceledDestinationRule) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
PasteBlockedByDataControls_SourceRule) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
PasteWarnedByDataControls_BypassedSourceRule) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
PasteWarnedByDataControls_CanceledSourceRule) { … }
#endif
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
PasteReportedByDataControls_DestinationRule) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
PasteReportedByDataControls_SourceRule) { … }
#endif
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest, CopyAllowed) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest, CopyReported) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest, CopyBlocked) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
CopyWarnedThenCanceled) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
CopyWarnedThenCanceled_OsClipboardDestination) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
CopyWarnedThenBypassed) { … }
IN_PROC_BROWSER_TEST_P(DataControlsClipboardUtilsBrowserTest,
CopyWarnedThenBypassed_OsClipboardDestination) { … }
}