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

Unified Diff: content/shell/browser/layout_test/blink_test_controller.cc

Issue 2594913002: Replace IPC messages in layout_test_render_frame_observer. (Closed)
Patch Set: Change following review Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
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..4a806d5a72eeeb144ab0deed11fc0c7baf7a0e2f 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();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698