summaryrefslogtreecommitdiffstats
path: root/content/shell/browser
diff options
context:
space:
mode:
authorlukasza <lukasza@chromium.org>2016-03-14 07:06:43 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-14 14:08:07 +0000
commitc9cbe71dd85bad04bf4f0b516614be820bb82b32 (patch)
treeec2d899cdd6f67a46bd8a46d2c563fb4dea3fcea /content/shell/browser
parenteeca8bf8113eaa50fb3aa59666192ef11dd0b574 (diff)
downloadchromium_src-c9cbe71dd85bad04bf4f0b516614be820bb82b32.zip
chromium_src-c9cbe71dd85bad04bf4f0b516614be820bb82b32.tar.gz
chromium_src-c9cbe71dd85bad04bf4f0b516614be820bb82b32.tar.bz2
Replicating LayoutDumpFlags across OOPIFs.
This CL makes sure that LayoutDumpFLags are replicated across OOPIFs. This allows to get rid of all the incorrect "missing" expectations from third_party/WebKit/LayoutTests/FlagExpectations/site-per-process. Replication is done by messages passed between browser and renderers. TestRunner that changes LayoutDumpFlags notifies BlinkTestRunner which sends a message to the browser. The browser 1) broadcasts the changes to all the renderers and 2) stashes accumulated changes so it can send them to new renderers in the future. BUG=587175 Review URL: https://codereview.chromium.org/1715573002 Cr-Commit-Position: refs/heads/master@{#380967}
Diffstat (limited to 'content/shell/browser')
-rw-r--r--content/shell/browser/layout_test/blink_test_controller.cc40
-rw-r--r--content/shell/browser/layout_test/blink_test_controller.h16
2 files changed, 44 insertions, 12 deletions
diff --git a/content/shell/browser/layout_test/blink_test_controller.cc b/content/shell/browser/layout_test/blink_test_controller.cc
index 15d0f39..b823e7f 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"
@@ -20,7 +21,6 @@
#include "base/strings/stringprintf.h"
#include "base/thread_task_runner_handle.h"
#include "build/build_config.h"
-#include "components/test_runner/layout_dump_flags.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/dom_storage_context.h"
#include "content/public/browser/gpu_data_manager.h"
@@ -269,6 +269,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 +441,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)
@@ -597,7 +600,7 @@ void BlinkTestController::HandleNewRenderFrameHost(RenderFrameHost* frame) {
if (did_send_initial_test_configuration_) {
frame->Send(new ShellViewMsg_ReplicateTestConfiguration(
- frame->GetRoutingID(), params));
+ frame->GetRoutingID(), params, accumulated_layout_dump_flags_changes_));
} else {
did_send_initial_test_configuration_ = true;
frame->Send(
@@ -667,11 +670,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;
+
+ // 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,
diff --git a/content/shell/browser/layout_test/blink_test_controller.h b/content/shell/browser/layout_test/blink_test_controller.h
index 165d09f..10d4a44 100644
--- a/content/shell/browser/layout_test/blink_test_controller.h
+++ b/content/shell/browser/layout_test/blink_test_controller.h
@@ -16,6 +16,7 @@
#include "base/scoped_observer.h"
#include "base/synchronization/lock.h"
#include "base/threading/non_thread_safe.h"
+#include "base/values.h"
#include "build/build_config.h"
#include "content/public/browser/bluetooth_chooser.h"
#include "content/public/browser/gpu_data_manager_observer.h"
@@ -33,10 +34,6 @@
class SkBitmap;
-namespace test_runner {
-struct LayoutDumpFlags;
-}
-
namespace url {
class Origin;
}
@@ -194,8 +191,10 @@ class BlinkTestController : public base::NonThreadSafe,
void OnAudioDump(const std::vector<unsigned char>& audio_dump);
void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image);
void OnTextDump(const std::string& dump);
- void OnInitiateLayoutDump(
- const test_runner::LayoutDumpFlags& layout_dump_flags);
+ void OnInitiateLayoutDump();
+ void OnLayoutDumpFlagsChanged(
+ RenderFrameHost* sender,
+ const base::DictionaryValue& changed_layout_dump_flags);
void OnLayoutDumpResponse(RenderFrameHost* sender, const std::string& dump);
void OnPrintMessage(const std::string& message);
void OnOverridePreferences(const WebPreferences& prefs);
@@ -267,6 +266,11 @@ class BlinkTestController : public base::NonThreadSafe,
ScopedObserver<RenderProcessHost, RenderProcessHostObserver>
render_process_host_observer_;
+ // Changes reported by OnLayoutDumpFlagsChanged that have accumulated since
+ // PrepareForLayoutTest (i.e. changes that need to be send to a fresh
+ // renderer created while test is in progress).
+ base::DictionaryValue accumulated_layout_dump_flags_changes_;
+
#if defined(OS_ANDROID)
// Because of the nested message pump implementation, Android needs to allow
// waiting on the UI thread while layout tests are being ran.