Chromium Code Reviews| Index: content/public/test/content_browser_test_utils.h |
| diff --git a/content/public/test/content_browser_test_utils.h b/content/public/test/content_browser_test_utils.h |
| index e198b1ed4f74b64c7951f099942f55304a68dcbf..25d5a88106105be4e94130d0c0d4039857d4cc3d 100644 |
| --- a/content/public/test/content_browser_test_utils.h |
| +++ b/content/public/test/content_browser_test_utils.h |
| @@ -6,6 +6,7 @@ |
| #define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
| #include "base/callback.h" |
| +#include "base/files/file_path.h" |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| #include "content/public/browser/web_contents_delegate.h" |
| @@ -135,6 +136,25 @@ class ConsoleObserverDelegate : public WebContentsDelegate { |
| DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate); |
| }; |
| +// Helper for mocking choosing a file via a file dialog. |
| +class FileChooserDelegate : public WebContentsDelegate { |
|
Charlie Reis
2016/06/17 07:13:36
This should probably go in content_browser_test_ut
Łukasz Anforowicz
2016/06/17 16:44:47
Done.
|
| + 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_; |
| +}; |
| + |
| #if defined OS_MACOSX |
| void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); |
| #endif |