Index: content/shell/renderer/test_runner/web_test_proxy.cc |
diff --git a/content/shell/renderer/test_runner/web_test_proxy.cc b/content/shell/renderer/test_runner/web_test_proxy.cc |
index da62fc05f003e2c24df25866a0e3c31f7676eddf..37aa1f7bfaf859ddb2a809c3fcb91fe071f6d810 100644 |
--- a/content/shell/renderer/test_runner/web_test_proxy.cc |
+++ b/content/shell/renderer/test_runner/web_test_proxy.cc |
@@ -375,6 +375,7 @@ blink::WebView* WebTestProxyBase::GetWebView() const { |
} |
void WebTestProxyBase::Reset() { |
+ drag_image_.reset(); |
animate_scheduled_ = false; |
resource_identifier_map_.clear(); |
log_console_output_ = true; |
@@ -565,6 +566,24 @@ void WebTestProxyBase::CapturePixelsAsync( |
TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); |
DCHECK(!callback.is_null()); |
+ if (test_interfaces_->GetTestRunner()->shouldDumpDragImage()) { |
+ if (drag_image_.isNull()) { |
+ // This means the test called dumpDragImage but did not initiate a drag. |
+ // Return a blank image so that the test fails. |
+ SkBitmap bitmap; |
+ bitmap.allocN32Pixels(1, 1); |
+ { |
+ SkAutoLockPixels lock(bitmap); |
+ bitmap.eraseColor(0); |
+ } |
+ callback.Run(bitmap); |
+ return; |
+ } |
+ |
+ callback.Run(drag_image_.getSkBitmap()); |
+ return; |
+ } |
+ |
if (test_interfaces_->GetTestRunner()->isPrinting()) { |
base::MessageLoopProxy::current()->PostTask( |
FROM_HERE, |
@@ -806,6 +825,10 @@ void WebTestProxyBase::StartDragging(blink::WebLocalFrame* frame, |
blink::WebDragOperationsMask mask, |
const blink::WebImage& image, |
const blink::WebPoint& point) { |
+ if (test_interfaces_->GetTestRunner()->shouldDumpDragImage()) { |
+ if (drag_image_.isNull()) |
+ drag_image_ = image; |
+ } |
// When running a test, we need to fake a drag drop operation otherwise |
// Windows waits for real mouse events to know when the drag is over. |
test_interfaces_->GetEventSender()->DoDragDrop(data, mask); |