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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 protected: | 178 protected: |
179 RenderWidgetHostImpl* rwh_; | 179 RenderWidgetHostImpl* rwh_; |
180 | 180 |
181 private: | 181 private: |
182 bool is_showing_; | 182 bool is_showing_; |
183 }; | 183 }; |
184 | 184 |
185 } // namespace content | 185 } // namespace content |
186 | 186 |
| 187 #if defined(OS_WIN) |
| 188 // See comment for same warning on RenderViewHostImpl. |
| 189 #pragma warning(push) |
| 190 #pragma warning(disable: 4250) |
| 191 #endif |
| 192 |
187 // TestRenderViewHost ---------------------------------------------------------- | 193 // TestRenderViewHost ---------------------------------------------------------- |
188 | 194 |
189 // TODO(brettw) this should use a TestTabContents which should be generalized | 195 // TODO(brettw) this should use a TestTabContents which should be generalized |
190 // from the TabContents test. We will probably also need that class' version of | 196 // from the TabContents test. We will probably also need that class' version of |
191 // CreateRenderViewForRenderManager when more complicate tests start using this. | 197 // CreateRenderViewForRenderManager when more complicate tests start using this. |
192 class TestRenderViewHost : public RenderViewHost { | 198 class TestRenderViewHost : public RenderViewHostImpl { |
193 public: | 199 public: |
194 // If the given TabContnets has a pending RVH, returns it, otherwise NULL. | 200 // If the given TabContnets has a pending RVH, returns it, otherwise NULL. |
195 static TestRenderViewHost* GetPendingForController( | 201 static TestRenderViewHost* GetPendingForController( |
196 content::NavigationController* controller); | 202 content::NavigationController* controller); |
197 | 203 |
198 TestRenderViewHost(content::SiteInstance* instance, | 204 TestRenderViewHost(content::SiteInstance* instance, |
199 content::RenderViewHostDelegate* delegate, | 205 content::RenderViewHostDelegate* delegate, |
200 int routing_id); | 206 int routing_id); |
201 virtual ~TestRenderViewHost(); | 207 virtual ~TestRenderViewHost(); |
202 | 208 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // If set, future loads will have |mime_type| set as the mime type. | 267 // If set, future loads will have |mime_type| set as the mime type. |
262 // If not set, the mime type will default to "text/html". | 268 // If not set, the mime type will default to "text/html". |
263 void set_contents_mime_type(const std::string& mime_type); | 269 void set_contents_mime_type(const std::string& mime_type); |
264 | 270 |
265 // RenderViewHost overrides -------------------------------------------------- | 271 // RenderViewHost overrides -------------------------------------------------- |
266 | 272 |
267 virtual bool CreateRenderView(const string16& frame_name, | 273 virtual bool CreateRenderView(const string16& frame_name, |
268 int32 max_page_id) OVERRIDE; | 274 int32 max_page_id) OVERRIDE; |
269 virtual bool IsRenderViewLive() const OVERRIDE; | 275 virtual bool IsRenderViewLive() const OVERRIDE; |
270 | 276 |
| 277 // This removes the need to expose |
| 278 // RenderViewHostImpl::is_swapped_out() outside of content. |
| 279 static bool IsRenderViewHostSwappedOut(RenderViewHost* rwh); |
| 280 |
271 private: | 281 private: |
272 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); | 282 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); |
273 | 283 |
274 // Tracks if the caller thinks if it created the RenderView. This is so we can | 284 // Tracks if the caller thinks if it created the RenderView. This is so we can |
275 // respond to IsRenderViewLive appropriately. | 285 // respond to IsRenderViewLive appropriately. |
276 bool render_view_created_; | 286 bool render_view_created_; |
277 | 287 |
278 // See set_delete_counter() above. May be NULL. | 288 // See set_delete_counter() above. May be NULL. |
279 int* delete_counter_; | 289 int* delete_counter_; |
280 | 290 |
281 // See set_simulate_fetch_via_proxy() above. | 291 // See set_simulate_fetch_via_proxy() above. |
282 bool simulate_fetch_via_proxy_; | 292 bool simulate_fetch_via_proxy_; |
283 | 293 |
284 // See set_contents_mime_type() above. | 294 // See set_contents_mime_type() above. |
285 std::string contents_mime_type_; | 295 std::string contents_mime_type_; |
286 | 296 |
287 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); | 297 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); |
288 }; | 298 }; |
289 | 299 |
| 300 #if defined(OS_WIN) |
| 301 #pragma warning(pop) |
| 302 #endif |
| 303 |
290 // TestRenderViewHostFactory --------------------------------------------------- | 304 // TestRenderViewHostFactory --------------------------------------------------- |
291 | 305 |
292 // Manages creation of the RenderViewHosts using our special subclass. This | 306 // Manages creation of the RenderViewHosts using our special subclass. This |
293 // automatically registers itself when it goes in scope, and unregisters itself | 307 // automatically registers itself when it goes in scope, and unregisters itself |
294 // when it goes out of scope. Since you can't have more than one factory | 308 // when it goes out of scope. Since you can't have more than one factory |
295 // registered at a time, you can only have one of these objects at a time. | 309 // registered at a time, you can only have one of these objects at a time. |
296 class TestRenderViewHostFactory : public RenderViewHostFactory { | 310 class TestRenderViewHostFactory : public RenderViewHostFactory { |
297 public: | 311 public: |
298 explicit TestRenderViewHostFactory( | 312 explicit TestRenderViewHostFactory( |
299 content::RenderProcessHostFactory* rph_factory); | 313 content::RenderProcessHostFactory* rph_factory); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 // Takes ownership of rwh, private since it should be constructed | 409 // Takes ownership of rwh, private since it should be constructed |
396 // via Construct. | 410 // via Construct. |
397 explicit TestRenderWidgetHostViewWithBackingStoreSkia(RenderWidgetHost* rwh) | 411 explicit TestRenderWidgetHostViewWithBackingStoreSkia(RenderWidgetHost* rwh) |
398 : content::TestRenderWidgetHostView(rwh) {} | 412 : content::TestRenderWidgetHostView(rwh) {} |
399 | 413 |
400 DISALLOW_COPY_AND_ASSIGN(TestRenderWidgetHostViewWithBackingStoreSkia); | 414 DISALLOW_COPY_AND_ASSIGN(TestRenderWidgetHostViewWithBackingStoreSkia); |
401 }; | 415 }; |
402 | 416 |
403 | 417 |
404 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ | 418 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ |
OLD | NEW |