| 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/composite_async_then.h> |
| 5 #include "components/test_runner/test_runner_for_specific_view.h" | 6 #include "components/test_runner/test_runner_for_specific_view.h" |
| 6 | 7 |
| 7 #include <stddef.h> | 8 #include <stddef.h> |
| 8 #include <limits> | 9 #include <limits> |
| 9 #include <utility> | 10 #include <utility> |
| 10 | 11 |
| 11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 17 #include "components/test_runner/app_banner_client.h" | 18 #include "components/test_runner/app_banner_client.h" |
| 18 #include "components/test_runner/layout_and_paint_async_then.h" | |
| 19 #include "components/test_runner/layout_dump.h" | 19 #include "components/test_runner/layout_dump.h" |
| 20 #include "components/test_runner/mock_content_settings_client.h" | 20 #include "components/test_runner/mock_content_settings_client.h" |
| 21 #include "components/test_runner/mock_credential_manager_client.h" | 21 #include "components/test_runner/mock_credential_manager_client.h" |
| 22 #include "components/test_runner/mock_screen_orientation_client.h" | 22 #include "components/test_runner/mock_screen_orientation_client.h" |
| 23 #include "components/test_runner/mock_web_speech_recognizer.h" | 23 #include "components/test_runner/mock_web_speech_recognizer.h" |
| 24 #include "components/test_runner/mock_web_user_media_client.h" | 24 #include "components/test_runner/mock_web_user_media_client.h" |
| 25 #include "components/test_runner/pixel_dump.h" | 25 #include "components/test_runner/pixel_dump.h" |
| 26 #include "components/test_runner/spell_check_client.h" | 26 #include "components/test_runner/spell_check_client.h" |
| 27 #include "components/test_runner/test_common.h" | 27 #include "components/test_runner/test_common.h" |
| 28 #include "components/test_runner/test_interfaces.h" | 28 #include "components/test_runner/test_interfaces.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 base::Closure TestRunnerForSpecificView::CreateClosureThatPostsV8Callback( | 205 base::Closure TestRunnerForSpecificView::CreateClosureThatPostsV8Callback( |
| 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::CompositeAsyncThen( |
| 216 v8::Local<v8::Function> callback) { |
| 216 // TODO(lfg, lukasza): TestRunnerForSpecificView assumes that there's a single | 217 // 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 // 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 // multiple WebWidgets, one for each local root. We should look into making |
| 219 // this structure more generic. | 220 // this structure more generic. |
| 220 test_runner::LayoutAndPaintAsyncThen( | 221 test_runner::CompositeAsyncThen( |
| 221 web_view()->mainFrame()->toWebLocalFrame()->frameWidget(), | |
| 222 base::Closure()); | |
| 223 } | |
| 224 | |
| 225 void TestRunnerForSpecificView::LayoutAndPaintAsyncThen( | |
| 226 v8::Local<v8::Function> callback) { | |
| 227 test_runner::LayoutAndPaintAsyncThen( | |
| 228 web_view()->mainFrame()->toWebLocalFrame()->frameWidget(), | 222 web_view()->mainFrame()->toWebLocalFrame()->frameWidget(), |
| 229 CreateClosureThatPostsV8Callback(callback)); | 223 CreateClosureThatPostsV8Callback(callback)); |
| 230 } | 224 } |
| 231 | 225 |
| 232 void TestRunnerForSpecificView::CapturePixelsAsyncThen( | 226 void TestRunnerForSpecificView::CapturePixelsAsyncThen( |
| 233 v8::Local<v8::Function> callback) { | 227 v8::Local<v8::Function> callback) { |
| 234 v8::UniquePersistent<v8::Function> persistent_callback( | 228 v8::UniquePersistent<v8::Function> persistent_callback( |
| 235 blink::mainThreadIsolate(), callback); | 229 blink::mainThreadIsolate(), callback); |
| 236 | 230 |
| 237 web_test_proxy_base_->test_interfaces()->GetTestRunner()->DumpPixelsAsync( | 231 web_test_proxy_base_->test_interfaces()->GetTestRunner()->DumpPixelsAsync( |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 671 |
| 678 blink::WebView* TestRunnerForSpecificView::web_view() { | 672 blink::WebView* TestRunnerForSpecificView::web_view() { |
| 679 return web_test_proxy_base_->web_view(); | 673 return web_test_proxy_base_->web_view(); |
| 680 } | 674 } |
| 681 | 675 |
| 682 WebTestDelegate* TestRunnerForSpecificView::delegate() { | 676 WebTestDelegate* TestRunnerForSpecificView::delegate() { |
| 683 return web_test_proxy_base_->delegate(); | 677 return web_test_proxy_base_->delegate(); |
| 684 } | 678 } |
| 685 | 679 |
| 686 } // namespace test_runner | 680 } // namespace test_runner |
| OLD | NEW |