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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "content/browser/frame_host/render_frame_host_impl.h" | 13 #include "content/browser/frame_host/render_frame_host_impl.h" |
14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
15 #include "content/public/test/mock_render_process_host.h" | 15 #include "content/public/test/mock_render_process_host.h" |
16 #include "content/public/test/test_renderer_host.h" | 16 #include "content/public/test/test_renderer_host.h" |
17 #include "content/test/test_render_view_host.h" | 17 #include "content/test/test_render_view_host.h" |
18 #include "ui/base/page_transition_types.h" | 18 #include "ui/base/page_transition_types.h" |
19 | 19 |
20 struct FrameHostMsg_DidCommitProvisionalLoad_Params; | 20 struct FrameHostMsg_DidCommitProvisionalLoad_Params; |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
| 24 class PageState; |
| 25 |
24 class TestRenderFrameHostCreationObserver : public WebContentsObserver { | 26 class TestRenderFrameHostCreationObserver : public WebContentsObserver { |
25 public: | 27 public: |
26 explicit TestRenderFrameHostCreationObserver(WebContents* web_contents); | 28 explicit TestRenderFrameHostCreationObserver(WebContents* web_contents); |
27 ~TestRenderFrameHostCreationObserver() override; | 29 ~TestRenderFrameHostCreationObserver() override; |
28 | 30 |
29 // WebContentsObserver implementation. | 31 // WebContentsObserver implementation. |
30 void RenderFrameCreated(RenderFrameHost* render_frame_host) override; | 32 void RenderFrameCreated(RenderFrameHost* render_frame_host) override; |
31 | 33 |
32 RenderFrameHost* last_created_frame() const { return last_created_frame_; } | 34 RenderFrameHost* last_created_frame() const { return last_created_frame_; } |
33 | 35 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // interaction with the IO thread up until the response is ready to commit. | 141 // interaction with the IO thread up until the response is ready to commit. |
140 void PrepareForCommitIfNecessary(); | 142 void PrepareForCommitIfNecessary(); |
141 | 143 |
142 // PlzNavigate | 144 // PlzNavigate |
143 void set_pending_commit(bool pending) { pending_commit_ = pending; } | 145 void set_pending_commit(bool pending) { pending_commit_ = pending; } |
144 bool pending_commit() const { return pending_commit_; } | 146 bool pending_commit() const { return pending_commit_; } |
145 | 147 |
146 // Creates a WebBluetooth Service with a dummy InterfaceRequest. | 148 // Creates a WebBluetooth Service with a dummy InterfaceRequest. |
147 WebBluetoothServiceImpl* CreateWebBluetoothServiceForTesting(); | 149 WebBluetoothServiceImpl* CreateWebBluetoothServiceForTesting(); |
148 | 150 |
| 151 // Creates an encoded page state for the |url|, |item_sequence_number| and |
| 152 // |document_sequence_number| parameters. |
| 153 static PageState CreatePageStateForURL(const GURL& url, |
| 154 int64_t item_sequence_number, |
| 155 int64_t document_sequence_number); |
149 private: | 156 private: |
150 void SendNavigateWithParameters(int page_id, | 157 void SendNavigateWithParameters(int page_id, |
151 int nav_entry_id, | 158 int nav_entry_id, |
152 bool did_create_new_entry, | 159 bool did_create_new_entry, |
153 bool should_replace_entry, | 160 bool should_replace_entry, |
154 const GURL& url, | 161 const GURL& url, |
155 ui::PageTransition transition, | 162 ui::PageTransition transition, |
156 int response_code, | 163 int response_code, |
157 const ModificationCallback& callback); | 164 const ModificationCallback& callback); |
158 | 165 |
159 // Computes the page ID for a pending navigation in this RenderFrameHost; | 166 // Computes the page ID for a pending navigation in this RenderFrameHost; |
160 int32_t ComputeNextPageID(); | 167 int32_t ComputeNextPageID(); |
161 | 168 |
162 void SimulateWillStartRequest(ui::PageTransition transition); | 169 void SimulateWillStartRequest(ui::PageTransition transition); |
163 | 170 |
164 TestRenderFrameHostCreationObserver child_creation_observer_; | 171 TestRenderFrameHostCreationObserver child_creation_observer_; |
165 | 172 |
166 std::string contents_mime_type_; | 173 std::string contents_mime_type_; |
167 | 174 |
168 // See set_simulate_history_list_was_cleared() above. | 175 // See set_simulate_history_list_was_cleared() above. |
169 bool simulate_history_list_was_cleared_; | 176 bool simulate_history_list_was_cleared_; |
170 | 177 |
171 DISALLOW_COPY_AND_ASSIGN(TestRenderFrameHost); | 178 DISALLOW_COPY_AND_ASSIGN(TestRenderFrameHost); |
172 }; | 179 }; |
173 | 180 |
174 } // namespace content | 181 } // namespace content |
175 | 182 |
176 #endif // CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_ | 183 #endif // CONTENT_TEST_TEST_RENDER_FRAME_HOST_H_ |
OLD | NEW |