#include <string>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/notreached.h"
#include "base/test/test_file_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/policy_constants.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/fake_file_system_access_permission_context.h"
#include "content/public/test/file_system_chooser_test_helpers.h"
#include "net/dns/mock_host_resolver.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/shell_dialogs/select_file_dialog.h"
namespace {
enum class MethodName : int { … };
constexpr char kShowOpenFilePickerScript[] = …;
constexpr char kShowSaveFilePickerScript[] = …;
constexpr char kShowDirectoryPickerScript[] = …;
constexpr char kUserGestureErrorMessage[] = …;
constexpr char kTestServerOrigin[] = …;
constexpr char kOtherOrigin[] = …;
}
class FileSystemAccessPickerRequiresUserGestureTest
: public InProcessBrowserTest,
public testing::WithParamInterface<MethodName> { … };
IN_PROC_BROWSER_TEST_P(FileSystemAccessPickerRequiresUserGestureTest,
SuceedsWithGestureWithoutPolicy) { … }
IN_PROC_BROWSER_TEST_P(FileSystemAccessPickerRequiresUserGestureTest,
FailsWithoutGestureOrPolicy) { … }
IN_PROC_BROWSER_TEST_P(FileSystemAccessPickerRequiresUserGestureTest,
SuceedsWithPolicyWithoutGesture) { … }
IN_PROC_BROWSER_TEST_P(FileSystemAccessPickerRequiresUserGestureTest,
SuceedsWithPolicyAndGesture) { … }
IN_PROC_BROWSER_TEST_P(FileSystemAccessPickerRequiresUserGestureTest,
FailsWithOtherPolicyWithoutGesture) { … }
INSTANTIATE_TEST_SUITE_P(…);