| 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_TEST_RENDERER_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
| 6 #define CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 scoped_ptr<MockRenderProcessHostFactory> rph_factory_; | 142 scoped_ptr<MockRenderProcessHostFactory> rph_factory_; |
| 143 scoped_ptr<TestRenderViewHostFactory> rvh_factory_; | 143 scoped_ptr<TestRenderViewHostFactory> rvh_factory_; |
| 144 scoped_ptr<TestRenderFrameHostFactory> rfh_factory_; | 144 scoped_ptr<TestRenderFrameHostFactory> rfh_factory_; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 // RenderViewHostTestHarness --------------------------------------------------- | 147 // RenderViewHostTestHarness --------------------------------------------------- |
| 148 class RenderViewHostTestHarness : public testing::Test { | 148 class RenderViewHostTestHarness : public testing::Test { |
| 149 public: | 149 public: |
| 150 RenderViewHostTestHarness(); | 150 RenderViewHostTestHarness(); |
| 151 virtual ~RenderViewHostTestHarness(); | 151 ~RenderViewHostTestHarness() override; |
| 152 | 152 |
| 153 NavigationController& controller(); | 153 NavigationController& controller(); |
| 154 | 154 |
| 155 // The contents under test. | 155 // The contents under test. |
| 156 WebContents* web_contents(); | 156 WebContents* web_contents(); |
| 157 | 157 |
| 158 // RVH/RFH getters are shorthand for oft-used bits of web_contents(). | 158 // RVH/RFH getters are shorthand for oft-used bits of web_contents(). |
| 159 | 159 |
| 160 // rvh() is equivalent to either of: | 160 // rvh() is equivalent to either of: |
| 161 // web_contents()->GetMainFrame()->GetRenderViewHost() | 161 // web_contents()->GetMainFrame()->GetRenderViewHost() |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // Cover for |contents()->NavigateAndCommit(url)|. See | 193 // Cover for |contents()->NavigateAndCommit(url)|. See |
| 194 // WebContentsTester::NavigateAndCommit for details. | 194 // WebContentsTester::NavigateAndCommit for details. |
| 195 void NavigateAndCommit(const GURL& url); | 195 void NavigateAndCommit(const GURL& url); |
| 196 | 196 |
| 197 // Simulates a reload of the current page. | 197 // Simulates a reload of the current page. |
| 198 void Reload(); | 198 void Reload(); |
| 199 void FailedReload(); | 199 void FailedReload(); |
| 200 | 200 |
| 201 protected: | 201 protected: |
| 202 // testing::Test | 202 // testing::Test |
| 203 virtual void SetUp() override; | 203 void SetUp() override; |
| 204 virtual void TearDown() override; | 204 void TearDown() override; |
| 205 | 205 |
| 206 // Derived classes should override this method to use a custom BrowserContext. | 206 // Derived classes should override this method to use a custom BrowserContext. |
| 207 // It is invoked by SetUp after threads were started. | 207 // It is invoked by SetUp after threads were started. |
| 208 // RenderViewHostTestHarness will take ownership of the returned | 208 // RenderViewHostTestHarness will take ownership of the returned |
| 209 // BrowserContext. | 209 // BrowserContext. |
| 210 virtual BrowserContext* CreateBrowserContext(); | 210 virtual BrowserContext* CreateBrowserContext(); |
| 211 | 211 |
| 212 // Configures which TestBrowserThreads inside |thread_bundle| are backed by | 212 // Configures which TestBrowserThreads inside |thread_bundle| are backed by |
| 213 // real threads. Must be called before SetUp(). | 213 // real threads. Must be called before SetUp(). |
| 214 void SetThreadBundleOptions(int options) { | 214 void SetThreadBundleOptions(int options) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 239 | 239 |
| 240 int thread_bundle_options_; | 240 int thread_bundle_options_; |
| 241 scoped_ptr<TestBrowserThreadBundle> thread_bundle_; | 241 scoped_ptr<TestBrowserThreadBundle> thread_bundle_; |
| 242 | 242 |
| 243 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); | 243 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); |
| 244 }; | 244 }; |
| 245 | 245 |
| 246 } // namespace content | 246 } // namespace content |
| 247 | 247 |
| 248 #endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 248 #endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
| OLD | NEW |