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