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

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

Issue 2963593002: Split DumpPixelsAsync in pixel_dump.h into more granular functions. (Closed)
Patch Set: Addressed CR feedback from alexmos@. Created 3 years, 5 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/test_runner/test_runner.h ('k') | content/shell/test_runner/test_runner_for_specific_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/test_runner/test_runner.cc
diff --git a/content/shell/test_runner/test_runner.cc b/content/shell/test_runner/test_runner.cc
index 3bc41601423a83f99936f8e62ed9d23a4236ca6b..e270fd729e59910a6c50c2036fb05aac1e65a6e7 100644
--- a/content/shell/test_runner/test_runner.cc
+++ b/content/shell/test_runner/test_runner.cc
@@ -1768,8 +1768,8 @@ std::string TestRunner::DumpLayout(blink::WebLocalFrame* frame) {
}
void TestRunner::DumpPixelsAsync(
- blink::WebView* web_view,
- const base::Callback<void(const SkBitmap&)>& callback) {
+ blink::WebLocalFrame* frame,
+ base::OnceCallback<void(const SkBitmap&)> callback) {
if (layout_test_runtime_flags_.dump_drag_image()) {
if (drag_image_.IsNull()) {
// This means the test called dumpDragImage but did not initiate a drag.
@@ -1777,16 +1777,29 @@ void TestRunner::DumpPixelsAsync(
SkBitmap bitmap;
bitmap.allocN32Pixels(1, 1);
bitmap.eraseColor(0);
- callback.Run(bitmap);
+ std::move(callback).Run(bitmap);
return;
}
- callback.Run(drag_image_.GetSkBitmap());
+ std::move(callback).Run(drag_image_.GetSkBitmap());
return;
}
- test_runner::DumpPixelsAsync(web_view, layout_test_runtime_flags_,
- delegate_->GetDeviceScaleFactor(), callback);
+ // See if we need to draw the selection bounds rect on top of the snapshot.
+ if (layout_test_runtime_flags_.dump_selection_rect()) {
+ callback =
+ CreateSelectionBoundsRectDrawingCallback(frame, std::move(callback));
+ }
+
+ // Request appropriate kind of pixel dump.
+ if (layout_test_runtime_flags_.is_printing()) {
+ test_runner::PrintFrameAsync(frame, std::move(callback));
+ } else {
+ // TODO(lukasza): Ask the |delegate_| to capture the pixels in the browser
+ // process, so that OOPIF pixels are also captured.
+ test_runner::DumpPixelsAsync(frame, delegate_->GetDeviceScaleFactor(),
+ std::move(callback));
+ }
}
void TestRunner::ReplicateLayoutTestRuntimeFlagsChanges(
« no previous file with comments | « content/shell/test_runner/test_runner.h ('k') | content/shell/test_runner/test_runner_for_specific_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698