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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 | 178 |
179 void CopyImageAtAndCapturePixels( | 179 void CopyImageAtAndCapturePixels( |
180 blink::WebView* web_view, | 180 blink::WebView* web_view, |
181 int x, | 181 int x, |
182 int y, | 182 int y, |
183 const base::Callback<void(const SkBitmap&)>& callback) { | 183 const base::Callback<void(const SkBitmap&)>& callback) { |
184 DCHECK(!callback.is_null()); | 184 DCHECK(!callback.is_null()); |
185 uint64_t sequence_number = | 185 uint64_t sequence_number = |
186 blink::Platform::current()->clipboard()->sequenceNumber( | 186 blink::Platform::current()->clipboard()->sequenceNumber( |
187 blink::WebClipboard::Buffer()); | 187 blink::WebClipboard::Buffer()); |
188 web_view->copyImageAt(blink::WebPoint(x, y)); | 188 web_view->mainFrame()->copyImageAt(blink::WebPoint(x, y)); |
Charlie Reis
2016/06/07 22:51:25
Let's add:
// TODO(lukasza): Support image capture
| |
189 if (sequence_number == | 189 if (sequence_number == |
190 blink::Platform::current()->clipboard()->sequenceNumber( | 190 blink::Platform::current()->clipboard()->sequenceNumber( |
191 blink::WebClipboard::Buffer())) { | 191 blink::WebClipboard::Buffer())) { |
192 SkBitmap emptyBitmap; | 192 SkBitmap emptyBitmap; |
193 callback.Run(emptyBitmap); | 193 callback.Run(emptyBitmap); |
194 return; | 194 return; |
195 } | 195 } |
196 | 196 |
197 blink::WebImage image = static_cast<blink::WebMockClipboard*>( | 197 blink::WebImage image = static_cast<blink::WebMockClipboard*>( |
198 blink::Platform::current()->clipboard()) | 198 blink::Platform::current()->clipboard()) |
199 ->readRawImage(blink::WebClipboard::Buffer()); | 199 ->readRawImage(blink::WebClipboard::Buffer()); |
200 const SkBitmap& bitmap = image.getSkBitmap(); | 200 const SkBitmap& bitmap = image.getSkBitmap(); |
201 SkAutoLockPixels autoLock(bitmap); | 201 SkAutoLockPixels autoLock(bitmap); |
202 callback.Run(bitmap); | 202 callback.Run(bitmap); |
203 } | 203 } |
204 | 204 |
205 } // namespace test_runner | 205 } // namespace test_runner |
OLD | NEW |