| 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/web_view_test_client.h" | 5 #include "components/test_runner/web_view_test_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "components/test_runner/event_sender.h" | 13 #include "components/test_runner/event_sender.h" |
| 14 #include "components/test_runner/mock_web_speech_recognizer.h" | 14 #include "components/test_runner/mock_web_speech_recognizer.h" |
| 15 #include "components/test_runner/test_common.h" | 15 #include "components/test_runner/test_common.h" |
| 16 #include "components/test_runner/test_interfaces.h" | 16 #include "components/test_runner/test_interfaces.h" |
| 17 #include "components/test_runner/test_runner.h" | 17 #include "components/test_runner/test_runner.h" |
| 18 #include "components/test_runner/test_runner_for_specific_view.h" | 18 #include "components/test_runner/test_runner_for_specific_view.h" |
| 19 #include "components/test_runner/web_test_delegate.h" | 19 #include "components/test_runner/web_test_delegate.h" |
| 20 #include "components/test_runner/web_view_test_proxy.h" | 20 #include "components/test_runner/web_view_test_proxy.h" |
| 21 #include "components/test_runner/web_widget_test_proxy.h" |
| 21 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 22 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 22 #include "third_party/WebKit/public/web/WebFrame.h" | 23 #include "third_party/WebKit/public/web/WebFrame.h" |
| 23 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 24 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 24 #include "third_party/WebKit/public/web/WebPagePopup.h" | 25 #include "third_party/WebKit/public/web/WebPagePopup.h" |
| 25 #include "third_party/WebKit/public/web/WebPrintParams.h" | 26 #include "third_party/WebKit/public/web/WebPrintParams.h" |
| 26 #include "third_party/WebKit/public/web/WebView.h" | 27 #include "third_party/WebKit/public/web/WebView.h" |
| 27 #include "third_party/WebKit/public/web/WebWidget.h" | 28 #include "third_party/WebKit/public/web/WebWidget.h" |
| 28 | 29 |
| 29 namespace test_runner { | 30 namespace test_runner { |
| 30 | 31 |
| 31 WebViewTestClient::WebViewTestClient( | 32 WebViewTestClient::WebViewTestClient( |
| 32 WebViewTestProxyBase* web_view_test_proxy_base) | 33 WebViewTestProxyBase* web_view_test_proxy_base) |
| 33 : web_view_test_proxy_base_(web_view_test_proxy_base) { | 34 : web_view_test_proxy_base_(web_view_test_proxy_base) { |
| 34 DCHECK(web_view_test_proxy_base); | 35 DCHECK(web_view_test_proxy_base); |
| 35 } | 36 } |
| 36 | 37 |
| 37 WebViewTestClient::~WebViewTestClient() {} | 38 WebViewTestClient::~WebViewTestClient() {} |
| 38 | 39 |
| 39 void WebViewTestClient::startDragging(blink::WebLocalFrame* frame, | 40 void WebViewTestClient::startDragging(blink::WebLocalFrame* frame, |
| 40 const blink::WebDragData& data, | 41 const blink::WebDragData& data, |
| 41 blink::WebDragOperationsMask mask, | 42 blink::WebDragOperationsMask mask, |
| 42 const blink::WebImage& image, | 43 const blink::WebImage& image, |
| 43 const blink::WebPoint& point) { | 44 const blink::WebPoint& point) { |
| 44 test_runner()->setDragImage(image); | 45 test_runner()->setDragImage(image); |
| 45 | 46 |
| 46 // When running a test, we need to fake a drag drop operation otherwise | 47 // When running a test, we need to fake a drag drop operation otherwise |
| 47 // Windows waits for real mouse events to know when the drag is over. | 48 // Windows waits for real mouse events to know when the drag is over. |
| 48 web_view_test_proxy_base_->event_sender()->DoDragDrop(data, mask); | 49 delegate()->GetWebWidgetTestProxyBase(frame)->event_sender()->DoDragDrop( |
| 50 data, mask); |
| 49 } | 51 } |
| 50 | 52 |
| 51 // The output from these methods in layout test mode should match that | 53 // The output from these methods in layout test mode should match that |
| 52 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. | 54 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. |
| 53 | 55 |
| 54 void WebViewTestClient::didChangeContents() { | 56 void WebViewTestClient::didChangeContents() { |
| 55 if (test_runner()->shouldDumpEditingCallbacks()) | 57 if (test_runner()->shouldDumpEditingCallbacks()) |
| 56 delegate()->PrintMessage( | 58 delegate()->PrintMessage( |
| 57 "EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n"); | 59 "EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n"); |
| 58 } | 60 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 151 |
| 150 void WebViewTestClient::didFocus() { | 152 void WebViewTestClient::didFocus() { |
| 151 test_runner()->SetFocus(web_view_test_proxy_base_->web_view(), true); | 153 test_runner()->SetFocus(web_view_test_proxy_base_->web_view(), true); |
| 152 } | 154 } |
| 153 | 155 |
| 154 TestRunner* WebViewTestClient::test_runner() { | 156 TestRunner* WebViewTestClient::test_runner() { |
| 155 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); | 157 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); |
| 156 } | 158 } |
| 157 | 159 |
| 158 } // namespace test_runner | 160 } // namespace test_runner |
| OLD | NEW |