Index: content/test/content_browser_test_utils_internal.cc |
diff --git a/content/test/content_browser_test_utils_internal.cc b/content/test/content_browser_test_utils_internal.cc |
index 408bd75c58b615d690ab1a9627423f49904db13b..4f974b13da9314a27972ce88f167b4c501f90bd6 100644 |
--- a/content/test/content_browser_test_utils_internal.cc |
+++ b/content/test/content_browser_test_utils_internal.cc |
@@ -24,9 +24,12 @@ |
#include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
#include "content/browser/renderer_host/delegated_frame_host.h" |
#include "content/browser/renderer_host/render_widget_host_view_base.h" |
+#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/resource_dispatcher_host.h" |
#include "content/public/browser/resource_throttle.h" |
#include "content/public/browser/web_contents.h" |
+#include "content/public/common/file_chooser_file_info.h" |
+#include "content/public/common/file_chooser_params.h" |
#include "content/public/test/browser_test_utils.h" |
#include "content/public/test/content_browser_test_utils.h" |
#include "content/shell/browser/shell.h" |
@@ -424,4 +427,19 @@ void TestNavigationManager::OnWillStartRequest() { |
loop_runner_->Quit(); |
} |
+FileChooserDelegate::FileChooserDelegate(const base::FilePath& file) |
+ : file_(file), file_chosen_(false) {} |
+ |
+void FileChooserDelegate::RunFileChooser(RenderFrameHost* render_frame_host, |
+ const FileChooserParams& params) { |
+ // Send the selected file to the renderer process. |
+ FileChooserFileInfo file_info; |
+ file_info.file_path = file_; |
+ std::vector<FileChooserFileInfo> files; |
+ files.push_back(file_info); |
+ render_frame_host->FilesSelectedInChooser(files, FileChooserParams::Open); |
+ |
+ file_chosen_ = true; |
+} |
+ |
} // namespace content |