OLD | NEW |
---|---|
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 #ifndef CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
6 #define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_path.h" | |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "content/public/browser/web_contents_delegate.h" | 12 #include "content/public/browser/web_contents_delegate.h" |
12 #include "content/public/common/page_type.h" | 13 #include "content/public/common/page_type.h" |
13 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class FilePath; | 18 class FilePath; |
18 } | 19 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 WebContents* web_contents_; | 129 WebContents* web_contents_; |
129 std::string filter_; | 130 std::string filter_; |
130 std::string message_; | 131 std::string message_; |
131 | 132 |
132 // The MessageLoopRunner used to spin the message loop. | 133 // The MessageLoopRunner used to spin the message loop. |
133 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 134 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
134 | 135 |
135 DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate); | 136 DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate); |
136 }; | 137 }; |
137 | 138 |
139 // Helper for mocking choosing a file via a file dialog. | |
140 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.
| |
141 public: | |
142 // Constructs a WebContentsDelegate that mocks a file dialog. | |
143 // The mocked file dialog will always reply that the user selected |file|. | |
144 FileChooserDelegate(const base::FilePath& file); | |
145 | |
146 // Implementation of WebContentsDelegate::RunFileChooser. | |
147 void RunFileChooser(RenderFrameHost* render_frame_host, | |
148 const FileChooserParams& params) override; | |
149 | |
150 // Whether the file dialog was shown. | |
151 bool file_chosen() { return file_chosen_; } | |
152 | |
153 private: | |
154 base::FilePath file_; | |
155 bool file_chosen_; | |
156 }; | |
157 | |
138 #if defined OS_MACOSX | 158 #if defined OS_MACOSX |
139 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); | 159 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); |
140 #endif | 160 #endif |
141 | 161 |
142 } // namespace content | 162 } // namespace content |
143 | 163 |
144 #endif // CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ | 164 #endif // CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
OLD | NEW |