Chromium Code Reviews| Index: content/shell/browser/layout_test/blink_test_controller.cc |
| diff --git a/content/shell/browser/layout_test/blink_test_controller.cc b/content/shell/browser/layout_test/blink_test_controller.cc |
| index e318bf9d1b81e132496a79a3770ba2057b29b142..36fa50bdb83783be91ca205f14f6d9bae5623a82 100644 |
| --- a/content/shell/browser/layout_test/blink_test_controller.cc |
| +++ b/content/shell/browser/layout_test/blink_test_controller.cc |
| @@ -38,6 +38,7 @@ |
| #include "content/public/browser/service_worker_context.h" |
| #include "content/public/browser/storage_partition.h" |
| #include "content/public/browser/web_contents.h" |
| +#include "content/public/common/associated_interface_provider.h" |
| #include "content/public/common/bindings_policy.h" |
| #include "content/public/common/content_switches.h" |
| #include "content/public/common/url_constants.h" |
| @@ -280,6 +281,7 @@ bool BlinkTestController::PrepareForLayoutTest( |
| all_observed_render_process_hosts_.clear(); |
| main_window_render_process_hosts_.clear(); |
| accumulated_layout_test_runtime_flags_changes_.Clear(); |
| + layout_test_control_map_.clear(); |
| ShellBrowserContext* browser_context = |
| ShellContentBrowserClient::Get()->browser_context(); |
| is_compositing_test_ = |
| @@ -618,12 +620,10 @@ void BlinkTestController::HandleNewRenderFrameHost(RenderFrameHost* frame) { |
| params.initial_size = initial_size_; |
| if (did_send_initial_test_configuration_) { |
| - frame->Send(new ShellViewMsg_ReplicateTestConfiguration( |
| - frame->GetRoutingID(), params)); |
| + GetLayoutTestControlPtr(frame)->ReplicateTestConfiguration(params); |
| } else { |
| did_send_initial_test_configuration_ = true; |
| - frame->Send( |
| - new ShellViewMsg_SetTestConfiguration(frame->GetRoutingID(), params)); |
| + GetLayoutTestControlPtr(frame)->SetTestConfiguration(params); |
| } |
| } |
| @@ -633,8 +633,7 @@ void BlinkTestController::HandleNewRenderFrameHost(RenderFrameHost* frame) { |
| all_observed_render_process_hosts_.insert(process); |
| if (!main_window) { |
| - frame->Send( |
| - new ShellViewMsg_SetupSecondaryRenderer(frame->GetRoutingID())); |
| + GetLayoutTestControlPtr(frame)->SetupSecondaryRenderer(); |
| } |
| process->Send(new LayoutTestMsg_ReplicateLayoutTestRuntimeFlagsChanges( |
| @@ -705,8 +704,16 @@ void BlinkTestController::OnTextDump(const std::string& dump) { |
| } |
| void BlinkTestController::OnInitiateLayoutDump() { |
| - pending_layout_dumps_ = main_window_->web_contents()->SendToAllFrames( |
| - new ShellViewMsg_LayoutDumpRequest(MSG_ROUTING_NONE)); |
| + int number_of_messages = 0; |
| + for (RenderFrameHost* rfh : main_window_->web_contents()->GetAllFrames()) { |
| + if (!rfh->IsRenderFrameLive()) |
| + continue; |
| + |
| + ++number_of_messages; |
| + GetLayoutTestControlPtr(rfh)->LayoutDumpRequest(); |
| + } |
| + |
| + pending_layout_dumps_ = number_of_messages; |
| } |
| void BlinkTestController::OnLayoutTestRuntimeFlagsChanged( |
| @@ -954,4 +961,13 @@ void BlinkTestController::OnSendBluetoothManualChooserEvent( |
| bluetooth_chooser_factory_->SendEvent(event, argument); |
| } |
| +mojom::LayoutTestControl* BlinkTestController::GetLayoutTestControlPtr( |
| + RenderFrameHost* frame) { |
| + if (layout_test_control_map_.find(frame) == layout_test_control_map_.end()) { |
| + frame->GetRemoteAssociatedInterfaces()->GetInterface( |
| + &layout_test_control_map_[frame]); |
| + } |
| + return layout_test_control_map_[frame].get(); |
|
Mike West
2017/01/20 12:04:24
Nit: Maybe DCHECK that we end up with a pointer?
Jia
2017/01/23 02:37:39
Done.
|
| +} |
| + |
| } // namespace content |