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

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

Issue 396953002: Add testRunner.copyAtAndCapturePixelsAsyncThen() method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
Index: content/shell/renderer/test_runner/test_runner.cc
diff --git a/content/shell/renderer/test_runner/test_runner.cc b/content/shell/renderer/test_runner/test_runner.cc
index 9e280747656eb04f990c2c9b398bfd5b428c44f0..3b04242b38975bf849b1d8e373d938af2a1e6068 100644
--- a/content/shell/renderer/test_runner/test_runner.cc
+++ b/content/shell/renderer/test_runner/test_runner.cc
@@ -281,6 +281,7 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> {
void DisplayAsync();
void DisplayAsyncThen(v8::Handle<v8::Function> callback);
void CapturePixelsAsyncThen(v8::Handle<v8::Function> callback);
+ void CopyAtAndCapturePixelsAsyncThen(int x, int y, v8::Handle<v8::Function> callback);
void SetCustomTextOutput(std::string output);
void SetViewSourceForFrame(const std::string& name, bool enabled);
void SetMockPushClientSuccess(const std::string& endpoint,
@@ -528,6 +529,8 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder(
.SetMethod("displayAsyncThen", &TestRunnerBindings::DisplayAsyncThen)
.SetMethod("capturePixelsAsyncThen",
&TestRunnerBindings::CapturePixelsAsyncThen)
+ .SetMethod("copyAtAndCapturePixelsAsyncThen",
Ken Russell (switch to Gerrit) 2014/07/16 20:40:50 Please name this copyImageAtAndCapturePixelsAsyncT
hj.r.chung 2014/07/17 05:33:39 Done.
+ &TestRunnerBindings::CopyAtAndCapturePixelsAsyncThen)
.SetMethod("setCustomTextOutput",
&TestRunnerBindings::SetCustomTextOutput)
.SetMethod("setViewSourceForFrame",
@@ -1350,6 +1353,12 @@ void TestRunnerBindings::CapturePixelsAsyncThen(
runner_->CapturePixelsAsyncThen(callback);
}
+void TestRunnerBindings::CopyAtAndCapturePixelsAsyncThen(
+ int x, int y, v8::Handle<v8::Function> callback) {
+ if (runner_)
+ runner_->CopyAtAndCapturePixelsAsyncThen(x, y, callback);
+}
+
void TestRunnerBindings::SetCustomTextOutput(std::string output) {
runner_->setCustomTextOutput(output);
}
@@ -2789,6 +2798,17 @@ void TestRunner::CapturePixelsAsyncThen(v8::Handle<v8::Function> callback) {
base::Passed(&task)));
}
+void TestRunner::CopyAtAndCapturePixelsAsyncThen(
+ int x, int y, v8::Handle<v8::Function> callback) {
+ scoped_ptr<InvokeCallbackTask> task(
+ new InvokeCallbackTask(this, callback));
+ proxy_->CopyAtAndCapturePixels(x,
+ y,
+ base::Bind(&TestRunner::CapturePixelsCallback,
+ base::Unretained(this),
+ base::Passed(&task)));
+}
+
void TestRunner::CapturePixelsCallback(scoped_ptr<InvokeCallbackTask> task,
const SkBitmap& snapshot) {
v8::Isolate* isolate = blink::mainThreadIsolate();

Powered by Google App Engine
This is Rietveld 408576698