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 #include "content/test/test_web_contents.h" | 5 #include "content/test/test_web_contents.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "content/browser/browser_url_handler_impl.h" | 10 #include "content/browser/browser_url_handler_impl.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #include "content/public/test/mock_render_process_host.h" | 24 #include "content/public/test/mock_render_process_host.h" |
25 #include "content/test/test_render_view_host.h" | 25 #include "content/test/test_render_view_host.h" |
26 #include "ui/base/page_transition_types.h" | 26 #include "ui/base/page_transition_types.h" |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 | 29 |
30 TestWebContents::TestWebContents(BrowserContext* browser_context) | 30 TestWebContents::TestWebContents(BrowserContext* browser_context) |
31 : WebContentsImpl(browser_context, NULL), | 31 : WebContentsImpl(browser_context, NULL), |
32 delegate_view_override_(NULL), | 32 delegate_view_override_(NULL), |
33 expect_set_history_offset_and_length_(false), | 33 expect_set_history_offset_and_length_(false), |
34 expect_set_history_offset_and_length_history_length_(0) { | 34 expect_set_history_offset_and_length_history_length_(0), |
35 save_frame_headers_(std::string()) { | |
Avi (use Gerrit)
2015/05/11 20:52:29
You don't need to initialize objects that initiali
Not at Google. Contact bengr
2015/05/11 22:43:14
Done.
| |
35 } | 36 } |
36 | 37 |
37 TestWebContents* TestWebContents::Create(BrowserContext* browser_context, | 38 TestWebContents* TestWebContents::Create(BrowserContext* browser_context, |
38 SiteInstance* instance) { | 39 SiteInstance* instance) { |
39 TestWebContents* test_web_contents = new TestWebContents(browser_context); | 40 TestWebContents* test_web_contents = new TestWebContents(browser_context); |
40 test_web_contents->Init(WebContents::CreateParams(browser_context, instance)); | 41 test_web_contents->Init(WebContents::CreateParams(browser_context, instance)); |
41 test_web_contents->RenderFrameCreated(test_web_contents->GetMainFrame()); | 42 test_web_contents->RenderFrameCreated(test_web_contents->GetMainFrame()); |
42 return test_web_contents; | 43 return test_web_contents; |
43 } | 44 } |
44 | 45 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 params.gesture = NavigationGestureUser; | 105 params.gesture = NavigationGestureUser; |
105 params.was_within_same_page = false; | 106 params.was_within_same_page = false; |
106 params.is_post = false; | 107 params.is_post = false; |
107 params.page_state = PageState::CreateFromURL(url); | 108 params.page_state = PageState::CreateFromURL(url); |
108 | 109 |
109 RenderFrameHostImpl* rfhi = | 110 RenderFrameHostImpl* rfhi = |
110 static_cast<RenderFrameHostImpl*>(render_frame_host); | 111 static_cast<RenderFrameHostImpl*>(render_frame_host); |
111 rfhi->frame_tree_node()->navigator()->DidNavigate(rfhi, params); | 112 rfhi->frame_tree_node()->navigator()->DidNavigate(rfhi, params); |
112 } | 113 } |
113 | 114 |
115 const std::string& TestWebContents::GetSaveFrameHeaders() { | |
116 return save_frame_headers_; | |
117 } | |
118 | |
114 bool TestWebContents::CrossProcessNavigationPending() { | 119 bool TestWebContents::CrossProcessNavigationPending() { |
115 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 120 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
116 switches::kEnableBrowserSideNavigation)) { | 121 switches::kEnableBrowserSideNavigation)) { |
117 return GetRenderManager()->speculative_render_frame_host_ && | 122 return GetRenderManager()->speculative_render_frame_host_ && |
118 static_cast<TestRenderFrameHost*>( | 123 static_cast<TestRenderFrameHost*>( |
119 GetRenderManager()->speculative_render_frame_host_.get()) | 124 GetRenderManager()->speculative_render_frame_host_.get()) |
120 ->pending_commit(); | 125 ->pending_commit(); |
121 } | 126 } |
122 return GetRenderManager()->pending_frame_host() != nullptr; | 127 return GetRenderManager()->pending_frame_host() != nullptr; |
123 } | 128 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 bool user_gesture) { | 283 bool user_gesture) { |
279 } | 284 } |
280 | 285 |
281 void TestWebContents::ShowCreatedWidget(int route_id, | 286 void TestWebContents::ShowCreatedWidget(int route_id, |
282 const gfx::Rect& initial_rect) { | 287 const gfx::Rect& initial_rect) { |
283 } | 288 } |
284 | 289 |
285 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { | 290 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { |
286 } | 291 } |
287 | 292 |
293 void TestWebContents::SaveFrameWithHeaders(const GURL& url, | |
294 const Referrer& referrer, | |
295 const std::string& headers) { | |
296 save_frame_headers_ = headers; | |
297 } | |
298 | |
288 } // namespace content | 299 } // namespace content |
OLD | NEW |