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 803041c0dd22052a70345e1cfb13a85d66b0666b..302330d98e301b198e1460d06391c09f8b69259d 100644 |
--- a/content/shell/browser/layout_test/blink_test_controller.cc |
+++ b/content/shell/browser/layout_test/blink_test_controller.cc |
@@ -7,6 +7,7 @@ |
#include <stddef.h> |
#include <iostream> |
+#include <set> |
#include <utility> |
#include "base/base64.h" |
@@ -269,6 +270,7 @@ bool BlinkTestController::PrepareForLayoutTest( |
printer_->reset(); |
frame_to_layout_dump_map_.clear(); |
render_process_host_observer_.RemoveAll(); |
+ accumulated_layout_dump_flags_changes_.Clear(); |
ShellBrowserContext* browser_context = |
ShellContentBrowserClient::Get()->browser_context(); |
if (test_url.spec().find("compositing/") != std::string::npos) |
@@ -440,6 +442,8 @@ bool BlinkTestController::OnMessageReceived( |
bool handled = true; |
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(BlinkTestController, message, |
render_frame_host) |
+ IPC_MESSAGE_HANDLER(ShellViewHostMsg_LayoutDumpFlagsChanged, |
+ OnLayoutDumpFlagsChanged) |
IPC_MESSAGE_HANDLER(ShellViewHostMsg_LayoutDumpResponse, |
OnLayoutDumpResponse) |
IPC_MESSAGE_UNHANDLED(handled = false) |
@@ -601,7 +605,7 @@ void BlinkTestController::HandleNewRenderFrameHost(RenderFrameHost* frame) { |
new ShellViewMsg_SetTestConfiguration(frame->GetRoutingID(), params)); |
} else { |
frame->Send(new ShellViewMsg_ReplicateTestConfiguration( |
- frame->GetRoutingID(), params)); |
+ frame->GetRoutingID(), params, accumulated_layout_dump_flags_changes_)); |
} |
} |
@@ -667,11 +671,36 @@ void BlinkTestController::OnTextDump(const std::string& dump) { |
printer_->PrintTextFooter(); |
} |
-void BlinkTestController::OnInitiateLayoutDump( |
- const test_runner::LayoutDumpFlags& layout_dump_flags) { |
- DCHECK(layout_dump_flags.dump_child_frames()); |
+void BlinkTestController::OnInitiateLayoutDump() { |
pending_layout_dumps_ = main_window_->web_contents()->SendToAllFrames( |
- new ShellViewMsg_LayoutDumpRequest(MSG_ROUTING_NONE, layout_dump_flags)); |
+ new ShellViewMsg_LayoutDumpRequest(MSG_ROUTING_NONE)); |
+} |
+ |
+void BlinkTestController::OnLayoutDumpFlagsChanged( |
+ RenderFrameHost* sender, |
+ const base::DictionaryValue& changed_layout_dump_flags) { |
+ // Stash the changes for future renderers. |
+ accumulated_layout_dump_flags_changes_.MergeDictionary( |
+ &changed_layout_dump_flags); |
+ |
+ // Only need to send the propagation message once per renderer process. |
+ std::set<int> already_covered_process_ids; |
dcheng
2016/03/08 23:09:37
Will we have a better way of doing this in the fut
Łukasz Anforowicz
2016/03/10 22:24:21
This is a very good question. I don't know the an
dcheng
2016/03/12 01:21:50
Please don't block this CL on my objections. At th
Łukasz Anforowicz
2016/03/14 16:23:13
Cool, thanks. :-)
|
+ |
+ // No need to propagate the changes back to the process that originated them. |
+ // (propagating them back could also clobber subsequent changes in the |
+ // originator). |
+ already_covered_process_ids.insert(sender->GetProcess()->GetID()); |
+ |
+ // Propagate the changes to all the renderer processes associated with the |
+ // main window. |
+ for (RenderFrameHost* frame : main_window_->web_contents()->GetAllFrames()) { |
+ bool inserted_new_item = |
+ already_covered_process_ids.insert(frame->GetProcess()->GetID()).second; |
+ if (inserted_new_item) { |
+ frame->Send(new ShellViewMsg_ReplicateLayoutDumpFlagsChanges( |
+ frame->GetRoutingID(), changed_layout_dump_flags)); |
+ } |
+ } |
} |
void BlinkTestController::OnLayoutDumpResponse(RenderFrameHost* sender, |