Chromium Code Reviews| Index: content/shell/renderer/layout_test/blink_test_runner.cc |
| diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc |
| index 13f30a302d973daf4c7a7e3b3b05c304fc53bff9..5eb43681081cbe9598fa825c7c20d26be358a47c 100644 |
| --- a/content/shell/renderer/layout_test/blink_test_runner.cc |
| +++ b/content/shell/renderer/layout_test/blink_test_runner.cc |
| @@ -15,6 +15,7 @@ |
| #include "base/compiler_specific.h" |
| #include "base/debug/debugger.h" |
| #include "base/files/file_path.h" |
| +#include "base/guid.h" |
| #include "base/location.h" |
| #include "base/macros.h" |
| #include "base/md5.h" |
| @@ -34,6 +35,7 @@ |
| #include "components/test_runner/layout_dump_flags.h" |
| #include "components/test_runner/mock_screen_orientation_client.h" |
| #include "components/test_runner/test_interfaces.h" |
| +#include "components/test_runner/tracked_dictionary.h" |
| #include "components/test_runner/web_task.h" |
| #include "components/test_runner/web_test_interfaces.h" |
| #include "components/test_runner/web_test_proxy.h" |
| @@ -252,8 +254,8 @@ BlinkTestRunner::BlinkTestRunner(RenderView* render_view) |
| focused_view_(NULL), |
| is_main_window_(false), |
| focus_on_next_commit_(false), |
| - leak_detector_(new LeakDetector(this)) { |
| -} |
| + leak_detector_(new LeakDetector(this)), |
| + guid_(base::GenerateGUID()) {} |
| BlinkTestRunner::~BlinkTestRunner() { |
| } |
| @@ -610,6 +612,20 @@ void BlinkTestRunner::SetLocale(const std::string& locale) { |
| setlocale(LC_ALL, locale.c_str()); |
| } |
| +void BlinkTestRunner::OnLayoutDumpFlagsChanged( |
| + test_runner::LayoutDumpFlags* layout_dump_flags) { |
| + // Ignore changes that happen before we got the initial, accumulated |
| + // layout flag changes in ShellViewMsg_ReplicateTestConfiguration. |
| + if (!is_main_window_) |
| + return; |
| + |
| + const base::DictionaryValue& changed_values = |
| + layout_dump_flags->tracked_dictionary().changed_values(); |
| + Send(new ShellViewHostMsg_LayoutDumpFlagsChanged(routing_id(), changed_values, |
| + guid_)); |
| + layout_dump_flags->tracked_dictionary().ResetChangeTracking(); |
| +} |
| + |
| void BlinkTestRunner::TestFinished() { |
| if (!is_main_window_ || !render_view()->GetMainRenderFrame()) { |
| Send(new ShellViewHostMsg_TestFinishedInSecondaryRenderer(routing_id())); |
| @@ -896,8 +912,7 @@ void BlinkTestRunner::CaptureDump() { |
| return; |
| } |
| - Send( |
| - new ShellViewHostMsg_InitiateLayoutDump(routing_id(), layout_dump_flags)); |
| + Send(new ShellViewHostMsg_InitiateLayoutDump(routing_id())); |
| // OnLayoutDumpCompleted will be eventually called by an IPC from the browser. |
| } |
| @@ -969,7 +984,7 @@ void BlinkTestRunner::CaptureDumpComplete() { |
| new ShellViewHostMsg_TestFinished(routing_id()))); |
| } |
| -void BlinkTestRunner::OnReplicateTestConfiguration( |
| +void BlinkTestRunner::SetTestConfiguration( |
| const ShellTestConfiguration& params) { |
| test_config_ = params; |
| is_main_window_ = true; |
| @@ -981,9 +996,19 @@ void BlinkTestRunner::OnReplicateTestConfiguration( |
| params.enable_pixel_dumping); |
| } |
| +void BlinkTestRunner::OnReplicateTestConfiguration( |
| + const ShellTestConfiguration& params, |
| + const base::DictionaryValue& accumulated_layout_dump_flags_changes) { |
| + SetTestConfiguration(params); |
| + LayoutTestRenderProcessObserver::GetInstance() |
| + ->test_interfaces() |
| + ->TestRunner() |
| + ->ReplicateLayoutDumpFlagsChanges(accumulated_layout_dump_flags_changes); |
| +} |
| + |
| void BlinkTestRunner::OnSetTestConfiguration( |
| const ShellTestConfiguration& params) { |
| - OnReplicateTestConfiguration(params); |
| + SetTestConfiguration(params); |
| ForceResizeRenderView( |
| render_view(), |
| @@ -991,6 +1016,18 @@ void BlinkTestRunner::OnSetTestConfiguration( |
| SetFocus(proxy_, true); |
| } |
| +void BlinkTestRunner::OnReplicateLayoutDumpFlagsChanges( |
| + const base::DictionaryValue& changed_layout_dump_flags, |
| + const std::string& change_originator_guid) { |
| + if (change_originator_guid == guid_) |
| + return; |
|
Łukasz Anforowicz
2016/03/03 21:46:34
We want to avoid consuming change notification bro
|
| + |
| + LayoutTestRenderProcessObserver::GetInstance() |
| + ->test_interfaces() |
| + ->TestRunner() |
| + ->ReplicateLayoutDumpFlagsChanges(changed_layout_dump_flags); |
| +} |
| + |
| void BlinkTestRunner::OnSessionHistory( |
| const std::vector<int>& routing_ids, |
| const std::vector<std::vector<PageState>>& session_histories, |