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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/test/content_browser_test_utils.h" 5 #include "content/public/test/content_browser_test_utils.h"
6 6
7 #include <vector>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "base/path_service.h" 11 #include "base/path_service.h"
10 #include "base/run_loop.h" 12 #include "base/run_loop.h"
11 #include "base/strings/pattern.h" 13 #include "base/strings/pattern.h"
12 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
13 #include "content/public/browser/navigation_controller.h" 15 #include "content/public/browser/navigation_controller.h"
14 #include "content/public/browser/notification_source.h" 16 #include "content/public/browser/notification_source.h"
17 #include "content/public/browser/render_frame_host.h"
15 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
16 #include "content/public/common/content_paths.h" 19 #include "content/public/common/content_paths.h"
20 #include "content/public/common/file_chooser_file_info.h"
21 #include "content/public/common/file_chooser_params.h"
17 #include "content/public/test/browser_test_utils.h" 22 #include "content/public/test/browser_test_utils.h"
18 #include "content/public/test/test_navigation_observer.h" 23 #include "content/public/test/test_navigation_observer.h"
19 #include "content/public/test/test_utils.h" 24 #include "content/public/test/test_utils.h"
20 #include "content/shell/browser/shell.h" 25 #include "content/shell/browser/shell.h"
21 #include "content/shell/browser/shell_javascript_dialog_manager.h" 26 #include "content/shell/browser/shell_javascript_dialog_manager.h"
22 #include "net/base/filename_util.h" 27 #include "net/base/filename_util.h"
23 28
24 namespace content { 29 namespace content {
25 30
26 base::FilePath GetTestFilePath(const char* dir, const char* file) { 31 base::FilePath GetTestFilePath(const char* dir, const char* file) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 DCHECK(source == web_contents_); 159 DCHECK(source == web_contents_);
155 160
156 std::string ascii_message = base::UTF16ToASCII(message); 161 std::string ascii_message = base::UTF16ToASCII(message);
157 if (base::MatchPattern(ascii_message, filter_)) { 162 if (base::MatchPattern(ascii_message, filter_)) {
158 message_ = ascii_message; 163 message_ = ascii_message;
159 message_loop_runner_->Quit(); 164 message_loop_runner_->Quit();
160 } 165 }
161 return false; 166 return false;
162 } 167 }
163 168
169 FileChooserDelegate::FileChooserDelegate(const base::FilePath& file)
170 : file_(file), file_chosen_(false) {}
171
172 void FileChooserDelegate::RunFileChooser(RenderFrameHost* render_frame_host,
173 const FileChooserParams& params) {
174 // Send the selected file to the renderer process.
175 FileChooserFileInfo file_info;
176 file_info.file_path = file_;
177 std::vector<FileChooserFileInfo> files;
178 files.push_back(file_info);
179 render_frame_host->FilesSelectedInChooser(files, FileChooserParams::Open);
180
181 file_chosen_ = true;
182 }
183
164 } // namespace content 184 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698