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 #ifndef CONTENT_SHELL_TEST_RUNNER_PIXEL_DUMP_H_ | 5 #ifndef CONTENT_SHELL_TEST_RUNNER_PIXEL_DUMP_H_ |
6 #define CONTENT_SHELL_TEST_RUNNER_PIXEL_DUMP_H_ | 6 #define CONTENT_SHELL_TEST_RUNNER_PIXEL_DUMP_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "content/shell/test_runner/test_runner_export.h" | |
10 | 9 |
11 class SkBitmap; | 10 class SkBitmap; |
12 | 11 |
13 namespace blink { | 12 namespace blink { |
14 class WebView; | 13 class WebLocalFrame; |
15 } // namespace blink | 14 } // namespace blink |
16 | 15 |
17 namespace test_runner { | 16 namespace test_runner { |
18 | 17 |
19 class LayoutTestRuntimeFlags; | 18 // Asks |web_frame|'s widget to dump its pixels and calls |callback| with the |
| 19 // result. |
| 20 void DumpPixelsAsync(blink::WebLocalFrame* web_frame, |
| 21 float device_scale_factor_for_test, |
| 22 base::OnceCallback<void(const SkBitmap&)> callback); |
20 | 23 |
21 // Dumps image snapshot of |web_view|. Exact dump mode depends on |flags| (i.e. | 24 // Asks |web_frame| to print itself and calls |callback| with the result. |
22 // dump_selection_rect and/or is_printing). Caller needs to ensure that | 25 void PrintFrameAsync(blink::WebLocalFrame* web_frame, |
23 // |layout_test_runtime_flags| stays alive until |callback| gets called. | 26 base::OnceCallback<void(const SkBitmap&)> callback); |
24 TEST_RUNNER_EXPORT void DumpPixelsAsync( | |
25 blink::WebView* web_view, | |
26 const LayoutTestRuntimeFlags& layout_test_runtime_flags, | |
27 float device_scale_factor_for_test, | |
28 const base::Callback<void(const SkBitmap&)>& callback); | |
29 | 27 |
30 // Copy to clipboard the image present at |x|, |y| coordinates in |web_view| | 28 // Captures the current selection bounds rect of |web_frame| and creates a |
| 29 // callback that will draw the rect (if any) on top of the |original_bitmap|, |
| 30 // before passing |bitmap_with_selection_bounds_rect| to the |
| 31 // |original_callback|. Selection bounds rect is the rect enclosing the |
| 32 // (possibly transformed) selection. |
| 33 base::OnceCallback<void(const SkBitmap& original_bitmap)> |
| 34 CreateSelectionBoundsRectDrawingCallback( |
| 35 blink::WebLocalFrame* web_frame, |
| 36 base::OnceCallback<void(const SkBitmap& bitmap_with_selection_bounds_rect)> |
| 37 original_callback); |
| 38 |
| 39 // Copy to clipboard the image present at |x|, |y| coordinates in |web_frame| |
31 // and pass the captured image to |callback|. | 40 // and pass the captured image to |callback|. |
32 void CopyImageAtAndCapturePixels( | 41 void CopyImageAtAndCapturePixels( |
33 blink::WebView* web_view, | 42 blink::WebLocalFrame* web_frame, |
34 int x, | 43 int x, |
35 int y, | 44 int y, |
36 const base::Callback<void(const SkBitmap&)>& callback); | 45 base::OnceCallback<void(const SkBitmap&)> callback); |
37 | 46 |
38 } // namespace test_runner | 47 } // namespace test_runner |
39 | 48 |
40 #endif // CONTENT_SHELL_TEST_RUNNER_PIXEL_DUMP_H_ | 49 #endif // CONTENT_SHELL_TEST_RUNNER_PIXEL_DUMP_H_ |
OLD | NEW |