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

Unified Diff: content/test/content_browser_test_utils_internal.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: Moving FileChooserDelegate into content_browser_test_utils_*internal*.h 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/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
« no previous file with comments | « content/test/content_browser_test_utils_internal.h ('k') | content/test/data/form_that_posts_cross_site.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698