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

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

Issue 1736353002: ABANDONED CL: Shared-memory-based approach to layout tests runtime flags replication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 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
« no previous file with comments | « content/shell/browser/layout_test/blink_test_controller.h ('k') | content/shell/common/shell_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fab7797f2a6b0b0ff1c0b0ce5a90db348c0c04c1 100644
--- a/content/shell/browser/layout_test/blink_test_controller.cc
+++ b/content/shell/browser/layout_test/blink_test_controller.cc
@@ -260,6 +260,17 @@ bool BlinkTestController::PrepareForLayoutTest(
bool enable_pixel_dumping,
const std::string& expected_pixel_hash) {
DCHECK(CalledOnValidThread());
+ VLOG(1) << "Preparing for the next layout test...";
+
+ if (!base::SharedMemory::IsHandleValid(layout_dump_flags_memory_.handle())) {
+ if (!layout_dump_flags_memory_.CreateAnonymous(
+ sizeof(test_runner::LayoutDumpFlags))) {
+ // TODO / DO NOT SUBMIT: Report the error somehow.
+ CHECK(false);
+ }
+ }
+ DCHECK(base::SharedMemory::IsHandleValid(layout_dump_flags_memory_.handle()));
+
test_phase_ = DURING_TEST;
current_working_directory_ = current_working_directory;
enable_pixel_dumping_ = enable_pixel_dumping;
@@ -594,6 +605,8 @@ void BlinkTestController::HandleNewRenderFrameHost(RenderFrameHost* frame) {
switches::kAllowExternalPages);
params.expected_pixel_hash = expected_pixel_hash_;
params.initial_size = initial_size_;
+ params.layout_dump_flags_memory_handle =
+ base::SharedMemory::DuplicateHandle(layout_dump_flags_memory_.handle());
if (need_to_send_test_configuration_to_renderer_) {
need_to_send_test_configuration_to_renderer_ = false;
@@ -606,6 +619,8 @@ void BlinkTestController::HandleNewRenderFrameHost(RenderFrameHost* frame) {
}
void BlinkTestController::OnTestFinished() {
+ VLOG(1) << "Test finished";
+
test_phase_ = CLEAN_UP;
if (!printer_->output_finished())
printer_->PrintImageFooter();
@@ -667,15 +682,26 @@ 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());
- pending_layout_dumps_ = main_window_->web_contents()->SendToAllFrames(
- new ShellViewMsg_LayoutDumpRequest(MSG_ROUTING_NONE, layout_dump_flags));
+void BlinkTestController::OnInitiateLayoutDump(bool dump_child_frames) {
+ if (dump_child_frames) {
+ pending_layout_dumps_ = main_window_->web_contents()->SendToAllFrames(
+ new ShellViewMsg_LayoutDumpRequest(MSG_ROUTING_NONE));
+ VLOG(1) << "Asking all " << pending_layout_dumps_
+ << " frames for a layout dump.";
+ } else {
+ VLOG(1) << "Asking the main frame for a layout dump.";
+ RenderFrameHost* main_frame = main_window_->web_contents()->GetMainFrame();
+ main_frame->Send(
+ new ShellViewMsg_LayoutDumpRequest(main_frame->GetRoutingID()));
+ pending_layout_dumps_ = 1;
+ }
}
void BlinkTestController::OnLayoutDumpResponse(RenderFrameHost* sender,
const std::string& dump) {
+ VLOG(1) << "Got layout dump response from frame "
+ << sender->GetFrameTreeNodeId();
+
// Store the result.
auto pair = frame_to_layout_dump_map_.insert(
std::make_pair(sender->GetFrameTreeNodeId(), dump));
@@ -810,6 +836,7 @@ void BlinkTestController::OnCloseRemainingWindows() {
}
void BlinkTestController::OnResetDone() {
+ VLOG(1) << "Reset done.";
if (is_leak_detection_enabled_) {
if (main_window_ && main_window_->web_contents()) {
RenderViewHost* render_view_host =
@@ -820,6 +847,7 @@ void BlinkTestController::OnResetDone() {
return;
}
+ VLOG(1) << "Quitting the message loop...";
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
}
« no previous file with comments | « content/shell/browser/layout_test/blink_test_controller.h ('k') | content/shell/common/shell_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698