| 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 #include "components/test_runner/test_runner_for_specific_view.h" | 5 #include "components/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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 const v8::Local<v8::Function>& callback) { | 206 const v8::Local<v8::Function>& callback) { |
| 207 return base::Bind(&TestRunnerForSpecificView::PostTask, | 207 return base::Bind(&TestRunnerForSpecificView::PostTask, |
| 208 weak_factory_.GetWeakPtr(), | 208 weak_factory_.GetWeakPtr(), |
| 209 base::Bind(&TestRunnerForSpecificView::InvokeV8Callback, | 209 base::Bind(&TestRunnerForSpecificView::InvokeV8Callback, |
| 210 weak_factory_.GetWeakPtr(), | 210 weak_factory_.GetWeakPtr(), |
| 211 v8::UniquePersistent<v8::Function>( | 211 v8::UniquePersistent<v8::Function>( |
| 212 blink::mainThreadIsolate(), callback))); | 212 blink::mainThreadIsolate(), callback))); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void TestRunnerForSpecificView::LayoutAndPaintAsync() { | 215 void TestRunnerForSpecificView::LayoutAndPaintAsync() { |
| 216 test_runner::LayoutAndPaintAsyncThen(web_view(), base::Closure()); | 216 // TODO(lfg, lukasza): TestRunnerForSpecificView assumes that there's a single |
| 217 // WebWidget for the entire view, but with out-of-process iframes there may be |
| 218 // multiple WebWidgets, one for each local root. We should look into making |
| 219 // this structure more generic. |
| 220 test_runner::LayoutAndPaintAsyncThen( |
| 221 web_view()->mainFrame()->toWebLocalFrame()->frameWidget(), |
| 222 base::Closure()); |
| 217 } | 223 } |
| 218 | 224 |
| 219 void TestRunnerForSpecificView::LayoutAndPaintAsyncThen( | 225 void TestRunnerForSpecificView::LayoutAndPaintAsyncThen( |
| 220 v8::Local<v8::Function> callback) { | 226 v8::Local<v8::Function> callback) { |
| 221 test_runner::LayoutAndPaintAsyncThen( | 227 test_runner::LayoutAndPaintAsyncThen( |
| 222 web_view(), CreateClosureThatPostsV8Callback(callback)); | 228 web_view()->mainFrame()->toWebLocalFrame()->frameWidget(), |
| 229 CreateClosureThatPostsV8Callback(callback)); |
| 223 } | 230 } |
| 224 | 231 |
| 225 void TestRunnerForSpecificView::CapturePixelsAsyncThen( | 232 void TestRunnerForSpecificView::CapturePixelsAsyncThen( |
| 226 v8::Local<v8::Function> callback) { | 233 v8::Local<v8::Function> callback) { |
| 227 v8::UniquePersistent<v8::Function> persistent_callback( | 234 v8::UniquePersistent<v8::Function> persistent_callback( |
| 228 blink::mainThreadIsolate(), callback); | 235 blink::mainThreadIsolate(), callback); |
| 229 | 236 |
| 230 web_test_proxy_base_->test_interfaces()->GetTestRunner()->DumpPixelsAsync( | 237 web_test_proxy_base_->test_interfaces()->GetTestRunner()->DumpPixelsAsync( |
| 231 web_view(), base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, | 238 web_view(), base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, |
| 232 weak_factory_.GetWeakPtr(), | 239 weak_factory_.GetWeakPtr(), |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 | 671 |
| 665 blink::WebView* TestRunnerForSpecificView::web_view() { | 672 blink::WebView* TestRunnerForSpecificView::web_view() { |
| 666 return web_test_proxy_base_->web_view(); | 673 return web_test_proxy_base_->web_view(); |
| 667 } | 674 } |
| 668 | 675 |
| 669 WebTestDelegate* TestRunnerForSpecificView::delegate() { | 676 WebTestDelegate* TestRunnerForSpecificView::delegate() { |
| 670 return web_test_proxy_base_->delegate(); | 677 return web_test_proxy_base_->delegate(); |
| 671 } | 678 } |
| 672 | 679 |
| 673 } // namespace test_runner | 680 } // namespace test_runner |
| OLD | NEW |