Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: content/public/test/content_browser_test_utils.cc

Issue 2062523002: Fixing renderer's access to a file from HTTP POST (after a xsite transfer). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the new (redundant) access check from RDHI. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698