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 "content/shell/renderer/test_runner/web_test_proxy.h" | 5 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
6 | 6 |
7 #include <cctype> | 7 #include <cctype> |
8 | 8 |
9 #include "base/base64.h" | |
9 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
15 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
16 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
17 #include "content/shell/renderer/test_runner/accessibility_controller.h" | 18 #include "content/shell/renderer/test_runner/accessibility_controller.h" |
18 #include "content/shell/renderer/test_runner/event_sender.h" | 19 #include "content/shell/renderer/test_runner/event_sender.h" |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
799 | 800 |
800 delegate_->PrintMessage(message + "\n"); | 801 delegate_->PrintMessage(message + "\n"); |
801 } | 802 } |
802 } | 803 } |
803 | 804 |
804 void WebTestProxyBase::StartDragging(blink::WebLocalFrame* frame, | 805 void WebTestProxyBase::StartDragging(blink::WebLocalFrame* frame, |
805 const blink::WebDragData& data, | 806 const blink::WebDragData& data, |
806 blink::WebDragOperationsMask mask, | 807 blink::WebDragOperationsMask mask, |
807 const blink::WebImage& image, | 808 const blink::WebImage& image, |
808 const blink::WebPoint& point) { | 809 const blink::WebPoint& point) { |
810 if (test_interfaces_->GetTestRunner()->shouldDumpDragImage()) { | |
811 const SkBitmap bitmap = image.getSkBitmap(); | |
812 SkAutoLockPixels lock(bitmap); | |
813 std::string encoded; | |
814 base::Base64Encode(base::StringPiece(static_cast<char*>(bitmap.getPixels()), | |
jackhou1
2015/02/10 01:54:20
Is there a better way to represent the image? This
Justin Novosad
2015/02/10 22:37:48
Yeah this is not ideal. It would be much better to
jackhou1
2015/02/11 00:08:24
Just one. And I imagine that would be fine for any
| |
815 bitmap.getSize()), | |
816 &encoded); | |
817 delegate_->PrintMessage(std::string("DragImage: ") + encoded + "\n"); | |
818 } | |
809 // When running a test, we need to fake a drag drop operation otherwise | 819 // When running a test, we need to fake a drag drop operation otherwise |
810 // Windows waits for real mouse events to know when the drag is over. | 820 // Windows waits for real mouse events to know when the drag is over. |
811 test_interfaces_->GetEventSender()->DoDragDrop(data, mask); | 821 test_interfaces_->GetEventSender()->DoDragDrop(data, mask); |
812 } | 822 } |
813 | 823 |
814 // The output from these methods in layout test mode should match that | 824 // The output from these methods in layout test mode should match that |
815 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. | 825 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. |
816 | 826 |
817 void WebTestProxyBase::DidChangeSelection(bool is_empty_callback) { | 827 void WebTestProxyBase::DidChangeSelection(bool is_empty_callback) { |
818 if (test_interfaces_->GetTestRunner()->shouldDumpEditingCallbacks()) | 828 if (test_interfaces_->GetTestRunner()->shouldDumpEditingCallbacks()) |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1313 // to cancel the input method's ongoing composition session. | 1323 // to cancel the input method's ongoing composition session. |
1314 if (web_widget_) | 1324 if (web_widget_) |
1315 web_widget_->confirmComposition(); | 1325 web_widget_->confirmComposition(); |
1316 } | 1326 } |
1317 | 1327 |
1318 blink::WebString WebTestProxyBase::acceptLanguages() { | 1328 blink::WebString WebTestProxyBase::acceptLanguages() { |
1319 return blink::WebString::fromUTF8(accept_languages_); | 1329 return blink::WebString::fromUTF8(accept_languages_); |
1320 } | 1330 } |
1321 | 1331 |
1322 } // namespace content | 1332 } // namespace content |
OLD | NEW |