// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_SHELL_DIALOGS_FAKE_SELECT_FILE_DIALOG_H_ #define UI_SHELL_DIALOGS_FAKE_SELECT_FILE_DIALOG_H_ #include <string> #include <string_view> #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "ui/shell_dialogs/select_file_dialog.h" #include "ui/shell_dialogs/select_file_dialog_factory.h" #include "ui/shell_dialogs/shell_dialogs_export.h" namespace ui { // A test fake SelectFileDialog. Usage: // // FakeSelectFileDialog::Factory* factory = // FakeSelectFileDialog::RegisterFactory(); // factory->SetOpenCallback(open_callback); // // Now calls to SelectFileDialog::Create() will create a |FakeSelectFileDialog|, // and open_callback is invoked when the dialog is opened. // // Once the dialog is opened, use factory->GetLastDialog() to access the dialog // to query file information and select a file. class FakeSelectFileDialog : public SelectFileDialog { … }; } // namespace ui #endif // UI_SHELL_DIALOGS_FAKE_SELECT_FILE_DIALOG_H_