| OLD | NEW |
| 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" | |
| 17 #include "base/macros.h" | 16 #include "base/macros.h" |
| 18 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 19 #include "cc/surfaces/surface_id.h" | 18 #include "cc/surfaces/surface_id.h" |
| 20 #include "content/public/browser/navigation_handle.h" | 19 #include "content/public/browser/navigation_handle.h" |
| 21 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 20 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
| 22 #include "content/public/browser/web_contents_delegate.h" | |
| 23 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
| 24 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 25 | 23 |
| 26 namespace cc { | 24 namespace cc { |
| 27 class SurfaceManager; | 25 class SurfaceManager; |
| 28 } | 26 } |
| 29 | 27 |
| 30 namespace content { | 28 namespace content { |
| 31 | 29 |
| 32 class FrameTreeNode; | 30 class FrameTreeNode; |
| 33 class MessageLoopRunner; | 31 class MessageLoopRunner; |
| 34 class RenderFrameHost; | |
| 35 class RenderWidgetHostViewChildFrame; | 32 class RenderWidgetHostViewChildFrame; |
| 36 class Shell; | 33 class Shell; |
| 37 class SiteInstance; | 34 class SiteInstance; |
| 38 class ToRenderFrameHost; | 35 class ToRenderFrameHost; |
| 39 | 36 |
| 40 // Navigates the frame represented by |node| to |url|, blocking until the | 37 // Navigates the frame represented by |node| to |url|, blocking until the |
| 41 // navigation finishes. | 38 // navigation finishes. |
| 42 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url); | 39 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url); |
| 43 | 40 |
| 44 // Sets the DialogManager to proceed by default or not when showing a | 41 // Sets the DialogManager to proceed by default or not when showing a |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 private: | 168 private: |
| 172 bool ContainsSurfaceId(cc::SurfaceId container_surface_id); | 169 bool ContainsSurfaceId(cc::SurfaceId container_surface_id); |
| 173 | 170 |
| 174 cc::SurfaceManager* surface_manager_; | 171 cc::SurfaceManager* surface_manager_; |
| 175 cc::SurfaceId root_surface_id_; | 172 cc::SurfaceId root_surface_id_; |
| 176 RenderWidgetHostViewChildFrame* target_view_; | 173 RenderWidgetHostViewChildFrame* target_view_; |
| 177 | 174 |
| 178 DISALLOW_COPY_AND_ASSIGN(SurfaceHitTestReadyNotifier); | 175 DISALLOW_COPY_AND_ASSIGN(SurfaceHitTestReadyNotifier); |
| 179 }; | 176 }; |
| 180 | 177 |
| 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 | |
| 200 } // namespace content | 178 } // namespace content |
| 201 | 179 |
| 202 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ | 180 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ |
| OLD | NEW |