| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "third_party/WebKit/public/web/WebFrame.h" | 21 #include "third_party/WebKit/public/web/WebFrame.h" |
| 22 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 22 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 23 #include "third_party/WebKit/public/web/WebPagePopup.h" | 23 #include "third_party/WebKit/public/web/WebPagePopup.h" |
| 24 #include "third_party/WebKit/public/web/WebPrintParams.h" | 24 #include "third_party/WebKit/public/web/WebPrintParams.h" |
| 25 #include "third_party/WebKit/public/web/WebView.h" | 25 #include "third_party/WebKit/public/web/WebView.h" |
| 26 #include "third_party/WebKit/public/web/WebWidget.h" | 26 #include "third_party/WebKit/public/web/WebWidget.h" |
| 27 | 27 |
| 28 namespace test_runner { | 28 namespace test_runner { |
| 29 | 29 |
| 30 WebViewTestClient::WebViewTestClient(TestRunner* test_runner, | 30 WebViewTestClient::WebViewTestClient(TestRunner* test_runner, |
| 31 EventSender* event_sender, | |
| 32 WebTestProxyBase* web_test_proxy_base) | 31 WebTestProxyBase* web_test_proxy_base) |
| 33 : test_runner_(test_runner), | 32 : test_runner_(test_runner), |
| 34 event_sender_(event_sender), | |
| 35 web_test_proxy_base_(web_test_proxy_base), | 33 web_test_proxy_base_(web_test_proxy_base), |
| 36 animation_scheduled_(false), | 34 animation_scheduled_(false), |
| 37 weak_factory_(this) { | 35 weak_factory_(this) { |
| 38 DCHECK(test_runner); | 36 DCHECK(test_runner); |
| 39 DCHECK(event_sender); | |
| 40 DCHECK(web_test_proxy_base); | 37 DCHECK(web_test_proxy_base); |
| 41 } | 38 } |
| 42 | 39 |
| 43 WebViewTestClient::~WebViewTestClient() {} | 40 WebViewTestClient::~WebViewTestClient() {} |
| 44 | 41 |
| 45 void WebViewTestClient::scheduleAnimation() { | 42 void WebViewTestClient::scheduleAnimation() { |
| 46 if (!test_runner_->TestIsRunning()) | 43 if (!test_runner_->TestIsRunning()) |
| 47 return; | 44 return; |
| 48 | 45 |
| 49 if (!animation_scheduled_) { | 46 if (!animation_scheduled_) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 75 | 72 |
| 76 void WebViewTestClient::startDragging(blink::WebLocalFrame* frame, | 73 void WebViewTestClient::startDragging(blink::WebLocalFrame* frame, |
| 77 const blink::WebDragData& data, | 74 const blink::WebDragData& data, |
| 78 blink::WebDragOperationsMask mask, | 75 blink::WebDragOperationsMask mask, |
| 79 const blink::WebImage& image, | 76 const blink::WebImage& image, |
| 80 const blink::WebPoint& point) { | 77 const blink::WebPoint& point) { |
| 81 test_runner_->setDragImage(image); | 78 test_runner_->setDragImage(image); |
| 82 | 79 |
| 83 // When running a test, we need to fake a drag drop operation otherwise | 80 // When running a test, we need to fake a drag drop operation otherwise |
| 84 // Windows waits for real mouse events to know when the drag is over. | 81 // Windows waits for real mouse events to know when the drag is over. |
| 85 event_sender_->DoDragDrop(data, mask); | 82 web_test_proxy_base_->event_sender()->DoDragDrop(data, mask); |
| 86 } | 83 } |
| 87 | 84 |
| 88 // The output from these methods in layout test mode should match that | 85 // The output from these methods in layout test mode should match that |
| 89 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. | 86 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. |
| 90 | 87 |
| 91 void WebViewTestClient::didChangeContents() { | 88 void WebViewTestClient::didChangeContents() { |
| 92 if (test_runner_->shouldDumpEditingCallbacks()) | 89 if (test_runner_->shouldDumpEditingCallbacks()) |
| 93 delegate()->PrintMessage( | 90 delegate()->PrintMessage( |
| 94 "EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n"); | 91 "EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n"); |
| 95 } | 92 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 208 |
| 212 blink::WebString WebViewTestClient::acceptLanguages() { | 209 blink::WebString WebViewTestClient::acceptLanguages() { |
| 213 return blink::WebString::fromUTF8(test_runner_->GetAcceptLanguages()); | 210 return blink::WebString::fromUTF8(test_runner_->GetAcceptLanguages()); |
| 214 } | 211 } |
| 215 | 212 |
| 216 WebTestDelegate* WebViewTestClient::delegate() { | 213 WebTestDelegate* WebViewTestClient::delegate() { |
| 217 return web_test_proxy_base_->delegate(); | 214 return web_test_proxy_base_->delegate(); |
| 218 } | 215 } |
| 219 | 216 |
| 220 } // namespace test_runner | 217 } // namespace test_runner |
| OLD | NEW |