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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 int routing_id, | 222 int routing_id, |
223 bool swapped_out); | 223 bool swapped_out); |
224 virtual ~TestRenderViewHost(); | 224 virtual ~TestRenderViewHost(); |
225 | 225 |
226 // RenderViewHostTester implementation. Note that CreateRenderView | 226 // RenderViewHostTester implementation. Note that CreateRenderView |
227 // is not specified since it is synonymous with the one from | 227 // is not specified since it is synonymous with the one from |
228 // RenderViewHostImpl, see below. | 228 // RenderViewHostImpl, see below. |
229 virtual void SendNavigate(int page_id, const GURL& url) OVERRIDE; | 229 virtual void SendNavigate(int page_id, const GURL& url) OVERRIDE; |
230 virtual void SendNavigateWithTransition(int page_id, const GURL& url, | 230 virtual void SendNavigateWithTransition(int page_id, const GURL& url, |
231 PageTransition transition) OVERRIDE; | 231 PageTransition transition) OVERRIDE; |
| 232 virtual void SendNavigateWithOriginalRequestURL( |
| 233 int page_id, const GURL& url, const GURL& original_request_url) OVERRIDE; |
| 234 virtual void SendNavigateWithParameters(int page_id, const GURL& url, |
| 235 PageTransition transition, |
| 236 const GURL& original_url) OVERRIDE; |
232 virtual void SendShouldCloseACK(bool proceed) OVERRIDE; | 237 virtual void SendShouldCloseACK(bool proceed) OVERRIDE; |
233 virtual void SetContentsMimeType(const std::string& mime_type) OVERRIDE; | 238 virtual void SetContentsMimeType(const std::string& mime_type) OVERRIDE; |
234 virtual void SimulateSwapOutACK() OVERRIDE; | 239 virtual void SimulateSwapOutACK() OVERRIDE; |
235 virtual void SimulateWasHidden() OVERRIDE; | 240 virtual void SimulateWasHidden() OVERRIDE; |
236 virtual void SimulateWasRestored() OVERRIDE; | 241 virtual void SimulateWasRestored() OVERRIDE; |
237 | 242 |
238 void TestOnMsgStartDragging(const WebDropData& drop_data); | 243 void TestOnMsgStartDragging(const WebDropData& drop_data); |
239 | 244 |
240 // If set, *delete_counter is incremented when this object destructs. | 245 // If set, *delete_counter is incremented when this object destructs. |
241 void set_delete_counter(int* delete_counter) { | 246 void set_delete_counter(int* delete_counter) { |
(...skipping 23 matching lines...) Expand all Loading... |
265 // filtering messages from the renderer. | 270 // filtering messages from the renderer. |
266 void set_is_swapped_out(bool is_swapped_out) { | 271 void set_is_swapped_out(bool is_swapped_out) { |
267 is_swapped_out_ = is_swapped_out; | 272 is_swapped_out_ = is_swapped_out; |
268 } | 273 } |
269 | 274 |
270 // If set, navigations will appear to have loaded through a proxy | 275 // If set, navigations will appear to have loaded through a proxy |
271 // (ViewHostMsg_FrameNavigte_Params::was_fetched_via_proxy). | 276 // (ViewHostMsg_FrameNavigte_Params::was_fetched_via_proxy). |
272 // False by default. | 277 // False by default. |
273 void set_simulate_fetch_via_proxy(bool proxy); | 278 void set_simulate_fetch_via_proxy(bool proxy); |
274 | 279 |
| 280 const ViewMsg_Navigate_Params* last_params() const { |
| 281 return last_params_; |
| 282 } |
| 283 |
275 // RenderViewHost overrides -------------------------------------------------- | 284 // RenderViewHost overrides -------------------------------------------------- |
276 | 285 |
277 virtual bool CreateRenderView(const string16& frame_name, | 286 virtual bool CreateRenderView(const string16& frame_name, |
278 int opener_route_id, | 287 int opener_route_id, |
279 int32 max_page_id, | 288 int32 max_page_id, |
280 const std::string& embedder_channel_name, | 289 const std::string& embedder_channel_name, |
281 int embedder_container_id) OVERRIDE; | 290 int embedder_container_id) OVERRIDE; |
282 virtual bool IsRenderViewLive() const OVERRIDE; | 291 virtual bool IsRenderViewLive() const OVERRIDE; |
| 292 virtual void Navigate(const ViewMsg_Navigate_Params& params) OVERRIDE; |
283 | 293 |
284 private: | 294 private: |
285 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); | 295 FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate); |
286 | 296 |
287 // Tracks if the caller thinks if it created the RenderView. This is so we can | 297 // Tracks if the caller thinks if it created the RenderView. This is so we can |
288 // respond to IsRenderViewLive appropriately. | 298 // respond to IsRenderViewLive appropriately. |
289 bool render_view_created_; | 299 bool render_view_created_; |
290 | 300 |
291 // See set_delete_counter() above. May be NULL. | 301 // See set_delete_counter() above. May be NULL. |
292 int* delete_counter_; | 302 int* delete_counter_; |
293 | 303 |
294 // See set_simulate_fetch_via_proxy() above. | 304 // See set_simulate_fetch_via_proxy() above. |
295 bool simulate_fetch_via_proxy_; | 305 bool simulate_fetch_via_proxy_; |
296 | 306 |
297 // See SetContentsMimeType() above. | 307 // See SetContentsMimeType() above. |
298 std::string contents_mime_type_; | 308 std::string contents_mime_type_; |
299 | 309 |
| 310 // Tracks the last parameters when triggering a navigation. |
| 311 ViewMsg_Navigate_Params* last_params_; |
| 312 |
300 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); | 313 DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); |
301 }; | 314 }; |
302 | 315 |
303 #if defined(COMPILER_MSVC) | 316 #if defined(COMPILER_MSVC) |
304 #pragma warning(pop) | 317 #pragma warning(pop) |
305 #endif | 318 #endif |
306 | 319 |
307 // Adds methods to get straight at the impl classes. | 320 // Adds methods to get straight at the impl classes. |
308 class RenderViewHostImplTestHarness | 321 class RenderViewHostImplTestHarness |
309 : public content::RenderViewHostTestHarness { | 322 : public content::RenderViewHostTestHarness { |
310 public: | 323 public: |
311 RenderViewHostImplTestHarness(); | 324 RenderViewHostImplTestHarness(); |
312 virtual ~RenderViewHostImplTestHarness(); | 325 virtual ~RenderViewHostImplTestHarness(); |
313 | 326 |
314 TestRenderViewHost* test_rvh(); | 327 TestRenderViewHost* test_rvh(); |
315 TestRenderViewHost* pending_test_rvh(); | 328 TestRenderViewHost* pending_test_rvh(); |
316 TestRenderViewHost* active_test_rvh(); | 329 TestRenderViewHost* active_test_rvh(); |
317 TestWebContents* contents(); | 330 TestWebContents* contents(); |
318 | 331 |
319 private: | 332 private: |
320 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); | 333 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); |
321 }; | 334 }; |
322 | 335 |
323 } // namespace content | 336 } // namespace content |
324 | 337 |
325 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ | 338 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ |
OLD | NEW |