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

Side by Side Diff: content/public/test/render_view_test.cc

Issue 1206753003: Add a TestRenderFrame to use in RenderViewTests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Nasko's comments 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
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/public/test/render_view_test.h" 5 #include "content/public/test/render_view_test.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/public/test/frame_load_waiter.h" 22 #include "content/public/test/frame_load_waiter.h"
23 #include "content/renderer/history_controller.h" 23 #include "content/renderer/history_controller.h"
24 #include "content/renderer/history_serialization.h" 24 #include "content/renderer/history_serialization.h"
25 #include "content/renderer/render_thread_impl.h" 25 #include "content/renderer/render_thread_impl.h"
26 #include "content/renderer/render_view_impl.h" 26 #include "content/renderer/render_view_impl.h"
27 #include "content/renderer/renderer_blink_platform_impl.h" 27 #include "content/renderer/renderer_blink_platform_impl.h"
28 #include "content/renderer/renderer_main_platform_delegate.h" 28 #include "content/renderer/renderer_main_platform_delegate.h"
29 #include "content/test/fake_compositor_dependencies.h" 29 #include "content/test/fake_compositor_dependencies.h"
30 #include "content/test/mock_render_process.h" 30 #include "content/test/mock_render_process.h"
31 #include "content/test/test_content_client.h" 31 #include "content/test/test_content_client.h"
32 #include "content/test/test_render_frame.h"
32 #include "third_party/WebKit/public/platform/WebScreenInfo.h" 33 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
33 #include "third_party/WebKit/public/platform/WebURLRequest.h" 34 #include "third_party/WebKit/public/platform/WebURLRequest.h"
34 #include "third_party/WebKit/public/web/WebDocument.h" 35 #include "third_party/WebKit/public/web/WebDocument.h"
35 #include "third_party/WebKit/public/web/WebHistoryItem.h" 36 #include "third_party/WebKit/public/web/WebHistoryItem.h"
36 #include "third_party/WebKit/public/web/WebInputElement.h" 37 #include "third_party/WebKit/public/web/WebInputElement.h"
37 #include "third_party/WebKit/public/web/WebInputEvent.h" 38 #include "third_party/WebKit/public/web/WebInputEvent.h"
38 #include "third_party/WebKit/public/web/WebKit.h" 39 #include "third_party/WebKit/public/web/WebKit.h"
39 #include "third_party/WebKit/public/web/WebLocalFrame.h" 40 #include "third_party/WebKit/public/web/WebLocalFrame.h"
40 #include "third_party/WebKit/public/web/WebScriptSource.h" 41 #include "third_party/WebKit/public/web/WebScriptSource.h"
41 #include "third_party/WebKit/public/web/WebView.h" 42 #include "third_party/WebKit/public/web/WebView.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return blink_platform_impl_.get(); 123 return blink_platform_impl_.get();
123 } 124 }
124 125
125 scheduler::RendererScheduler* 126 scheduler::RendererScheduler*
126 RenderViewTest::RendererBlinkPlatformImplNoSandbox::Scheduler() const { 127 RenderViewTest::RendererBlinkPlatformImplNoSandbox::Scheduler() const {
127 return renderer_scheduler_.get(); 128 return renderer_scheduler_.get();
128 } 129 }
129 130
130 RenderViewTest::RenderViewTest() 131 RenderViewTest::RenderViewTest()
131 : view_(NULL) { 132 : view_(NULL) {
133 RenderFrameImpl::InstallCreateHook(&TestRenderFrame::CreateTestRenderFrame);
132 } 134 }
133 135
134 RenderViewTest::~RenderViewTest() { 136 RenderViewTest::~RenderViewTest() {
135 } 137 }
136 138
137 void RenderViewTest::ProcessPendingMessages() { 139 void RenderViewTest::ProcessPendingMessages() {
138 msg_loop_.task_runner()->PostTask(FROM_HERE, 140 msg_loop_.task_runner()->PostTask(FROM_HERE,
139 base::MessageLoop::QuitClosure()); 141 base::MessageLoop::QuitClosure());
140 msg_loop_.Run(); 142 msg_loop_.Run();
141 } 143 }
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 430 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
429 impl->focusedNodeChanged(blink::WebNode(), node); 431 impl->focusedNodeChanged(blink::WebNode(), node);
430 } 432 }
431 433
432 void RenderViewTest::Reload(const GURL& url) { 434 void RenderViewTest::Reload(const GURL& url) {
433 CommonNavigationParams common_params( 435 CommonNavigationParams common_params(
434 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD, 436 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD,
435 true, base::TimeTicks(), FrameMsg_UILoadMetricsReportType::NO_REPORT, 437 true, base::TimeTicks(), FrameMsg_UILoadMetricsReportType::NO_REPORT,
436 GURL(), GURL()); 438 GURL(), GURL());
437 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 439 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
438 impl->GetMainRenderFrame()->OnNavigate(common_params, StartNavigationParams(), 440 TestRenderFrame* frame =
439 RequestNavigationParams()); 441 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame());
440 FrameLoadWaiter(impl->GetMainRenderFrame()).Wait(); 442 frame->Navigate(common_params, StartNavigationParams(),
443 RequestNavigationParams());
444 FrameLoadWaiter(frame).Wait();
441 } 445 }
442 446
443 uint32 RenderViewTest::GetNavigationIPCType() { 447 uint32 RenderViewTest::GetNavigationIPCType() {
444 return FrameHostMsg_DidCommitProvisionalLoad::ID; 448 return FrameHostMsg_DidCommitProvisionalLoad::ID;
445 } 449 }
446 450
447 void RenderViewTest::Resize(gfx::Size new_size, 451 void RenderViewTest::Resize(gfx::Size new_size,
448 gfx::Rect resizer_rect, 452 gfx::Rect resizer_rect,
449 bool is_fullscreen_granted) { 453 bool is_fullscreen_granted) {
450 ViewMsg_Resize_Params params; 454 ViewMsg_Resize_Params params;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 FrameMsg_Navigate_Type::NORMAL, true, base::TimeTicks(), 569 FrameMsg_Navigate_Type::NORMAL, true, base::TimeTicks(),
566 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL()); 570 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL());
567 RequestNavigationParams request_params; 571 RequestNavigationParams request_params;
568 request_params.page_state = state; 572 request_params.page_state = state;
569 request_params.page_id = impl->page_id_ + offset; 573 request_params.page_id = impl->page_id_ + offset;
570 request_params.nav_entry_id = pending_offset + 1; 574 request_params.nav_entry_id = pending_offset + 1;
571 request_params.pending_history_list_offset = pending_offset; 575 request_params.pending_history_list_offset = pending_offset;
572 request_params.current_history_list_offset = impl->history_list_offset_; 576 request_params.current_history_list_offset = impl->history_list_offset_;
573 request_params.current_history_list_length = history_list_length; 577 request_params.current_history_list_length = history_list_length;
574 578
575 impl->GetMainRenderFrame()->OnNavigate(common_params, StartNavigationParams(), 579 TestRenderFrame* frame =
576 request_params); 580 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame());
581 frame->Navigate(common_params, StartNavigationParams(), request_params);
577 582
578 // The load actually happens asynchronously, so we pump messages to process 583 // The load actually happens asynchronously, so we pump messages to process
579 // the pending continuation. 584 // the pending continuation.
580 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); 585 FrameLoadWaiter(frame).Wait();
581 } 586 }
582 587
583 } // namespace content 588 } // namespace content
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698