Index: content/public/test/content_browser_test_utils.cc |
diff --git a/content/public/test/content_browser_test_utils.cc b/content/public/test/content_browser_test_utils.cc |
index b77a2724d31722b87715645e4307b8cb69094134..de48a19a4368fe27cfe1a23874dfcf751d468adb 100644 |
--- a/content/public/test/content_browser_test_utils.cc |
+++ b/content/public/test/content_browser_test_utils.cc |
@@ -4,6 +4,8 @@ |
#include "content/public/test/content_browser_test_utils.h" |
+#include <vector> |
+ |
#include "base/bind.h" |
#include "base/files/file_path.h" |
#include "base/path_service.h" |
@@ -12,8 +14,11 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "content/public/browser/navigation_controller.h" |
#include "content/public/browser/notification_source.h" |
+#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/common/content_paths.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/test_navigation_observer.h" |
#include "content/public/test/test_utils.h" |
@@ -161,4 +166,19 @@ bool ConsoleObserverDelegate::AddMessageToConsole( |
return false; |
} |
+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 |