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_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
6 #define CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // constructed while a RenderViewHostTestEnabler is in play. | 64 // constructed while a RenderViewHostTestEnabler is in play. |
65 static bool IsRenderFrameHostSwappedOut(RenderFrameHost* rfh); | 65 static bool IsRenderFrameHostSwappedOut(RenderFrameHost* rfh); |
66 | 66 |
67 virtual ~RenderFrameHostTester() {} | 67 virtual ~RenderFrameHostTester() {} |
68 | 68 |
69 // Gives tests access to RenderFrameHostImpl::OnCreateChild. The returned | 69 // Gives tests access to RenderFrameHostImpl::OnCreateChild. The returned |
70 // RenderFrameHost is owned by the parent RenderFrameHost. | 70 // RenderFrameHost is owned by the parent RenderFrameHost. |
71 virtual RenderFrameHost* AppendChild(const std::string& frame_name) = 0; | 71 virtual RenderFrameHost* AppendChild(const std::string& frame_name) = 0; |
72 | 72 |
73 // Calls OnDidCommitProvisionalLoad on the RenderFrameHost with the given | 73 // Calls OnDidCommitProvisionalLoad on the RenderFrameHost with the given |
74 // information. Sets the rest of the parameters in the message to the | 74 // information with various sets of parameters. These are helper functions for |
75 // "typical" values. This is a helper function for simulating the most common | 75 // simulating the most common types of loads. |
76 // types of loads. | 76 // |
77 virtual void SendNavigate(int page_id, const GURL& url) = 0; | 77 // Guidance for calling these: |
78 virtual void SendFailedNavigate(int page_id, const GURL& url) = 0; | 78 // - nav_entry_id should be 0 if simulating a renderer-initiated navigation; |
79 | 79 // if simulating a browser-initiated one, pass the GetUniqueID() value of |
80 // Calls OnDidCommitProvisionalLoad on the RenderFrameHost with the given | 80 // the NavigationController's PendingEntry. |
81 // information, including a custom PageTransition. Sets the rest of the | 81 // - did_create_new_entry should be true if simulating a navigation that |
82 // parameters in the message to the "typical" values. This is a helper | 82 // created a new navigation entry; false for history navigations, reloads, |
83 // function for simulating the most common types of loads. | 83 // and other navigations that don't affect the history list. |
| 84 virtual void SendNavigate(int page_id, |
| 85 int nav_entry_id, |
| 86 bool did_create_new_entry, |
| 87 const GURL& url) = 0; |
| 88 virtual void SendFailedNavigate(int page_id, |
| 89 int nav_entry_id, |
| 90 bool did_create_new_entry, |
| 91 const GURL& url) = 0; |
84 virtual void SendNavigateWithTransition(int page_id, | 92 virtual void SendNavigateWithTransition(int page_id, |
| 93 int nav_entry_id, |
| 94 bool did_create_new_entry, |
85 const GURL& url, | 95 const GURL& url, |
86 ui::PageTransition transition) = 0; | 96 ui::PageTransition transition) = 0; |
87 | 97 |
88 // If set, future loads will have |mime_type| set as the mime type. | 98 // If set, future loads will have |mime_type| set as the mime type. |
89 // If not set, the mime type will default to "text/html". | 99 // If not set, the mime type will default to "text/html". |
90 virtual void SetContentsMimeType(const std::string& mime_type) = 0; | 100 virtual void SetContentsMimeType(const std::string& mime_type) = 0; |
91 | 101 |
92 // Calls OnBeforeUnloadACK on this RenderFrameHost with the given parameter. | 102 // Calls OnBeforeUnloadACK on this RenderFrameHost with the given parameter. |
93 virtual void SendBeforeUnloadACK(bool proceed) = 0; | 103 virtual void SendBeforeUnloadACK(bool proceed) = 0; |
94 | 104 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 256 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
247 #endif | 257 #endif |
248 RenderViewHostTestEnabler rvh_test_enabler_; | 258 RenderViewHostTestEnabler rvh_test_enabler_; |
249 | 259 |
250 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); | 260 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); |
251 }; | 261 }; |
252 | 262 |
253 } // namespace content | 263 } // namespace content |
254 | 264 |
255 #endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 265 #endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
OLD | NEW |