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_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 protected: | 183 protected: |
184 RenderWidgetHostImpl* rwh_; | 184 RenderWidgetHostImpl* rwh_; |
185 | 185 |
186 private: | 186 private: |
187 bool is_showing_; | 187 bool is_showing_; |
188 }; | 188 }; |
189 | 189 |
190 } // namespace content | 190 } // namespace content |
191 | 191 |
| 192 #if defined(COMPILER_MSVC) |
| 193 // See comment for same warning on RenderViewHostImpl. |
| 194 #pragma warning(push) |
| 195 #pragma warning(disable: 4250) |
| 196 #endif |
| 197 |
192 // TestRenderViewHost ---------------------------------------------------------- | 198 // TestRenderViewHost ---------------------------------------------------------- |
193 | 199 |
194 // TODO(brettw) this should use a TestTabContents which should be generalized | 200 // TODO(brettw) this should use a TestTabContents which should be generalized |
195 // from the TabContents test. We will probably also need that class' version of | 201 // from the TabContents test. We will probably also need that class' version of |
196 // CreateRenderViewForRenderManager when more complicate tests start using this. | 202 // CreateRenderViewForRenderManager when more complicate tests start using this. |
197 class TestRenderViewHost : public RenderViewHost { | 203 class TestRenderViewHost : public RenderViewHostImpl { |
198 public: | 204 public: |
199 // If the given TabContnets has a pending RVH, returns it, otherwise NULL. | 205 // If the given TabContnets has a pending RVH, returns it, otherwise NULL. |
200 static TestRenderViewHost* GetPendingForController( | 206 static TestRenderViewHost* GetPendingForController( |
201 content::NavigationController* controller); | 207 content::NavigationController* controller); |
202 | 208 |
203 TestRenderViewHost(content::SiteInstance* instance, | 209 TestRenderViewHost(content::SiteInstance* instance, |
204 content::RenderViewHostDelegate* delegate, | 210 content::RenderViewHostDelegate* delegate, |
205 int routing_id); | 211 int routing_id); |
206 virtual ~TestRenderViewHost(); | 212 virtual ~TestRenderViewHost(); |
207 | 213 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // If set, future loads will have |mime_type| set as the mime type. | 272 // If set, future loads will have |mime_type| set as the mime type. |
267 // If not set, the mime type will default to "text/html". | 273 // If not set, the mime type will default to "text/html". |
268 void set_contents_mime_type(const std::string& mime_type); | 274 void set_contents_mime_type(const std::string& mime_type); |
269 | 275 |
270 // RenderViewHost overrides -------------------------------------------------- | 276 // RenderViewHost overrides -------------------------------------------------- |
271 | 277 |
272 virtual bool CreateRenderView(const string16& frame_name, | 278 virtual bool CreateRenderView(const string16& frame_name, |
273 int32 max_page_id) OVERRIDE; | 279 int32 max_page_id) OVERRIDE; |
274 virtual bool IsRenderViewLive() const OVERRIDE; | 280 virtual bool IsRenderViewLive() const OVERRIDE; |
275 | 281 |
| 282 // This removes the need to expose |
| 283 // RenderViewHostImpl::is_swapped_out() outside of content. |
| 284 static bool IsRenderViewHostSwappedOut(RenderViewHost* rwh); |
| 285 |
276 private: | 286 private: |
277 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); | 287 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); |
278 | 288 |
279 // Tracks if the caller thinks if it created the RenderView. This is so we can | 289 // Tracks if the caller thinks if it created the RenderView. This is so we can |
280 // respond to IsRenderViewLive appropriately. | 290 // respond to IsRenderViewLive appropriately. |
281 bool render_view_created_; | 291 bool render_view_created_; |
282 | 292 |
283 // See set_delete_counter() above. May be NULL. | 293 // See set_delete_counter() above. May be NULL. |
284 int* delete_counter_; | 294 int* delete_counter_; |
285 | 295 |
286 // See set_simulate_fetch_via_proxy() above. | 296 // See set_simulate_fetch_via_proxy() above. |
287 bool simulate_fetch_via_proxy_; | 297 bool simulate_fetch_via_proxy_; |
288 | 298 |
289 // See set_contents_mime_type() above. | 299 // See set_contents_mime_type() above. |
290 std::string contents_mime_type_; | 300 std::string contents_mime_type_; |
291 | 301 |
292 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); | 302 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); |
293 }; | 303 }; |
294 | 304 |
| 305 #if defined(COMPILER_MSVC) |
| 306 #pragma warning(pop) |
| 307 #endif |
| 308 |
295 // TestRenderViewHostFactory --------------------------------------------------- | 309 // TestRenderViewHostFactory --------------------------------------------------- |
296 | 310 |
297 // Manages creation of the RenderViewHosts using our special subclass. This | 311 // Manages creation of the RenderViewHosts using our special subclass. This |
298 // automatically registers itself when it goes in scope, and unregisters itself | 312 // automatically registers itself when it goes in scope, and unregisters itself |
299 // when it goes out of scope. Since you can't have more than one factory | 313 // when it goes out of scope. Since you can't have more than one factory |
300 // registered at a time, you can only have one of these objects at a time. | 314 // registered at a time, you can only have one of these objects at a time. |
301 class TestRenderViewHostFactory : public RenderViewHostFactory { | 315 class TestRenderViewHostFactory : public RenderViewHostFactory { |
302 public: | 316 public: |
303 explicit TestRenderViewHostFactory( | 317 explicit TestRenderViewHostFactory( |
304 content::RenderProcessHostFactory* rph_factory); | 318 content::RenderProcessHostFactory* rph_factory); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 scoped_ptr<TestTabContents> contents_; | 391 scoped_ptr<TestTabContents> contents_; |
378 #if defined(USE_AURA) | 392 #if defined(USE_AURA) |
379 scoped_ptr<aura::RootWindow> root_window_; | 393 scoped_ptr<aura::RootWindow> root_window_; |
380 scoped_ptr<aura::test::TestStackingClient> test_stacking_client_; | 394 scoped_ptr<aura::test::TestStackingClient> test_stacking_client_; |
381 #endif | 395 #endif |
382 | 396 |
383 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); | 397 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); |
384 }; | 398 }; |
385 | 399 |
386 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ | 400 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ |
OLD | NEW |