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

Unified Diff: components/test_runner/test_runner.cc

Issue 1842353002: Revert of Moving pixel-capturing code from web_test_proxy_base.* into pixel_dump.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replicating-accept-languages
Patch Set: Created 4 years, 9 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 | « components/test_runner/test_runner.h ('k') | components/test_runner/test_runner.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/test_runner.cc
diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc
index 6b0c2edec40e436fdc48d8a1e2abe3fced8595ea..07218fec0c13baa2284c8493df578251ede47773 100644
--- a/components/test_runner/test_runner.cc
+++ b/components/test_runner/test_runner.cc
@@ -20,7 +20,6 @@
#include "components/test_runner/mock_screen_orientation_client.h"
#include "components/test_runner/mock_web_speech_recognizer.h"
#include "components/test_runner/mock_web_user_media_client.h"
-#include "components/test_runner/pixel_dump.h"
#include "components/test_runner/test_interfaces.h"
#include "components/test_runner/test_preferences.h"
#include "components/test_runner/web_content_settings.h"
@@ -1709,7 +1708,6 @@
top_loading_frame_ = nullptr;
layout_test_runtime_flags_.Reset();
mock_screen_orientation_client_->ResetData();
- drag_image_.reset();
wait_until_external_url_load_ = false;
WebSecurityPolicy::resetOriginAccessWhitelists();
@@ -1748,6 +1746,8 @@
dump_window_status_changes_ = false;
dump_spell_check_callbacks_ = false;
dump_back_forward_list_ = false;
+ dump_selection_rect_ = false;
+ dump_drag_image_ = false;
dump_navigation_policy_ = false;
test_repaint_ = false;
sweep_horizontally_ = false;
@@ -1849,32 +1849,6 @@
return ::test_runner::DumpLayout(frame, layout_test_runtime_flags_);
}
-void TestRunner::DumpPixelsAsync(
- blink::WebView* web_view,
- const base::Callback<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.
- // Return a blank image so that the test fails.
- SkBitmap bitmap;
- bitmap.allocN32Pixels(1, 1);
- {
- SkAutoLockPixels lock(bitmap);
- bitmap.eraseColor(0);
- }
- callback.Run(bitmap);
- return;
- }
-
- callback.Run(drag_image_.getSkBitmap());
- return;
- }
-
- test_runner::DumpPixelsAsync(proxy_->GetWebView(), layout_test_runtime_flags_,
- delegate_->GetDeviceScaleFactorForTest(),
- callback);
-}
-
void TestRunner::ReplicateLayoutTestRuntimeFlagsChanges(
const base::DictionaryValue& changed_values) {
layout_test_runtime_flags_.tracked_dictionary().ApplyUntrackedChanges(
@@ -1956,6 +1930,10 @@
bool TestRunner::ShouldDumpBackForwardList() const {
return dump_back_forward_list_;
+}
+
+bool TestRunner::shouldDumpSelectionRect() const {
+ return dump_selection_rect_;
}
bool TestRunner::isPrinting() const {
@@ -2046,12 +2024,8 @@
tooltip_text_ = text.utf8();
}
-void TestRunner::setDragImage(
- const blink::WebImage& drag_image) {
- if (layout_test_runtime_flags_.dump_drag_image()) {
- if (drag_image_.isNull())
- drag_image_ = drag_image;
- }
+bool TestRunner::shouldDumpDragImage() {
+ return dump_drag_image_;
}
bool TestRunner::shouldDumpNavigationPolicy() const {
@@ -2834,8 +2808,7 @@
}
void TestRunner::DumpSelectionRect() {
- layout_test_runtime_flags_.set_dump_selection_rect(true);
- OnLayoutTestRuntimeFlagsChanged();
+ dump_selection_rect_ = true;
}
void TestRunner::SetPrinting() {
@@ -2876,9 +2849,8 @@
}
void TestRunner::DumpDragImage() {
- layout_test_runtime_flags_.set_dump_drag_image(true);
DumpAsTextWithPixelResults();
- OnLayoutTestRuntimeFlagsChanged();
+ dump_drag_image_ = true;
}
void TestRunner::DumpNavigationPolicy() {
@@ -3097,10 +3069,11 @@
}
void TestRunner::CapturePixelsAsyncThen(v8::Local<v8::Function> callback) {
- scoped_ptr<InvokeCallbackTask> task(new InvokeCallbackTask(this, callback));
- DumpPixelsAsync(proxy_->GetWebView(),
- base::Bind(&TestRunner::CapturePixelsCallback,
- weak_factory_.GetWeakPtr(), base::Passed(&task)));
+ scoped_ptr<InvokeCallbackTask> task(
+ new InvokeCallbackTask(this, callback));
+ proxy_->CapturePixelsAsync(base::Bind(&TestRunner::CapturePixelsCallback,
+ weak_factory_.GetWeakPtr(),
+ base::Passed(&task)));
}
void TestRunner::OnLayoutTestRuntimeFlagsChanged() {
@@ -3126,10 +3099,10 @@
int x, int y, v8::Local<v8::Function> callback) {
scoped_ptr<InvokeCallbackTask> task(
new InvokeCallbackTask(this, callback));
- CopyImageAtAndCapturePixels(
- proxy_->GetWebView(), x, y,
- base::Bind(&TestRunner::CapturePixelsCallback, weak_factory_.GetWeakPtr(),
- base::Passed(&task)));
+ proxy_->CopyImageAtAndCapturePixels(
+ x, y, base::Bind(&TestRunner::CapturePixelsCallback,
+ weak_factory_.GetWeakPtr(),
+ base::Passed(&task)));
}
void TestRunner::GetManifestCallback(scoped_ptr<InvokeCallbackTask> task,
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/test_runner.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698