OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 virtual TestTabContents* contents(); | 270 virtual TestTabContents* contents(); |
271 TestRenderViewHost* rvh(); | 271 TestRenderViewHost* rvh(); |
272 TestRenderViewHost* pending_rvh(); | 272 TestRenderViewHost* pending_rvh(); |
273 TestRenderViewHost* active_rvh(); | 273 TestRenderViewHost* active_rvh(); |
274 TestingProfile* profile(); | 274 TestingProfile* profile(); |
275 MockRenderProcessHost* process(); | 275 MockRenderProcessHost* process(); |
276 | 276 |
277 // Frees the current tab contents for tests that want to test destruction. | 277 // Frees the current tab contents for tests that want to test destruction. |
278 void DeleteContents(); | 278 void DeleteContents(); |
279 | 279 |
| 280 // Sets the current tab contents for tests that want to alter it. Takes |
| 281 // ownership of the TestTabContents passed. |
| 282 void SetContents(TestTabContents* contents); |
| 283 |
280 // Creates a new TestTabContents. Ownership passes to the caller. | 284 // Creates a new TestTabContents. Ownership passes to the caller. |
281 TestTabContents* CreateTestTabContents(); | 285 TestTabContents* CreateTestTabContents(); |
282 | 286 |
283 // Cover for |contents()->NavigateAndCommit(url)|. See | 287 // Cover for |contents()->NavigateAndCommit(url)|. See |
284 // TestTabContents::NavigateAndCommit for details. | 288 // TestTabContents::NavigateAndCommit for details. |
285 void NavigateAndCommit(const GURL& url); | 289 void NavigateAndCommit(const GURL& url); |
286 | 290 |
287 // Simulates a reload of the current page. | 291 // Simulates a reload of the current page. |
288 void Reload(); | 292 void Reload(); |
289 | 293 |
290 protected: | 294 protected: |
291 // testing::Test | 295 // testing::Test |
292 virtual void SetUp(); | 296 virtual void SetUp(); |
293 virtual void TearDown(); | 297 virtual void TearDown(); |
294 | 298 |
295 // This profile will be created in SetUp if it has not already been created. | 299 // This profile will be created in SetUp if it has not already been created. |
296 // This allows tests to override the profile if they so choose in their own | 300 // This allows tests to override the profile if they so choose in their own |
297 // SetUp function before calling the base class's (us) SetUp(). | 301 // SetUp function before calling the base class's (us) SetUp(). |
298 scoped_ptr<TestingProfile> profile_; | 302 scoped_ptr<TestingProfile> profile_; |
299 | 303 |
300 MessageLoopForUI message_loop_; | 304 MessageLoopForUI message_loop_; |
301 | 305 |
302 MockRenderProcessHostFactory rph_factory_; | 306 MockRenderProcessHostFactory rph_factory_; |
303 TestRenderViewHostFactory rvh_factory_; | 307 TestRenderViewHostFactory rvh_factory_; |
304 | 308 |
| 309 private: |
305 scoped_ptr<TestTabContents> contents_; | 310 scoped_ptr<TestTabContents> contents_; |
306 | 311 |
307 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); | 312 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); |
308 }; | 313 }; |
309 | 314 |
310 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_ | 315 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_ |
OLD | NEW |