Chromium Code Reviews| 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 e3838f6481af96bc6dddcad9c6b5b929aafc52a9..6ae6f98e06cbced83c27c988b37ab84d87ef1b3b 100644 |
| --- a/content/shell/renderer/test_runner/web_test_proxy.cc |
| +++ b/content/shell/renderer/test_runner/web_test_proxy.cc |
| @@ -26,7 +26,9 @@ |
| #include "content/shell/renderer/test_runner/web_test_runner.h" |
| // FIXME: Including platform_canvas.h here is a layering violation. |
| #include "skia/ext/platform_canvas.h" |
| +#include "third_party/WebKit/public/platform/Platform.h" |
| #include "third_party/WebKit/public/platform/WebCString.h" |
| +#include "third_party/WebKit/public/platform/WebClipboard.h" |
| #include "third_party/WebKit/public/platform/WebURLError.h" |
| #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| @@ -468,6 +470,20 @@ void WebTestProxyBase::SetAcceptLanguages(const std::string& accept_languages) { |
| GetWebView()->acceptLanguagesChanged(); |
| } |
| +void WebTestProxyBase::CopyAtAndCapturePixels( |
| + const int x, const int y, const base::Callback<void(const SkBitmap&)>& callback) { |
| + DCHECK(web_widget_->isAcceleratedCompositingActive()); |
| + DCHECK(!callback.is_null()); |
| + |
| + GetWebView()->copyImageAt(blink::WebPoint(x, y)); |
| + blink::WebData data = blink::Platform::current()->clipboard()->readImage(blink::WebClipboard::Buffer()); |
|
Ken Russell (switch to Gerrit)
2014/07/16 20:40:50
You'll need to handle the case where WebView::copy
hj.r.chung
2014/07/17 05:33:40
I added a test in the Blink patch. Thanks!
|
| + blink::WebImage image = blink::WebImage::fromData(data, blink::WebSize()); |
| + const SkBitmap& bitmap = image.getSkBitmap(); |
| + SkAutoLockPixels autoLock(bitmap); |
| + callback.Run(bitmap); |
| +} |
| + |
| + |
| void WebTestProxyBase::CapturePixelsForPrinting( |
| const base::Callback<void(const SkBitmap&)>& callback) { |
| web_widget_->layout(); |