OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/test_runner/pixel_dump.h" | 5 #include "components/test_runner/pixel_dump.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "components/test_runner/layout_test_runtime_flags.h" | 14 #include "components/test_runner/layout_test_runtime_flags.h" |
15 // FIXME: Including platform_canvas.h here is a layering violation. | 15 // FIXME: Including platform_canvas.h here is a layering violation. |
16 #include "skia/ext/platform_canvas.h" | 16 #include "skia/ext/platform_canvas.h" |
17 #include "third_party/WebKit/public/platform/Platform.h" | 17 #include "third_party/WebKit/public/platform/Platform.h" |
18 #include "third_party/WebKit/public/platform/WebClipboard.h" | |
19 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" | 18 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" |
20 #include "third_party/WebKit/public/platform/WebData.h" | |
21 #include "third_party/WebKit/public/platform/WebImage.h" | 19 #include "third_party/WebKit/public/platform/WebImage.h" |
| 20 #include "third_party/WebKit/public/platform/WebMockClipboard.h" |
22 #include "third_party/WebKit/public/platform/WebPoint.h" | 21 #include "third_party/WebKit/public/platform/WebPoint.h" |
23 #include "third_party/WebKit/public/web/WebFrame.h" | 22 #include "third_party/WebKit/public/web/WebFrame.h" |
24 #include "third_party/WebKit/public/web/WebPagePopup.h" | 23 #include "third_party/WebKit/public/web/WebPagePopup.h" |
25 #include "third_party/WebKit/public/web/WebPrintParams.h" | 24 #include "third_party/WebKit/public/web/WebPrintParams.h" |
26 #include "third_party/WebKit/public/web/WebView.h" | 25 #include "third_party/WebKit/public/web/WebView.h" |
27 #include "ui/gfx/geometry/point.h" | 26 #include "ui/gfx/geometry/point.h" |
28 | 27 |
29 namespace test_runner { | 28 namespace test_runner { |
30 | 29 |
31 namespace { | 30 namespace { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 blink::WebClipboard::Buffer()); | 184 blink::WebClipboard::Buffer()); |
186 web_view->copyImageAt(blink::WebPoint(x, y)); | 185 web_view->copyImageAt(blink::WebPoint(x, y)); |
187 if (sequence_number == | 186 if (sequence_number == |
188 blink::Platform::current()->clipboard()->sequenceNumber( | 187 blink::Platform::current()->clipboard()->sequenceNumber( |
189 blink::WebClipboard::Buffer())) { | 188 blink::WebClipboard::Buffer())) { |
190 SkBitmap emptyBitmap; | 189 SkBitmap emptyBitmap; |
191 callback.Run(emptyBitmap); | 190 callback.Run(emptyBitmap); |
192 return; | 191 return; |
193 } | 192 } |
194 | 193 |
195 blink::WebData data = blink::Platform::current()->clipboard()->readImage( | 194 blink::WebImage image = static_cast<blink::WebMockClipboard*>( |
196 blink::WebClipboard::Buffer()); | 195 blink::Platform::current()->clipboard()) |
197 blink::WebImage image = blink::WebImage::fromData(data, blink::WebSize()); | 196 ->readRawImage(blink::WebClipboard::Buffer()); |
198 const SkBitmap& bitmap = image.getSkBitmap(); | 197 const SkBitmap& bitmap = image.getSkBitmap(); |
199 SkAutoLockPixels autoLock(bitmap); | 198 SkAutoLockPixels autoLock(bitmap); |
200 callback.Run(bitmap); | 199 callback.Run(bitmap); |
201 } | 200 } |
202 | 201 |
203 } // namespace test_runner | 202 } // namespace test_runner |
OLD | NEW |