| 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" | 16 #include "base/files/file_path.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "cc/surfaces/surface_id.h" | 19 #include "cc/surfaces/surface_id.h" |
| 20 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 20 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
| 21 #include "content/public/browser/web_contents_delegate.h" | 21 #include "content/public/browser/web_contents_delegate.h" |
| 22 #include "content/public/common/file_chooser_params.h" |
| 22 #include "content/public/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
| 23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 24 | 25 |
| 25 namespace cc { | 26 namespace cc { |
| 26 class SurfaceManager; | 27 class SurfaceManager; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace content { | 30 namespace content { |
| 30 | 31 |
| 31 class FrameTreeNode; | 32 class FrameTreeNode; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 public: | 143 public: |
| 143 // Constructs a WebContentsDelegate that mocks a file dialog. | 144 // Constructs a WebContentsDelegate that mocks a file dialog. |
| 144 // The mocked file dialog will always reply that the user selected |file|. | 145 // The mocked file dialog will always reply that the user selected |file|. |
| 145 FileChooserDelegate(const base::FilePath& file); | 146 FileChooserDelegate(const base::FilePath& file); |
| 146 | 147 |
| 147 // Implementation of WebContentsDelegate::RunFileChooser. | 148 // Implementation of WebContentsDelegate::RunFileChooser. |
| 148 void RunFileChooser(RenderFrameHost* render_frame_host, | 149 void RunFileChooser(RenderFrameHost* render_frame_host, |
| 149 const FileChooserParams& params) override; | 150 const FileChooserParams& params) override; |
| 150 | 151 |
| 151 // Whether the file dialog was shown. | 152 // Whether the file dialog was shown. |
| 152 bool file_chosen() { return file_chosen_; } | 153 bool file_chosen() const { return file_chosen_; } |
| 154 |
| 155 // Copy of the params passed to RunFileChooser. |
| 156 FileChooserParams params() const { return params_; } |
| 153 | 157 |
| 154 private: | 158 private: |
| 155 base::FilePath file_; | 159 base::FilePath file_; |
| 156 bool file_chosen_; | 160 bool file_chosen_; |
| 161 FileChooserParams params_; |
| 157 }; | 162 }; |
| 158 | 163 |
| 159 // This class is a TestNavigationManager that only monitors notifications within | 164 // This class is a TestNavigationManager that only monitors notifications within |
| 160 // the given frame tree node. | 165 // the given frame tree node. |
| 161 class FrameTestNavigationManager : public TestNavigationManager { | 166 class FrameTestNavigationManager : public TestNavigationManager { |
| 162 public: | 167 public: |
| 163 FrameTestNavigationManager(int frame_tree_node_id, | 168 FrameTestNavigationManager(int frame_tree_node_id, |
| 164 WebContents* web_contents, | 169 WebContents* web_contents, |
| 165 const GURL& url); | 170 const GURL& url); |
| 166 | 171 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 195 | 200 |
| 196 // The MessageLoopRunner used to spin the message loop. | 201 // The MessageLoopRunner used to spin the message loop. |
| 197 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 202 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
| 198 | 203 |
| 199 DISALLOW_COPY_AND_ASSIGN(UrlCommitObserver); | 204 DISALLOW_COPY_AND_ASSIGN(UrlCommitObserver); |
| 200 }; | 205 }; |
| 201 | 206 |
| 202 } // namespace content | 207 } // namespace content |
| 203 | 208 |
| 204 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ | 209 #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_ |
| OLD | NEW |