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