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

Unified Diff: content/shell/renderer/test_runner/web_test_proxy.cc

Issue 904833004: Add test_runner hook to dump drag image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/renderer/test_runner/test_runner.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cbcaa95030f70178e87cc616f73f35af757cda9b 100644
--- a/content/shell/renderer/test_runner/web_test_proxy.cc
+++ b/content/shell/renderer/test_runner/web_test_proxy.cc
@@ -6,6 +6,7 @@
#include <cctype>
+#include "base/base64.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/logging.h"
@@ -806,6 +807,15 @@ void WebTestProxyBase::StartDragging(blink::WebLocalFrame* frame,
blink::WebDragOperationsMask mask,
const blink::WebImage& image,
const blink::WebPoint& point) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpDragImage()) {
+ const SkBitmap bitmap = image.getSkBitmap();
+ SkAutoLockPixels lock(bitmap);
+ std::string encoded;
+ base::Base64Encode(base::StringPiece(static_cast<char*>(bitmap.getPixels()),
jackhou1 2015/02/10 01:54:20 Is there a better way to represent the image? This
Justin Novosad 2015/02/10 22:37:48 Yeah this is not ideal. It would be much better to
jackhou1 2015/02/11 00:08:24 Just one. And I imagine that would be fine for any
+ bitmap.getSize()),
+ &encoded);
+ delegate_->PrintMessage(std::string("DragImage: ") + encoded + "\n");
+ }
// 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);
« no previous file with comments | « content/shell/renderer/test_runner/test_runner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698