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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ 5 #ifndef CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_
6 #define CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ 6 #define CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_
7 7
8 // A collection of functions designed for use with content_shell based browser 8 // A collection of functions designed for use with content_shell based browser
9 // tests internal to the content/ module. 9 // tests internal to the content/ module.
10 // Note: If a function here also works with browser_tests, it should be in 10 // Note: If a function here also works with browser_tests, it should be in
11 // the content public API. 11 // the content public API.
12 12
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/files/file_path.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
18 #include "cc/surfaces/surface_id.h" 19 #include "cc/surfaces/surface_id.h"
19 #include "content/public/browser/navigation_handle.h" 20 #include "content/public/browser/navigation_handle.h"
20 #include "content/public/browser/resource_dispatcher_host_delegate.h" 21 #include "content/public/browser/resource_dispatcher_host_delegate.h"
22 #include "content/public/browser/web_contents_delegate.h"
21 #include "content/public/browser/web_contents_observer.h" 23 #include "content/public/browser/web_contents_observer.h"
22 #include "url/gurl.h" 24 #include "url/gurl.h"
23 25
24 namespace cc { 26 namespace cc {
25 class SurfaceManager; 27 class SurfaceManager;
26 } 28 }
27 29
28 namespace content { 30 namespace content {
29 31
30 class FrameTreeNode; 32 class FrameTreeNode;
31 class MessageLoopRunner; 33 class MessageLoopRunner;
34 class RenderFrameHost;
32 class RenderWidgetHostViewChildFrame; 35 class RenderWidgetHostViewChildFrame;
33 class Shell; 36 class Shell;
34 class SiteInstance; 37 class SiteInstance;
35 class ToRenderFrameHost; 38 class ToRenderFrameHost;
36 39
37 // Navigates the frame represented by |node| to |url|, blocking until the 40 // Navigates the frame represented by |node| to |url|, blocking until the
38 // navigation finishes. 41 // navigation finishes.
39 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url); 42 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url);
40 43
41 // Sets the DialogManager to proceed by default or not when showing a 44 // Sets the DialogManager to proceed by default or not when showing a
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 private: 171 private:
169 bool ContainsSurfaceId(cc::SurfaceId container_surface_id); 172 bool ContainsSurfaceId(cc::SurfaceId container_surface_id);
170 173
171 cc::SurfaceManager* surface_manager_; 174 cc::SurfaceManager* surface_manager_;
172 cc::SurfaceId root_surface_id_; 175 cc::SurfaceId root_surface_id_;
173 RenderWidgetHostViewChildFrame* target_view_; 176 RenderWidgetHostViewChildFrame* target_view_;
174 177
175 DISALLOW_COPY_AND_ASSIGN(SurfaceHitTestReadyNotifier); 178 DISALLOW_COPY_AND_ASSIGN(SurfaceHitTestReadyNotifier);
176 }; 179 };
177 180
181 // Helper for mocking choosing a file via a file dialog.
182 class FileChooserDelegate : public WebContentsDelegate {
183 public:
184 // Constructs a WebContentsDelegate that mocks a file dialog.
185 // The mocked file dialog will always reply that the user selected |file|.
186 FileChooserDelegate(const base::FilePath& file);
187
188 // Implementation of WebContentsDelegate::RunFileChooser.
189 void RunFileChooser(RenderFrameHost* render_frame_host,
190 const FileChooserParams& params) override;
191
192 // Whether the file dialog was shown.
193 bool file_chosen() { return file_chosen_; }
194
195 private:
196 base::FilePath file_;
197 bool file_chosen_;
198 };
199
178 } // namespace content 200 } // namespace content
179 201
180 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ 202 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_
OLDNEW
« 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