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

Unified Diff: content/test/content_browser_test_utils_internal.h

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
« no previous file with comments | « content/common/resource_request_body_impl.cc ('k') | content/test/content_browser_test_utils_internal.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/content_browser_test_utils_internal.h
diff --git a/content/test/content_browser_test_utils_internal.h b/content/test/content_browser_test_utils_internal.h
index 75965383bdc9ca68935c73ac83b9e872be92753a..64b18e4517c23e3aa1a3b14649a9801f731317a7 100644
--- a/content/test/content_browser_test_utils_internal.h
+++ b/content/test/content_browser_test_utils_internal.h
@@ -13,11 +13,13 @@
#include <string>
#include <vector>
+#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "cc/surfaces/surface_id.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/resource_dispatcher_host_delegate.h"
+#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "url/gurl.h"
@@ -29,6 +31,7 @@ namespace content {
class FrameTreeNode;
class MessageLoopRunner;
+class RenderFrameHost;
class RenderWidgetHostViewChildFrame;
class Shell;
class SiteInstance;
@@ -175,6 +178,25 @@ class SurfaceHitTestReadyNotifier {
DISALLOW_COPY_AND_ASSIGN(SurfaceHitTestReadyNotifier);
};
+// Helper for mocking choosing a file via a file dialog.
+class FileChooserDelegate : public WebContentsDelegate {
+ public:
+ // Constructs a WebContentsDelegate that mocks a file dialog.
+ // The mocked file dialog will always reply that the user selected |file|.
+ FileChooserDelegate(const base::FilePath& file);
+
+ // Implementation of WebContentsDelegate::RunFileChooser.
+ void RunFileChooser(RenderFrameHost* render_frame_host,
+ const FileChooserParams& params) override;
+
+ // Whether the file dialog was shown.
+ bool file_chosen() { return file_chosen_; }
+
+ private:
+ base::FilePath file_;
+ bool file_chosen_;
+};
+
} // namespace content
#endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_
« no previous file with comments | « content/common/resource_request_body_impl.cc ('k') | content/test/content_browser_test_utils_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698