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 12 matching lines...) Expand all Loading... |
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" |
29 #include "components/test_runner/test_preferences.h" | 29 #include "components/test_runner/test_preferences.h" |
30 #include "components/test_runner/test_runner.h" | 30 #include "components/test_runner/test_runner.h" |
31 #include "components/test_runner/web_task.h" | 31 #include "components/test_runner/web_task.h" |
32 #include "components/test_runner/web_test_delegate.h" | 32 #include "components/test_runner/web_test_delegate.h" |
33 #include "components/test_runner/web_test_proxy.h" | 33 #include "components/test_runner/web_view_test_proxy.h" |
34 #include "gin/arguments.h" | 34 #include "gin/arguments.h" |
35 #include "gin/array_buffer.h" | 35 #include "gin/array_buffer.h" |
36 #include "gin/handle.h" | 36 #include "gin/handle.h" |
37 #include "gin/object_template_builder.h" | 37 #include "gin/object_template_builder.h" |
38 #include "gin/wrappable.h" | 38 #include "gin/wrappable.h" |
39 #include "third_party/WebKit/public/platform/WebCanvas.h" | 39 #include "third_party/WebKit/public/platform/WebCanvas.h" |
40 #include "third_party/WebKit/public/platform/WebData.h" | 40 #include "third_party/WebKit/public/platform/WebData.h" |
41 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" | 41 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" |
42 #include "third_party/WebKit/public/platform/WebPoint.h" | 42 #include "third_party/WebKit/public/platform/WebPoint.h" |
43 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 43 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
(...skipping 27 matching lines...) Expand all Loading... |
71 | 71 |
72 #if defined(__linux__) || defined(ANDROID) | 72 #if defined(__linux__) || defined(ANDROID) |
73 #include "third_party/WebKit/public/web/linux/WebFontRendering.h" | 73 #include "third_party/WebKit/public/web/linux/WebFontRendering.h" |
74 #endif | 74 #endif |
75 | 75 |
76 using namespace blink; | 76 using namespace blink; |
77 | 77 |
78 namespace test_runner { | 78 namespace test_runner { |
79 | 79 |
80 TestRunnerForSpecificView::TestRunnerForSpecificView( | 80 TestRunnerForSpecificView::TestRunnerForSpecificView( |
81 WebTestProxyBase* web_test_proxy_base) | 81 WebViewTestProxyBase* web_view_test_proxy_base) |
82 : web_test_proxy_base_(web_test_proxy_base), weak_factory_(this) { | 82 : web_view_test_proxy_base_(web_view_test_proxy_base), weak_factory_(this) { |
83 Reset(); | 83 Reset(); |
84 } | 84 } |
85 | 85 |
86 TestRunnerForSpecificView::~TestRunnerForSpecificView() {} | 86 TestRunnerForSpecificView::~TestRunnerForSpecificView() {} |
87 | 87 |
88 void TestRunnerForSpecificView::Install(blink::WebLocalFrame* frame) { | 88 void TestRunnerForSpecificView::Install(blink::WebLocalFrame* frame) { |
89 web_test_proxy_base_->test_interfaces()->GetTestRunner()->Install( | 89 web_view_test_proxy_base_->test_interfaces()->GetTestRunner()->Install( |
90 frame, weak_factory_.GetWeakPtr()); | 90 frame, weak_factory_.GetWeakPtr()); |
91 } | 91 } |
92 | 92 |
93 void TestRunnerForSpecificView::Reset() { | 93 void TestRunnerForSpecificView::Reset() { |
94 pointer_locked_ = false; | 94 pointer_locked_ = false; |
95 pointer_lock_planned_result_ = PointerLockWillSucceed; | 95 pointer_lock_planned_result_ = PointerLockWillSucceed; |
96 | 96 |
97 if (web_view() && web_view()->mainFrame()) { | 97 if (web_view() && web_view()->mainFrame()) { |
98 RemoveWebPageOverlay(); | 98 RemoveWebPageOverlay(); |
99 SetTabKeyCyclesThroughElements(true); | 99 SetTabKeyCyclesThroughElements(true); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 test_runner::LayoutAndPaintAsyncThen( | 228 test_runner::LayoutAndPaintAsyncThen( |
229 web_view()->mainFrame()->toWebLocalFrame()->frameWidget(), | 229 web_view()->mainFrame()->toWebLocalFrame()->frameWidget(), |
230 CreateClosureThatPostsV8Callback(callback)); | 230 CreateClosureThatPostsV8Callback(callback)); |
231 } | 231 } |
232 | 232 |
233 void TestRunnerForSpecificView::CapturePixelsAsyncThen( | 233 void TestRunnerForSpecificView::CapturePixelsAsyncThen( |
234 v8::Local<v8::Function> callback) { | 234 v8::Local<v8::Function> callback) { |
235 v8::UniquePersistent<v8::Function> persistent_callback( | 235 v8::UniquePersistent<v8::Function> persistent_callback( |
236 blink::mainThreadIsolate(), callback); | 236 blink::mainThreadIsolate(), callback); |
237 | 237 |
238 web_test_proxy_base_->test_interfaces()->GetTestRunner()->DumpPixelsAsync( | 238 web_view_test_proxy_base_->test_interfaces() |
239 web_view(), base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, | 239 ->GetTestRunner() |
240 weak_factory_.GetWeakPtr(), | 240 ->DumpPixelsAsync( |
241 base::Passed(std::move(persistent_callback)))); | 241 web_view(), |
| 242 base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, |
| 243 weak_factory_.GetWeakPtr(), |
| 244 base::Passed(std::move(persistent_callback)))); |
242 } | 245 } |
243 | 246 |
244 void TestRunnerForSpecificView::CapturePixelsCallback( | 247 void TestRunnerForSpecificView::CapturePixelsCallback( |
245 v8::UniquePersistent<v8::Function> callback, | 248 v8::UniquePersistent<v8::Function> callback, |
246 const SkBitmap& snapshot) { | 249 const SkBitmap& snapshot) { |
247 v8::Isolate* isolate = blink::mainThreadIsolate(); | 250 v8::Isolate* isolate = blink::mainThreadIsolate(); |
248 v8::HandleScope handle_scope(isolate); | 251 v8::HandleScope handle_scope(isolate); |
249 | 252 |
250 v8::Local<v8::Context> context = | 253 v8::Local<v8::Context> context = |
251 web_view()->mainFrame()->mainWorldScriptContext(); | 254 web_view()->mainFrame()->mainWorldScriptContext(); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 523 |
521 void TestRunnerForSpecificView::ForceNextWebGLContextCreationToFail() { | 524 void TestRunnerForSpecificView::ForceNextWebGLContextCreationToFail() { |
522 web_view()->forceNextWebGLContextCreationToFail(); | 525 web_view()->forceNextWebGLContextCreationToFail(); |
523 } | 526 } |
524 | 527 |
525 void TestRunnerForSpecificView::ForceNextDrawingBufferCreationToFail() { | 528 void TestRunnerForSpecificView::ForceNextDrawingBufferCreationToFail() { |
526 web_view()->forceNextDrawingBufferCreationToFail(); | 529 web_view()->forceNextDrawingBufferCreationToFail(); |
527 } | 530 } |
528 | 531 |
529 void TestRunnerForSpecificView::SetWindowIsKey(bool value) { | 532 void TestRunnerForSpecificView::SetWindowIsKey(bool value) { |
530 web_test_proxy_base_->test_interfaces()->GetTestRunner()->SetFocus(web_view(), | 533 web_view_test_proxy_base_->test_interfaces()->GetTestRunner()->SetFocus( |
531 value); | 534 web_view(), value); |
532 } | 535 } |
533 | 536 |
534 void TestRunnerForSpecificView::DidAcquirePointerLock() { | 537 void TestRunnerForSpecificView::DidAcquirePointerLock() { |
535 DidAcquirePointerLockInternal(); | 538 DidAcquirePointerLockInternal(); |
536 } | 539 } |
537 | 540 |
538 void TestRunnerForSpecificView::DidNotAcquirePointerLock() { | 541 void TestRunnerForSpecificView::DidNotAcquirePointerLock() { |
539 DidNotAcquirePointerLockInternal(); | 542 DidNotAcquirePointerLockInternal(); |
540 } | 543 } |
541 | 544 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 | 686 |
684 void TestRunnerForSpecificView::SetViewSourceForFrame(const std::string& name, | 687 void TestRunnerForSpecificView::SetViewSourceForFrame(const std::string& name, |
685 bool enabled) { | 688 bool enabled) { |
686 WebFrame* target_frame = | 689 WebFrame* target_frame = |
687 web_view()->findFrameByName(WebString::fromUTF8(name)); | 690 web_view()->findFrameByName(WebString::fromUTF8(name)); |
688 if (target_frame) | 691 if (target_frame) |
689 target_frame->enableViewSourceMode(enabled); | 692 target_frame->enableViewSourceMode(enabled); |
690 } | 693 } |
691 | 694 |
692 blink::WebView* TestRunnerForSpecificView::web_view() { | 695 blink::WebView* TestRunnerForSpecificView::web_view() { |
693 return web_test_proxy_base_->web_view(); | 696 return web_view_test_proxy_base_->web_view(); |
694 } | 697 } |
695 | 698 |
696 WebTestDelegate* TestRunnerForSpecificView::delegate() { | 699 WebTestDelegate* TestRunnerForSpecificView::delegate() { |
697 return web_test_proxy_base_->delegate(); | 700 return web_view_test_proxy_base_->delegate(); |
698 } | 701 } |
699 | 702 |
700 } // namespace test_runner | 703 } // namespace test_runner |
OLD | NEW |