| 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_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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 int renderer_id, | 118 int renderer_id, |
| 119 int32 route_id, | 119 int32 route_id, |
| 120 int gpu_host_id) OVERRIDE; | 120 int gpu_host_id) OVERRIDE; |
| 121 #elif defined(OS_WIN) | 121 #elif defined(OS_WIN) |
| 122 virtual void WillWmDestroy() OVERRIDE; | 122 virtual void WillWmDestroy() OVERRIDE; |
| 123 #endif | 123 #endif |
| 124 #if defined(OS_POSIX) || defined(USE_AURA) | 124 #if defined(OS_POSIX) || defined(USE_AURA) |
| 125 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE {} | 125 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE {} |
| 126 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; | 126 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; |
| 127 #endif | 127 #endif |
| 128 virtual void SetVisuallyDeemphasized(const SkColor* color, bool animate) { } | 128 virtual void SetVisuallyDeemphasized(const SkColor* color, |
| 129 bool animate) OVERRIDE { } |
| 129 virtual void UnhandledWheelEvent( | 130 virtual void UnhandledWheelEvent( |
| 130 const WebKit::WebMouseWheelEvent& event) { } | 131 const WebKit::WebMouseWheelEvent& event) OVERRIDE { } |
| 131 virtual void SetHasHorizontalScrollbar( | 132 virtual void SetHasHorizontalScrollbar( |
| 132 bool has_horizontal_scrollbar) { } | 133 bool has_horizontal_scrollbar) OVERRIDE { } |
| 133 virtual void SetScrollOffsetPinning( | 134 virtual void SetScrollOffsetPinning( |
| 134 bool is_pinned_to_left, bool is_pinned_to_right) { } | 135 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE { } |
| 135 | 136 |
| 136 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 137 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 137 virtual void AcceleratedSurfaceNew( | 138 virtual void AcceleratedSurfaceNew( |
| 138 int32 width, int32 height, uint64* surface_id, | 139 int32 width, int32 height, uint64* surface_id, |
| 139 TransportDIB::Handle* surface_handle) { } | 140 TransportDIB::Handle* surface_handle) { } |
| 140 virtual void AcceleratedSurfaceBuffersSwapped( | 141 virtual void AcceleratedSurfaceBuffersSwapped( |
| 141 uint64 surface_id, | 142 uint64 surface_id, |
| 142 int32 route_id, | 143 int32 route_id, |
| 143 int gpu_host_id) OVERRIDE {} | 144 int gpu_host_id) OVERRIDE {} |
| 144 virtual void AcceleratedSurfaceRelease(uint64 surface_id) { } | 145 virtual void AcceleratedSurfaceRelease(uint64 surface_id) { } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // (ViewHostMsg_FrameNavigte_Params::was_fetched_via_proxy). | 225 // (ViewHostMsg_FrameNavigte_Params::was_fetched_via_proxy). |
| 225 // False by default. | 226 // False by default. |
| 226 void set_simulate_fetch_via_proxy(bool proxy); | 227 void set_simulate_fetch_via_proxy(bool proxy); |
| 227 | 228 |
| 228 // If set, future loads will have |mime_type| set as the mime type. | 229 // If set, future loads will have |mime_type| set as the mime type. |
| 229 // If not set, the mime type will default to "text/html". | 230 // If not set, the mime type will default to "text/html". |
| 230 void set_contents_mime_type(const std::string& mime_type); | 231 void set_contents_mime_type(const std::string& mime_type); |
| 231 | 232 |
| 232 // RenderViewHost overrides -------------------------------------------------- | 233 // RenderViewHost overrides -------------------------------------------------- |
| 233 | 234 |
| 234 virtual bool CreateRenderView(const string16& frame_name); | 235 virtual bool CreateRenderView(const string16& frame_name) OVERRIDE; |
| 235 virtual bool IsRenderViewLive() const; | 236 virtual bool IsRenderViewLive() const OVERRIDE; |
| 236 | 237 |
| 237 private: | 238 private: |
| 238 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); | 239 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); |
| 239 | 240 |
| 240 // Tracks if the caller thinks if it created the RenderView. This is so we can | 241 // Tracks if the caller thinks if it created the RenderView. This is so we can |
| 241 // respond to IsRenderViewLive appropriately. | 242 // respond to IsRenderViewLive appropriately. |
| 242 bool render_view_created_; | 243 bool render_view_created_; |
| 243 | 244 |
| 244 // See set_delete_counter() above. May be NULL. | 245 // See set_delete_counter() above. May be NULL. |
| 245 int* delete_counter_; | 246 int* delete_counter_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 263 public: | 264 public: |
| 264 explicit TestRenderViewHostFactory(RenderProcessHostFactory* rph_factory); | 265 explicit TestRenderViewHostFactory(RenderProcessHostFactory* rph_factory); |
| 265 virtual ~TestRenderViewHostFactory(); | 266 virtual ~TestRenderViewHostFactory(); |
| 266 | 267 |
| 267 virtual void set_render_process_host_factory( | 268 virtual void set_render_process_host_factory( |
| 268 RenderProcessHostFactory* rph_factory); | 269 RenderProcessHostFactory* rph_factory); |
| 269 virtual RenderViewHost* CreateRenderViewHost( | 270 virtual RenderViewHost* CreateRenderViewHost( |
| 270 SiteInstance* instance, | 271 SiteInstance* instance, |
| 271 RenderViewHostDelegate* delegate, | 272 RenderViewHostDelegate* delegate, |
| 272 int routing_id, | 273 int routing_id, |
| 273 SessionStorageNamespace* session_storage); | 274 SessionStorageNamespace* session_storage) OVERRIDE; |
| 274 | 275 |
| 275 private: | 276 private: |
| 276 // This is a bit of a hack. With the current design of the site instances / | 277 // This is a bit of a hack. With the current design of the site instances / |
| 277 // browsing instances, it's difficult to pass a RenderProcessHostFactory | 278 // browsing instances, it's difficult to pass a RenderProcessHostFactory |
| 278 // around properly. | 279 // around properly. |
| 279 // | 280 // |
| 280 // Instead, we set it right before we create a new RenderViewHost, which | 281 // Instead, we set it right before we create a new RenderViewHost, which |
| 281 // happens before the RenderProcessHost is created. This way, the instance | 282 // happens before the RenderProcessHost is created. This way, the instance |
| 282 // has the correct factory and creates our special RenderProcessHosts. | 283 // has the correct factory and creates our special RenderProcessHosts. |
| 283 RenderProcessHostFactory* render_process_host_factory_; | 284 RenderProcessHostFactory* render_process_host_factory_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 312 | 313 |
| 313 // Cover for |contents()->NavigateAndCommit(url)|. See | 314 // Cover for |contents()->NavigateAndCommit(url)|. See |
| 314 // TestTabContents::NavigateAndCommit for details. | 315 // TestTabContents::NavigateAndCommit for details. |
| 315 void NavigateAndCommit(const GURL& url); | 316 void NavigateAndCommit(const GURL& url); |
| 316 | 317 |
| 317 // Simulates a reload of the current page. | 318 // Simulates a reload of the current page. |
| 318 void Reload(); | 319 void Reload(); |
| 319 | 320 |
| 320 protected: | 321 protected: |
| 321 // testing::Test | 322 // testing::Test |
| 322 virtual void SetUp(); | 323 virtual void SetUp() OVERRIDE; |
| 323 virtual void TearDown(); | 324 virtual void TearDown() OVERRIDE; |
| 324 | 325 |
| 325 // This browser context will be created in SetUp if it has not already been | 326 // This browser context will be created in SetUp if it has not already been |
| 326 // created. This allows tests to override the browser context if they so | 327 // created. This allows tests to override the browser context if they so |
| 327 // choose in their own SetUp function before calling the base class's (us) | 328 // choose in their own SetUp function before calling the base class's (us) |
| 328 // SetUp(). | 329 // SetUp(). |
| 329 scoped_ptr<content::BrowserContext> browser_context_; | 330 scoped_ptr<content::BrowserContext> browser_context_; |
| 330 | 331 |
| 331 MessageLoopForUI message_loop_; | 332 MessageLoopForUI message_loop_; |
| 332 | 333 |
| 333 MockRenderProcessHostFactory rph_factory_; | 334 MockRenderProcessHostFactory rph_factory_; |
| 334 TestRenderViewHostFactory rvh_factory_; | 335 TestRenderViewHostFactory rvh_factory_; |
| 335 | 336 |
| 336 private: | 337 private: |
| 337 scoped_ptr<TestTabContents> contents_; | 338 scoped_ptr<TestTabContents> contents_; |
| 338 | 339 |
| 339 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); | 340 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); |
| 340 }; | 341 }; |
| 341 | 342 |
| 342 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ | 343 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ |
| OLD | NEW |