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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 | 48 |
49 // An interface and utility for driving tests of RenderFrameHost. | 49 // An interface and utility for driving tests of RenderFrameHost. |
50 class RenderFrameHostTester { | 50 class RenderFrameHostTester { |
51 public: | 51 public: |
52 // Retrieves the RenderFrameHostTester that drives the specified | 52 // Retrieves the RenderFrameHostTester that drives the specified |
53 // RenderFrameHost. The RenderFrameHost must have been created while | 53 // RenderFrameHost. The RenderFrameHost must have been created while |
54 // RenderFrameHost testing was enabled; use a | 54 // RenderFrameHost testing was enabled; use a |
55 // RenderViewHostTestEnabler instance (see below) to do this. | 55 // RenderViewHostTestEnabler instance (see below) to do this. |
56 static RenderFrameHostTester* For(RenderFrameHost* host); | 56 static RenderFrameHostTester* For(RenderFrameHost* host); |
57 | 57 |
58 // If the given NavigationController has a pending main frame, returns it, | 58 static void CommitPendingLoad(NavigationController* controller); |
59 // otherwise NULL. This is an alternative to | |
60 // WebContentsTester::GetPendingMainFrame() when your WebContents was not | |
61 // created via a TestWebContents. | |
62 static RenderFrameHost* GetPendingForController( | |
63 NavigationController* controller); | |
64 | 59 |
65 virtual ~RenderFrameHostTester() {} | 60 virtual ~RenderFrameHostTester() {} |
66 | 61 |
67 // Simulates initialization of the RenderFrame object in the renderer process | 62 // Simulates initialization of the RenderFrame object in the renderer process |
68 // and ensures internal state of RenderFrameHost is ready for simulating | 63 // and ensures internal state of RenderFrameHost is ready for simulating |
69 // RenderFrame originated IPCs. | 64 // RenderFrame originated IPCs. |
70 virtual void InitializeRenderFrameIfNeeded() = 0; | 65 virtual void InitializeRenderFrameIfNeeded() = 0; |
71 | 66 |
72 // Gives tests access to RenderFrameHostImpl::OnCreateChild. The returned | 67 // Gives tests access to RenderFrameHostImpl::OnCreateChild. The returned |
73 // RenderFrameHost is owned by the parent RenderFrameHost. | 68 // RenderFrameHost is owned by the parent RenderFrameHost. |
(...skipping 15 matching lines...) Expand all Loading... | |
89 | 84 |
90 // Simulates a navigation to |url| failing with the error code |error_code|. | 85 // Simulates a navigation to |url| failing with the error code |error_code|. |
91 virtual void SimulateNavigationError(const GURL& url, int error_code) = 0; | 86 virtual void SimulateNavigationError(const GURL& url, int error_code) = 0; |
92 | 87 |
93 // Simulates the commit of an error page following a navigation failure. | 88 // Simulates the commit of an error page following a navigation failure. |
94 virtual void SimulateNavigationErrorPageCommit() = 0; | 89 virtual void SimulateNavigationErrorPageCommit() = 0; |
95 | 90 |
96 // Simulates a navigation stopping in the RenderFrameHost. | 91 // Simulates a navigation stopping in the RenderFrameHost. |
97 virtual void SimulateNavigationStop() = 0; | 92 virtual void SimulateNavigationStop() = 0; |
98 | 93 |
94 // If we are doing a cross-site navigation, this simulates the current | |
95 // RenderFrameHost notifying that BeforeUnload has executed so the pending | |
96 // RenderFrameHost is resumed and can navigate. | |
97 // PlzNavigate: This simulates a BeforeUnload ACK from the renderer, and the | |
98 // interaction with the IO thread up until the response is ready to commit. | |
99 virtual void PrepareForCommitIfNecessary() = 0; | |
clamy
2016/09/01 00:00:18
We're no longer using this outside of content/ rig
scottmg
2016/09/01 02:33:19
Ah, right. Done.
| |
100 | |
99 // Calls OnDidCommitProvisionalLoad on the RenderFrameHost with the given | 101 // Calls OnDidCommitProvisionalLoad on the RenderFrameHost with the given |
100 // information with various sets of parameters. These are helper functions for | 102 // information with various sets of parameters. These are helper functions for |
101 // simulating the most common types of loads. | 103 // simulating the most common types of loads. |
102 // | 104 // |
103 // Guidance for calling these: | 105 // Guidance for calling these: |
104 // - nav_entry_id should be 0 if simulating a renderer-initiated navigation; | 106 // - nav_entry_id should be 0 if simulating a renderer-initiated navigation; |
105 // if simulating a browser-initiated one, pass the GetUniqueID() value of | 107 // if simulating a browser-initiated one, pass the GetUniqueID() value of |
106 // the NavigationController's PendingEntry. | 108 // the NavigationController's PendingEntry. |
107 // - did_create_new_entry should be true if simulating a navigation that | 109 // - did_create_new_entry should be true if simulating a navigation that |
108 // created a new navigation entry; false for history navigations, reloads, | 110 // created a new navigation entry; false for history navigations, reloads, |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 std::unique_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 284 std::unique_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
283 #endif | 285 #endif |
284 RenderViewHostTestEnabler rvh_test_enabler_; | 286 RenderViewHostTestEnabler rvh_test_enabler_; |
285 | 287 |
286 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); | 288 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); |
287 }; | 289 }; |
288 | 290 |
289 } // namespace content | 291 } // namespace content |
290 | 292 |
291 #endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 293 #endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
OLD | NEW |