OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_TEST_TEST_RENDER_FRAME_HOST_H_ | 5 #ifndef CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_ |
6 #define CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_ | 6 #define CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const std::vector<GURL>& redirects); | 79 const std::vector<GURL>& redirects); |
80 void SendNavigateWithParameters( | 80 void SendNavigateWithParameters( |
81 int page_id, | 81 int page_id, |
82 const GURL& url, | 82 const GURL& url, |
83 ui::PageTransition transition, | 83 ui::PageTransition transition, |
84 const GURL& original_request_url, | 84 const GURL& original_request_url, |
85 int response_code, | 85 int response_code, |
86 const base::FilePath* file_path_for_history_item, | 86 const base::FilePath* file_path_for_history_item, |
87 const std::vector<GURL>& redirects); | 87 const std::vector<GURL>& redirects); |
88 | 88 |
| 89 // Simulate a renderer-initiated navigation up until commit. |
| 90 void NavigateAndCommitRendererInitiated(int page_id, const GURL& url); |
| 91 |
89 // With the current navigation logic this method is a no-op. | 92 // With the current navigation logic this method is a no-op. |
90 // PlzNavigate: this method simulates receiving a BeginNavigation IPC. | 93 // PlzNavigate: this method simulates receiving a BeginNavigation IPC. |
91 void SendRendererInitiatedNavigationRequest(const GURL& url, | 94 void SendRendererInitiatedNavigationRequest(const GURL& url, |
92 bool has_user_gesture); | 95 bool has_user_gesture); |
93 | 96 |
94 void DidDisownOpener(); | 97 void DidDisownOpener(); |
95 | 98 |
96 // If set, navigations will appear to have cleared the history list in the | 99 // If set, navigations will appear to have cleared the history list in the |
97 // RenderFrame | 100 // RenderFrame |
98 // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared). | 101 // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared). |
99 // False by default. | 102 // False by default. |
100 void set_simulate_history_list_was_cleared(bool cleared) { | 103 void set_simulate_history_list_was_cleared(bool cleared) { |
101 simulate_history_list_was_cleared_ = cleared; | 104 simulate_history_list_was_cleared_ = cleared; |
102 } | 105 } |
103 | 106 |
104 // Advances the RenderFrameHost (and through it the RenderFrameHostManager) to | 107 // Advances the RenderFrameHost (and through it the RenderFrameHostManager) to |
105 // a state where a new navigation can be committed by a renderer. Currently, | 108 // a state where a new navigation can be committed by a renderer. Currently, |
106 // this simulates a BeforeUnload ACK from the renderer. | 109 // this simulates a BeforeUnload ACK from the renderer. |
107 // PlzNavigate: this simulates a BeforeUnload ACK from the renderer, and the | 110 // PlzNavigate: this simulates a BeforeUnload ACK from the renderer, and the |
108 // interaction with the IO thread up until the response is ready to commit. | 111 // interaction with the IO thread up until the response is ready to commit. |
109 void PrepareForCommit(); | 112 void PrepareForCommit(); |
110 | 113 |
111 // This method does the same as PrepareForCommit. | 114 // This method does the same as PrepareForCommit. |
112 // PlzNavigate: Beyond doing the same as PrepareForCommit, this method will | 115 // PlzNavigate: Beyond doing the same as PrepareForCommit, this method will |
113 // also simulate a server redirect to |redirect_url|. If the URL is empty the | 116 // also simulate a server redirect to |redirect_url|. If the URL is empty the |
114 // redirect step is ignored. | 117 // redirect step is ignored. |
115 void PrepareForCommitWithServerRedirect(const GURL& redirect_url); | 118 void PrepareForCommitWithServerRedirect(const GURL& redirect_url); |
116 | 119 |
| 120 // PlzNavigate |
| 121 void set_pending_commit(bool pending) { pending_commit_ = pending; } |
| 122 bool pending_commit() const { return pending_commit_; } |
| 123 |
117 private: | 124 private: |
118 TestRenderFrameHostCreationObserver child_creation_observer_; | 125 TestRenderFrameHostCreationObserver child_creation_observer_; |
119 | 126 |
120 std::string contents_mime_type_; | 127 std::string contents_mime_type_; |
121 | 128 |
122 // See set_simulate_history_list_was_cleared() above. | 129 // See set_simulate_history_list_was_cleared() above. |
123 bool simulate_history_list_was_cleared_; | 130 bool simulate_history_list_was_cleared_; |
124 | 131 |
125 DISALLOW_COPY_AND_ASSIGN(TestRenderFrameHost); | 132 DISALLOW_COPY_AND_ASSIGN(TestRenderFrameHost); |
126 }; | 133 }; |
127 | 134 |
128 } // namespace content | 135 } // namespace content |
129 | 136 |
130 #endif // CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_ | 137 #endif // CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_ |
OLD | NEW |