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 39c1e32df3f613121db58a49038bb68c4c3a9fe6..d98ee062c2bf1df27c8348b2f366d54bed2612d2 100644 |
--- a/content/shell/renderer/layout_test/blink_test_runner.cc |
+++ b/content/shell/renderer/layout_test/blink_test_runner.cc |
@@ -822,6 +822,7 @@ bool BlinkTestRunner::OnMessageReceived(const IPC::Message& message) { |
IPC_MESSAGE_HANDLER(ShellViewMsg_ReplyBluetoothManualChooserEvents, |
OnReplyBluetoothManualChooserEvents) |
IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpCompleted, OnLayoutDumpCompleted) |
+ IPC_MESSAGE_HANDLER(ShellViewMsg_PixelsDumpResult, OnPixelsDumpResult) |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
@@ -916,6 +917,21 @@ void BlinkTestRunner::OnLayoutDumpCompleted(std::string completed_layout_dump) { |
CaptureDumpContinued(); |
} |
+void BlinkTestRunner::DumpPixelsAsync( |
+ base::OnceCallback<void(const SkBitmap&)> callback) { |
+ DCHECK(!callback.is_null()); // Caller should verify. |
+ CHECK(pixels_dump_callback_.is_null()) |
+ << "Only one pixel dump at a time is supported."; |
+ |
+ pixels_dump_callback_ = std::move(callback); |
+ Send(new ShellViewHostMsg_InitiatePixelsDump(routing_id())); |
+} |
+ |
+void BlinkTestRunner::OnPixelsDumpResult(const SkBitmap& result) { |
+ std::move(pixels_dump_callback_).Run(result); |
+ pixels_dump_callback_.Reset(); |
+} |
+ |
void BlinkTestRunner::CaptureDumpContinued() { |
test_runner::WebTestInterfaces* interfaces = |
LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); |