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

Side by Side Diff: content/shell/test_runner/test_runner_for_specific_view.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 unified diff | Download patch
« no previous file with comments | « content/shell/test_runner/test_runner.cc ('k') | content/shell/test_runner/web_test_runner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/shell/test_runner/test_runner_for_specific_view.h" 5 #include "content/shell/test_runner/test_runner_for_specific_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 test_runner::LayoutAndPaintAsyncThen( 226 test_runner::LayoutAndPaintAsyncThen(
227 web_view()->MainFrame()->ToWebLocalFrame()->FrameWidget(), 227 web_view()->MainFrame()->ToWebLocalFrame()->FrameWidget(),
228 CreateClosureThatPostsV8Callback(callback)); 228 CreateClosureThatPostsV8Callback(callback));
229 } 229 }
230 230
231 void TestRunnerForSpecificView::CapturePixelsAsyncThen( 231 void TestRunnerForSpecificView::CapturePixelsAsyncThen(
232 v8::Local<v8::Function> callback) { 232 v8::Local<v8::Function> callback) {
233 v8::UniquePersistent<v8::Function> persistent_callback( 233 v8::UniquePersistent<v8::Function> persistent_callback(
234 blink::MainThreadIsolate(), callback); 234 blink::MainThreadIsolate(), callback);
235 235
236 CHECK(web_view()->MainFrame()->IsWebLocalFrame())
237 << "Layout tests harness doesn't currently support running "
238 << "testRuner.capturePixelsAsyncThen from an OOPIF";
239
236 web_view_test_proxy_base_->test_interfaces() 240 web_view_test_proxy_base_->test_interfaces()
237 ->GetTestRunner() 241 ->GetTestRunner()
238 ->DumpPixelsAsync( 242 ->DumpPixelsAsync(
239 web_view(), 243 web_view()->MainFrame()->ToWebLocalFrame(),
240 base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, 244 base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback,
241 weak_factory_.GetWeakPtr(), 245 weak_factory_.GetWeakPtr(),
242 base::Passed(std::move(persistent_callback)))); 246 base::Passed(std::move(persistent_callback))));
243 } 247 }
244 248
245 void TestRunnerForSpecificView::CapturePixelsCallback( 249 void TestRunnerForSpecificView::CapturePixelsCallback(
246 v8::UniquePersistent<v8::Function> callback, 250 v8::UniquePersistent<v8::Function> callback,
247 const SkBitmap& snapshot) { 251 const SkBitmap& snapshot) {
248 v8::Isolate* isolate = blink::MainThreadIsolate(); 252 v8::Isolate* isolate = blink::MainThreadIsolate();
249 v8::HandleScope handle_scope(isolate); 253 v8::HandleScope handle_scope(isolate);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 PostV8CallbackWithArgs(std::move(callback), arraysize(argv), argv); 286 PostV8CallbackWithArgs(std::move(callback), arraysize(argv), argv);
283 } 287 }
284 288
285 void TestRunnerForSpecificView::CopyImageAtAndCapturePixelsAsyncThen( 289 void TestRunnerForSpecificView::CopyImageAtAndCapturePixelsAsyncThen(
286 int x, 290 int x,
287 int y, 291 int y,
288 v8::Local<v8::Function> callback) { 292 v8::Local<v8::Function> callback) {
289 v8::UniquePersistent<v8::Function> persistent_callback( 293 v8::UniquePersistent<v8::Function> persistent_callback(
290 blink::MainThreadIsolate(), callback); 294 blink::MainThreadIsolate(), callback);
291 295
296 // TODO(lukasza): Support image capture in OOPIFs for
297 // https://crbug.com/477150.
298 CHECK(web_view()->MainFrame()->IsWebLocalFrame())
299 << "Layout tests harness doesn't support calling "
300 << "testRunner.copyImageAtAndCapturePixelsAsyncThen from an OOPIF.";
301
292 CopyImageAtAndCapturePixels( 302 CopyImageAtAndCapturePixels(
293 web_view(), x, y, 303 web_view()->MainFrame()->ToWebLocalFrame(), x, y,
294 base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, 304 base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback,
295 weak_factory_.GetWeakPtr(), 305 weak_factory_.GetWeakPtr(),
296 base::Passed(std::move(persistent_callback)))); 306 base::Passed(std::move(persistent_callback))));
297 } 307 }
298 308
299 void TestRunnerForSpecificView::GetManifestThen( 309 void TestRunnerForSpecificView::GetManifestThen(
300 v8::Local<v8::Function> callback) { 310 v8::Local<v8::Function> callback) {
301 if (!web_view()->MainFrame()->IsWebLocalFrame()) { 311 if (!web_view()->MainFrame()->IsWebLocalFrame()) {
302 CHECK(false) << "This function cannot be called if the main frame is not a " 312 CHECK(false) << "This function cannot be called if the main frame is not a "
303 "local frame."; 313 "local frame.";
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 703
694 blink::WebView* TestRunnerForSpecificView::web_view() { 704 blink::WebView* TestRunnerForSpecificView::web_view() {
695 return web_view_test_proxy_base_->web_view(); 705 return web_view_test_proxy_base_->web_view();
696 } 706 }
697 707
698 WebTestDelegate* TestRunnerForSpecificView::delegate() { 708 WebTestDelegate* TestRunnerForSpecificView::delegate() {
699 return web_view_test_proxy_base_->delegate(); 709 return web_view_test_proxy_base_->delegate();
700 } 710 }
701 711
702 } // namespace test_runner 712 } // namespace test_runner
OLDNEW
« no previous file with comments | « content/shell/test_runner/test_runner.cc ('k') | content/shell/test_runner/web_test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698