| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/web_view_test_proxy.h" | 5 #include "components/test_runner/web_view_test_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "components/test_runner/accessibility_controller.h" | 10 #include "components/test_runner/accessibility_controller.h" |
| 11 #include "components/test_runner/event_sender.h" | |
| 12 #include "components/test_runner/mock_screen_orientation_client.h" | |
| 13 #include "components/test_runner/test_interfaces.h" | 11 #include "components/test_runner/test_interfaces.h" |
| 14 #include "components/test_runner/test_runner.h" | 12 #include "components/test_runner/test_runner.h" |
| 15 #include "components/test_runner/test_runner_for_specific_view.h" | 13 #include "components/test_runner/test_runner_for_specific_view.h" |
| 16 #include "components/test_runner/text_input_controller.h" | 14 #include "components/test_runner/text_input_controller.h" |
| 17 #include "components/test_runner/web_test_delegate.h" | 15 #include "components/test_runner/web_test_delegate.h" |
| 18 #include "components/test_runner/web_test_interfaces.h" | 16 #include "components/test_runner/web_test_interfaces.h" |
| 19 #include "components/test_runner/web_widget_test_proxy.h" | 17 #include "components/test_runner/web_widget_test_proxy.h" |
| 18 #include "third_party/WebKit/public/web/WebFrame.h" |
| 19 #include "third_party/WebKit/public/web/WebView.h" |
| 20 | 20 |
| 21 namespace test_runner { | 21 namespace test_runner { |
| 22 | 22 |
| 23 WebViewTestProxyBase::WebViewTestProxyBase() | 23 WebViewTestProxyBase::WebViewTestProxyBase() |
| 24 : test_interfaces_(nullptr), | 24 : test_interfaces_(nullptr), |
| 25 delegate_(nullptr), | 25 delegate_(nullptr), |
| 26 web_view_(nullptr), | 26 web_view_(nullptr), |
| 27 accessibility_controller_(new AccessibilityController(this)), | 27 accessibility_controller_(new AccessibilityController(this)), |
| 28 event_sender_(new EventSender(this)), | |
| 29 text_input_controller_(new TextInputController(this)), | 28 text_input_controller_(new TextInputController(this)), |
| 30 view_test_runner_(new TestRunnerForSpecificView(this)) {} | 29 view_test_runner_(new TestRunnerForSpecificView(this)) { |
| 30 WebWidgetTestProxyBase::set_web_view_test_proxy_base(this); |
| 31 } |
| 31 | 32 |
| 32 WebViewTestProxyBase::~WebViewTestProxyBase() { | 33 WebViewTestProxyBase::~WebViewTestProxyBase() { |
| 33 test_interfaces_->WindowClosed(this); | 34 test_interfaces_->WindowClosed(this); |
| 34 } | 35 } |
| 35 | 36 |
| 37 WebWidgetTestProxyBase::Subtype WebViewTestProxyBase::subtype() { |
| 38 return Subtype::WebViewTestProxy; |
| 39 } |
| 40 |
| 36 void WebViewTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { | 41 void WebViewTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { |
| 37 test_interfaces_ = interfaces->GetTestInterfaces(); | 42 test_interfaces_ = interfaces->GetTestInterfaces(); |
| 38 test_interfaces_->WindowOpened(this); | 43 test_interfaces_->WindowOpened(this); |
| 39 } | 44 } |
| 40 | 45 |
| 41 void WebViewTestProxyBase::Reset() { | 46 void WebViewTestProxyBase::Reset() { |
| 42 accessibility_controller_->Reset(); | 47 accessibility_controller_->Reset(); |
| 43 event_sender_->Reset(); | |
| 44 // text_input_controller_ doesn't have any state to reset. | 48 // text_input_controller_ doesn't have any state to reset. |
| 45 view_test_runner_->Reset(); | 49 view_test_runner_->Reset(); |
| 50 WebWidgetTestProxyBase::Reset(); |
| 51 |
| 52 for (blink::WebFrame* frame = web_view_->mainFrame(); frame; |
| 53 frame = frame->traverseNext(false)) { |
| 54 if (frame->isWebLocalFrame()) |
| 55 delegate_->GetWebWidgetTestProxyBase(frame->toWebLocalFrame())->Reset(); |
| 56 } |
| 46 } | 57 } |
| 47 | 58 |
| 48 void WebViewTestProxyBase::BindTo(blink::WebLocalFrame* frame) { | 59 void WebViewTestProxyBase::BindTo(blink::WebLocalFrame* frame) { |
| 49 accessibility_controller_->Install(frame); | 60 accessibility_controller_->Install(frame); |
| 50 event_sender_->Install(frame); | |
| 51 text_input_controller_->Install(frame); | 61 text_input_controller_->Install(frame); |
| 52 view_test_runner_->Install(frame); | 62 view_test_runner_->Install(frame); |
| 53 } | 63 } |
| 54 | 64 |
| 55 } // namespace test_runner | 65 } // namespace test_runner |
| OLD | NEW |