Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: content/test/test_web_contents.cc

Issue 1151973005: Bring RFH/RVH unit tests closer to reality of how RF/RV are initialized (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add workaround to <webview> bug (492830) Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 20 matching lines...) Expand all
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 } 35 }
36 36
37 TestWebContents* TestWebContents::Create(BrowserContext* browser_context, 37 TestWebContents* TestWebContents::Create(BrowserContext* browser_context,
38 SiteInstance* instance) { 38 SiteInstance* instance) {
39 TestWebContents* test_web_contents = new TestWebContents(browser_context); 39 TestWebContents* test_web_contents = new TestWebContents(browser_context);
40 test_web_contents->Init(WebContents::CreateParams(browser_context, instance)); 40 test_web_contents->Init(WebContents::CreateParams(browser_context, instance));
41 test_web_contents->RenderFrameCreated(test_web_contents->GetMainFrame());
42 return test_web_contents; 41 return test_web_contents;
43 } 42 }
44 43
45 TestWebContents::~TestWebContents() { 44 TestWebContents::~TestWebContents() {
46 EXPECT_FALSE(expect_set_history_offset_and_length_); 45 EXPECT_FALSE(expect_set_history_offset_and_length_);
47 } 46 }
48 47
49 TestRenderFrameHost* TestWebContents::GetMainFrame() { 48 TestRenderFrameHost* TestWebContents::GetMainFrame() {
50 return static_cast<TestRenderFrameHost*>(WebContentsImpl::GetMainFrame()); 49 return static_cast<TestRenderFrameHost*>(WebContentsImpl::GetMainFrame());
51 } 50 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 params.should_update_history = false; 98 params.should_update_history = false;
100 params.searchable_form_url = GURL(); 99 params.searchable_form_url = GURL();
101 params.searchable_form_encoding = std::string(); 100 params.searchable_form_encoding = std::string();
102 params.did_create_new_entry = did_create_new_entry; 101 params.did_create_new_entry = did_create_new_entry;
103 params.security_info = std::string(); 102 params.security_info = std::string();
104 params.gesture = NavigationGestureUser; 103 params.gesture = NavigationGestureUser;
105 params.was_within_same_page = false; 104 params.was_within_same_page = false;
106 params.is_post = false; 105 params.is_post = false;
107 params.page_state = PageState::CreateFromURL(url); 106 params.page_state = PageState::CreateFromURL(url);
108 107
109 RenderFrameHostImpl* rfhi = 108 TestRenderFrameHost* rfh =
110 static_cast<RenderFrameHostImpl*>(render_frame_host); 109 static_cast<TestRenderFrameHost*>(render_frame_host);
111 rfhi->frame_tree_node()->navigator()->DidNavigate(rfhi, params); 110 rfh->InitializeRenderFrameIfNeeded();
111 rfh->frame_tree_node()->navigator()->DidNavigate(rfh, params);
112 } 112 }
113 113
114 const std::string& TestWebContents::GetSaveFrameHeaders() { 114 const std::string& TestWebContents::GetSaveFrameHeaders() {
115 return save_frame_headers_; 115 return save_frame_headers_;
116 } 116 }
117 117
118 bool TestWebContents::CrossProcessNavigationPending() { 118 bool TestWebContents::CrossProcessNavigationPending() {
119 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 119 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
120 switches::kEnableBrowserSideNavigation)) { 120 switches::kEnableBrowserSideNavigation)) {
121 return GetRenderManager()->speculative_render_frame_host_ && 121 return GetRenderManager()->speculative_render_frame_host_ &&
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { 289 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) {
290 } 290 }
291 291
292 void TestWebContents::SaveFrameWithHeaders(const GURL& url, 292 void TestWebContents::SaveFrameWithHeaders(const GURL& url,
293 const Referrer& referrer, 293 const Referrer& referrer,
294 const std::string& headers) { 294 const std::string& headers) {
295 save_frame_headers_ = headers; 295 save_frame_headers_ = headers;
296 } 296 }
297 297
298 } // namespace content 298 } // namespace content
OLDNEW
« content/browser/frame_host/render_frame_host_impl.cc ('K') | « content/test/test_render_view_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698